import type { ComponentProps, ComponentType, Context } from 'react'; import { useDropdownButton } from '@/ui/dropdown/hooks/useDropdownButton'; import { TopBar } from '@/ui/top-bar/TopBar'; import { FiltersHotkeyScope } from '../types/FiltersHotkeyScope'; import { ViewsHotkeyScope } from '../types/ViewsHotkeyScope'; import { FilterDropdownButton } from './FilterDropdownButton'; import { SortDropdownButton, type SortDropdownButtonProps, } from './SortDropdownButton'; import { UpdateViewButtonGroup, type UpdateViewButtonGroupProps, } from './UpdateViewButtonGroup'; import ViewBarDetails, { type ViewBarDetailsProps } from './ViewBarDetails'; import { ViewsDropdownButton, type ViewsDropdownButtonProps, } from './ViewsDropdownButton'; export type ViewBarProps = ComponentProps<'div'> & { OptionsDropdownButton: ComponentType; optionsDropdownKey: string; scopeContext: Context; } & Pick< ViewsDropdownButtonProps, 'defaultViewName' | 'onViewsChange' | 'onViewSelect' > & Pick, 'availableSorts'> & Pick & Pick; export const ViewBar = ({ availableSorts, canPersistViewFields, defaultViewName, onReset, onViewsChange, onViewSelect, onViewSubmit, OptionsDropdownButton, optionsDropdownKey, scopeContext, ...props }: ViewBarProps) => { const { openDropdownButton: openOptionsDropdownButton } = useDropdownButton({ key: optionsDropdownKey, }); return ( } displayBottomBorder={false} rightComponent={ <> context={scopeContext} availableSorts={availableSorts} hotkeyScope={FiltersHotkeyScope.FilterDropdownButton} isPrimaryButton /> } bottomComponent={ } /> } /> ); };