Refator/sorts dropdown (#1568)
* WIP * Fixed lint * Ok for sorts * Fixed on dropdown toggle * Fix lint
This commit is contained in:
@ -10,29 +10,23 @@ import { BoardOptionsHotkeyScope } from '../types/BoardOptionsHotkeyScope';
|
||||
|
||||
import { BoardOptionsDropdown } from './BoardOptionsDropdown';
|
||||
|
||||
export type BoardHeaderProps<SortField> = ComponentProps<'div'> & {
|
||||
export type BoardHeaderProps = ComponentProps<'div'> & {
|
||||
onStageAdd?: (boardColumn: BoardColumnDefinition) => void;
|
||||
} & Pick<
|
||||
ViewBarProps<SortField>,
|
||||
| 'availableSorts'
|
||||
| 'defaultViewName'
|
||||
| 'onViewsChange'
|
||||
| 'onViewSubmit'
|
||||
| 'scopeContext'
|
||||
ViewBarProps,
|
||||
'defaultViewName' | 'onViewsChange' | 'onViewSubmit' | 'scopeContext'
|
||||
>;
|
||||
|
||||
export function BoardHeader<SortField>({
|
||||
export function BoardHeader({
|
||||
onStageAdd,
|
||||
onViewsChange,
|
||||
onViewSubmit,
|
||||
scopeContext,
|
||||
availableSorts,
|
||||
defaultViewName,
|
||||
}: BoardHeaderProps<SortField>) {
|
||||
}: BoardHeaderProps) {
|
||||
return (
|
||||
<RecoilScope SpecificContext={DropdownRecoilScopeContext}>
|
||||
<ViewBar
|
||||
availableSorts={availableSorts}
|
||||
defaultViewName={defaultViewName}
|
||||
onViewsChange={onViewsChange}
|
||||
onViewSubmit={onViewSubmit}
|
||||
|
||||
@ -27,7 +27,7 @@ export function BoardOptionsDropdown({
|
||||
/>
|
||||
}
|
||||
dropdownHotkeyScope={customHotkeyScope}
|
||||
dropdownKey={BoardOptionsDropdownKey}
|
||||
dropdownId={BoardOptionsDropdownKey}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { BoardOptionsDropdownKey } from '../types/BoardOptionsDropdownKey';
|
||||
|
||||
export function BoardOptionsDropdownButton() {
|
||||
const { isDropdownButtonOpen, toggleDropdownButton } = useDropdownButton({
|
||||
key: BoardOptionsDropdownKey,
|
||||
dropdownId: BoardOptionsDropdownKey,
|
||||
});
|
||||
|
||||
function handleClick() {
|
||||
|
||||
@ -126,7 +126,7 @@ export function BoardOptionsDropdownContent({
|
||||
const { handleFieldVisibilityChange } = useBoardCardFields({ scopeContext });
|
||||
|
||||
const { closeDropdownButton } = useDropdownButton({
|
||||
key: BoardOptionsDropdownKey,
|
||||
dropdownId: BoardOptionsDropdownKey,
|
||||
});
|
||||
|
||||
useScopedHotkeys(
|
||||
|
||||
@ -22,7 +22,6 @@ import {
|
||||
PipelineStage,
|
||||
useUpdateOnePipelineProgressStageMutation,
|
||||
} from '~/generated/graphql';
|
||||
import { PipelineProgressOrderByWithRelationInput as PipelineProgresses_Order_By } from '~/generated/graphql';
|
||||
|
||||
import { useCurrentCardSelected } from '../hooks/useCurrentCardSelected';
|
||||
import { useSetCardSelected } from '../hooks/useSetCardSelected';
|
||||
@ -41,7 +40,7 @@ export type EntityBoardProps = {
|
||||
onEditColumnTitle: (columnId: string, title: string, color: string) => void;
|
||||
scopeContext: Context<string | null>;
|
||||
} & Pick<
|
||||
BoardHeaderProps<PipelineProgresses_Order_By>,
|
||||
BoardHeaderProps,
|
||||
'defaultViewName' | 'onViewsChange' | 'onViewSubmit'
|
||||
>;
|
||||
|
||||
@ -142,7 +141,6 @@ export function EntityBoard({
|
||||
<StyledWrapper>
|
||||
<StyledBoardHeader
|
||||
defaultViewName={defaultViewName}
|
||||
availableSorts={boardOptions.sorts}
|
||||
onStageAdd={onColumnAdd}
|
||||
onViewsChange={onViewsChange}
|
||||
onViewSubmit={onViewSubmit}
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import type { ComponentType, Context } from 'react';
|
||||
|
||||
import { FilterDefinitionByEntity } from '@/ui/view-bar/types/FilterDefinitionByEntity';
|
||||
import { SortType } from '@/ui/view-bar/types/interface';
|
||||
import { SortDefinition } from '@/ui/view-bar/types/SortDefinition';
|
||||
import { PipelineProgress } from '~/generated/graphql';
|
||||
import { PipelineProgressOrderByWithRelationInput as PipelineProgresses_Order_By } from '~/generated/graphql';
|
||||
|
||||
export type BoardOptions = {
|
||||
newCardComponent: React.ReactNode;
|
||||
CardComponent: ComponentType<{ scopeContext: Context<string | null> }>;
|
||||
filters: FilterDefinitionByEntity<PipelineProgress>[];
|
||||
sorts: Array<SortType<PipelineProgresses_Order_By>>;
|
||||
sorts: SortDefinition[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user