Merge branch 'brendanlaschke-context-menu-vertical'
This commit is contained in:
@ -27,8 +27,12 @@ import { CompanyBoardRecoilScopeContext } from '../states/recoil-scope-contexts/
|
|||||||
|
|
||||||
export function HooksCompanyBoard({
|
export function HooksCompanyBoard({
|
||||||
orderBy,
|
orderBy,
|
||||||
|
setActionBar,
|
||||||
|
setContextMenu,
|
||||||
}: {
|
}: {
|
||||||
orderBy: PipelineProgresses_Order_By[];
|
orderBy: PipelineProgresses_Order_By[];
|
||||||
|
setActionBar?: () => void;
|
||||||
|
setContextMenu?: () => void;
|
||||||
}) {
|
}) {
|
||||||
const setFieldsDefinitionsState = useSetRecoilState(
|
const setFieldsDefinitionsState = useSetRecoilState(
|
||||||
viewFieldsDefinitionsState,
|
viewFieldsDefinitionsState,
|
||||||
@ -113,6 +117,13 @@ export function HooksCompanyBoard({
|
|||||||
const loading =
|
const loading =
|
||||||
loadingGetPipelines || loadingGetPipelineProgress || loadingGetCompanies;
|
loadingGetPipelines || loadingGetPipelineProgress || loadingGetCompanies;
|
||||||
|
|
||||||
|
if (setActionBar) {
|
||||||
|
setActionBar();
|
||||||
|
}
|
||||||
|
if (setContextMenu) {
|
||||||
|
setContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading && pipeline && pipelineProgresses && companiesData) {
|
if (!loading && pipeline && pipelineProgresses && companiesData) {
|
||||||
updateCompanyBoard(pipeline, pipelineProgresses, companiesData.companies);
|
updateCompanyBoard(pipeline, pipelineProgresses, companiesData.companies);
|
||||||
|
|||||||
46
front/src/modules/companies/hooks/useActionBarEntries.tsx
Normal file
46
front/src/modules/companies/hooks/useActionBarEntries.tsx
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
||||||
|
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import { ActionBarEntry } from '@/ui/action-bar/components/ActionBarEntry';
|
||||||
|
import { actionBarEntriesState } from '@/ui/action-bar/states/ActionBarEntriesState';
|
||||||
|
import { IconCheckbox, IconNotes, IconTrash } from '@/ui/icon';
|
||||||
|
import { ActivityType } from '~/generated/graphql';
|
||||||
|
|
||||||
|
import { useDeleteSelectedComapnies } from './useDeleteCompanies';
|
||||||
|
|
||||||
|
export function useActionBarEntries() {
|
||||||
|
const setActionBarEntries = useSetRecoilState(actionBarEntriesState);
|
||||||
|
|
||||||
|
const openCreateActivityRightDrawer =
|
||||||
|
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||||
|
|
||||||
|
async function handleActivityClick(type: ActivityType) {
|
||||||
|
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Company);
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteSelectedCompanies = useDeleteSelectedComapnies();
|
||||||
|
return () => {
|
||||||
|
setActionBarEntries([
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Note"
|
||||||
|
icon={<IconNotes size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Note)}
|
||||||
|
key="note"
|
||||||
|
/>,
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Task"
|
||||||
|
icon={<IconCheckbox size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Task)}
|
||||||
|
key="task"
|
||||||
|
/>,
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Delete"
|
||||||
|
icon={<IconTrash size={16} />}
|
||||||
|
type="danger"
|
||||||
|
onClick={() => deleteSelectedCompanies()}
|
||||||
|
key="delete"
|
||||||
|
/>,
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
47
front/src/modules/companies/hooks/useContextMenuEntries.tsx
Normal file
47
front/src/modules/companies/hooks/useContextMenuEntries.tsx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { IconCheckbox, IconNotes, IconTrash } from '@tabler/icons-react';
|
||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
||||||
|
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import { ContextMenuEntry } from '@/ui/context-menu/components/ContextMenuEntry';
|
||||||
|
import { contextMenuEntriesState } from '@/ui/context-menu/states/ContextMenuEntriesState';
|
||||||
|
import { ActivityType } from '~/generated/graphql';
|
||||||
|
|
||||||
|
import { useDeleteSelectedComapnies } from './useDeleteCompanies';
|
||||||
|
|
||||||
|
export function useContextMenuEntries() {
|
||||||
|
const setContextMenuEntries = useSetRecoilState(contextMenuEntriesState);
|
||||||
|
|
||||||
|
const openCreateActivityRightDrawer =
|
||||||
|
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||||
|
|
||||||
|
async function handleButtonClick(type: ActivityType) {
|
||||||
|
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Company);
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteSelectedCompanies = useDeleteSelectedComapnies();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setContextMenuEntries([
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Note"
|
||||||
|
icon={<IconNotes size={16} />}
|
||||||
|
onClick={() => handleButtonClick(ActivityType.Note)}
|
||||||
|
key="note"
|
||||||
|
/>,
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Task"
|
||||||
|
icon={<IconCheckbox size={16} />}
|
||||||
|
onClick={() => handleButtonClick(ActivityType.Task)}
|
||||||
|
key="task"
|
||||||
|
/>,
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Delete"
|
||||||
|
icon={<IconTrash size={16} />}
|
||||||
|
type="danger"
|
||||||
|
onClick={() => deleteSelectedCompanies()}
|
||||||
|
key="delete"
|
||||||
|
/>,
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -2,14 +2,12 @@ import { getOperationName } from '@apollo/client/utilities';
|
|||||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { GET_PIPELINES } from '@/pipeline/queries';
|
import { GET_PIPELINES } from '@/pipeline/queries';
|
||||||
import { IconTrash } from '@/ui/icon/index';
|
|
||||||
import { EntityTableActionBarButton } from '@/ui/table/action-bar/components/EntityTableActionBarButton';
|
|
||||||
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
|
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
|
||||||
import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowIdsSelector';
|
import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowIdsSelector';
|
||||||
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
||||||
import { useDeleteManyCompaniesMutation } from '~/generated/graphql';
|
import { useDeleteManyCompaniesMutation } from '~/generated/graphql';
|
||||||
|
|
||||||
export function TableActionBarButtonDeleteCompanies() {
|
export function useDeleteSelectedComapnies() {
|
||||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||||
|
|
||||||
const resetRowSelection = useResetTableRowSelection();
|
const resetRowSelection = useResetTableRowSelection();
|
||||||
@ -20,7 +18,7 @@ export function TableActionBarButtonDeleteCompanies() {
|
|||||||
|
|
||||||
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||||
|
|
||||||
async function handleDeleteClick() {
|
async function deleteSelectedCompanies() {
|
||||||
const rowIdsToDelete = selectedRowIds;
|
const rowIdsToDelete = selectedRowIds;
|
||||||
|
|
||||||
resetRowSelection();
|
resetRowSelection();
|
||||||
@ -43,12 +41,5 @@ export function TableActionBarButtonDeleteCompanies() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return deleteSelectedCompanies;
|
||||||
<EntityTableActionBarButton
|
|
||||||
label="Delete"
|
|
||||||
icon={<IconTrash size={16} />}
|
|
||||||
type="warning"
|
|
||||||
onClick={handleDeleteClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@ -2,6 +2,8 @@ import { useMemo } from 'react';
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { companyViewFields } from '@/companies/constants/companyViewFields';
|
import { companyViewFields } from '@/companies/constants/companyViewFields';
|
||||||
|
import { useActionBarEntries } from '@/companies/hooks/useActionBarEntries';
|
||||||
|
import { useContextMenuEntries } from '@/companies/hooks/useContextMenuEntries';
|
||||||
import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState';
|
import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState';
|
||||||
import { sortsOrderByScopedState } from '@/ui/filter-n-sort/states/sortScopedState';
|
import { sortsOrderByScopedState } from '@/ui/filter-n-sort/states/sortScopedState';
|
||||||
import { turnFilterIntoWhereClause } from '@/ui/filter-n-sort/utils/turnFilterIntoWhereClause';
|
import { turnFilterIntoWhereClause } from '@/ui/filter-n-sort/utils/turnFilterIntoWhereClause';
|
||||||
@ -51,6 +53,9 @@ export function CompanyTable() {
|
|||||||
return { AND: filters.map(turnFilterIntoWhereClause) };
|
return { AND: filters.map(turnFilterIntoWhereClause) };
|
||||||
}, [filters]) as any;
|
}, [filters]) as any;
|
||||||
|
|
||||||
|
const setContextMenu = useContextMenuEntries();
|
||||||
|
const setActionBar = useActionBarEntries();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<GenericEntityTableData
|
<GenericEntityTableData
|
||||||
@ -59,6 +64,8 @@ export function CompanyTable() {
|
|||||||
orderBy={orderBy.length ? orderBy : defaultOrderBy}
|
orderBy={orderBy.length ? orderBy : defaultOrderBy}
|
||||||
whereFilters={whereFilters}
|
whereFilters={whereFilters}
|
||||||
filterDefinitionArray={companiesFilters}
|
filterDefinitionArray={companiesFilters}
|
||||||
|
setContextMenu={setContextMenu}
|
||||||
|
setActionBar={setActionBar}
|
||||||
/>
|
/>
|
||||||
<EntityTable
|
<EntityTable
|
||||||
viewName="All Companies"
|
viewName="All Companies"
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
|
||||||
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
|
||||||
import { TableActionBarButtonToggleComments } from '@/ui/table/action-bar/components/TableActionBarButtonOpenComments';
|
|
||||||
import { TableActionBarButtonToggleTasks } from '@/ui/table/action-bar/components/TableActionBarButtonOpenTasks';
|
|
||||||
import { ActivityType } from '~/generated/graphql';
|
|
||||||
|
|
||||||
export function TableActionBarButtonCreateActivityCompany() {
|
|
||||||
const openCreateActivityRightDrawer =
|
|
||||||
useOpenCreateActivityDrawerForSelectedRowIds();
|
|
||||||
|
|
||||||
async function handleButtonClick(type: ActivityType) {
|
|
||||||
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Company);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<TableActionBarButtonToggleComments
|
|
||||||
onClick={() => handleButtonClick(ActivityType.Note)}
|
|
||||||
/>
|
|
||||||
<TableActionBarButtonToggleTasks
|
|
||||||
onClick={() => handleButtonClick(ActivityType.Task)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
81
front/src/modules/people/hooks/useActionBarEntries.tsx
Normal file
81
front/src/modules/people/hooks/useActionBarEntries.tsx
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import { getOperationName } from '@apollo/client/utilities';
|
||||||
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
||||||
|
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import { ActionBarEntry } from '@/ui/action-bar/components/ActionBarEntry';
|
||||||
|
import { actionBarEntriesState } from '@/ui/action-bar/states/ActionBarEntriesState';
|
||||||
|
import { IconCheckbox, IconNotes, IconTrash } from '@/ui/icon';
|
||||||
|
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
|
||||||
|
import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowIdsSelector';
|
||||||
|
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
||||||
|
import { ActivityType, useDeleteManyPersonMutation } from '~/generated/graphql';
|
||||||
|
|
||||||
|
import { GET_PEOPLE } from '../queries';
|
||||||
|
|
||||||
|
export function useActionBarEntries() {
|
||||||
|
const setActionBarEntries = useSetRecoilState(actionBarEntriesState);
|
||||||
|
|
||||||
|
const openCreateActivityRightDrawer =
|
||||||
|
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||||
|
|
||||||
|
async function handleActivityClick(type: ActivityType) {
|
||||||
|
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Person);
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||||
|
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||||
|
|
||||||
|
const resetRowSelection = useResetTableRowSelection();
|
||||||
|
|
||||||
|
const [deleteManyPerson] = useDeleteManyPersonMutation({
|
||||||
|
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleDeleteClick() {
|
||||||
|
const rowIdsToDelete = selectedRowIds;
|
||||||
|
|
||||||
|
resetRowSelection();
|
||||||
|
|
||||||
|
await deleteManyPerson({
|
||||||
|
variables: {
|
||||||
|
ids: rowIdsToDelete,
|
||||||
|
},
|
||||||
|
optimisticResponse: {
|
||||||
|
__typename: 'Mutation',
|
||||||
|
deleteManyPerson: {
|
||||||
|
count: rowIdsToDelete.length,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update: () => {
|
||||||
|
setTableRowIds(
|
||||||
|
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setActionBarEntries([
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Note"
|
||||||
|
icon={<IconNotes size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Note)}
|
||||||
|
key="note"
|
||||||
|
/>,
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Task"
|
||||||
|
icon={<IconCheckbox size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Task)}
|
||||||
|
key="task"
|
||||||
|
/>,
|
||||||
|
<ActionBarEntry
|
||||||
|
label="Delete"
|
||||||
|
icon={<IconTrash size={16} />}
|
||||||
|
type="danger"
|
||||||
|
onClick={handleDeleteClick}
|
||||||
|
key="delte"
|
||||||
|
/>,
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
81
front/src/modules/people/hooks/useContextMenuEntries.tsx
Normal file
81
front/src/modules/people/hooks/useContextMenuEntries.tsx
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import { getOperationName } from '@apollo/client/utilities';
|
||||||
|
import { IconCheckbox, IconNotes, IconTrash } from '@tabler/icons-react';
|
||||||
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
||||||
|
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import { ContextMenuEntry } from '@/ui/context-menu/components/ContextMenuEntry';
|
||||||
|
import { contextMenuEntriesState } from '@/ui/context-menu/states/ContextMenuEntriesState';
|
||||||
|
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
|
||||||
|
import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowIdsSelector';
|
||||||
|
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
||||||
|
import { ActivityType, useDeleteManyPersonMutation } from '~/generated/graphql';
|
||||||
|
|
||||||
|
import { GET_PEOPLE } from '../queries';
|
||||||
|
|
||||||
|
export function useContextMenuEntries() {
|
||||||
|
const setContextMenuEntries = useSetRecoilState(contextMenuEntriesState);
|
||||||
|
|
||||||
|
const openCreateActivityRightDrawer =
|
||||||
|
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||||
|
|
||||||
|
async function handleActivityClick(type: ActivityType) {
|
||||||
|
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Person);
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||||
|
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||||
|
|
||||||
|
const resetRowSelection = useResetTableRowSelection();
|
||||||
|
|
||||||
|
const [deleteManyPerson] = useDeleteManyPersonMutation({
|
||||||
|
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleDeleteClick() {
|
||||||
|
const rowIdsToDelete = selectedRowIds;
|
||||||
|
|
||||||
|
resetRowSelection();
|
||||||
|
|
||||||
|
await deleteManyPerson({
|
||||||
|
variables: {
|
||||||
|
ids: rowIdsToDelete,
|
||||||
|
},
|
||||||
|
optimisticResponse: {
|
||||||
|
__typename: 'Mutation',
|
||||||
|
deleteManyPerson: {
|
||||||
|
count: rowIdsToDelete.length,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update: () => {
|
||||||
|
setTableRowIds(
|
||||||
|
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setContextMenuEntries([
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Note"
|
||||||
|
icon={<IconNotes size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Note)}
|
||||||
|
key="note"
|
||||||
|
/>,
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Task"
|
||||||
|
icon={<IconCheckbox size={16} />}
|
||||||
|
onClick={() => handleActivityClick(ActivityType.Task)}
|
||||||
|
key="task"
|
||||||
|
/>,
|
||||||
|
<ContextMenuEntry
|
||||||
|
label="Delete"
|
||||||
|
icon={<IconTrash size={16} />}
|
||||||
|
type="danger"
|
||||||
|
onClick={handleDeleteClick}
|
||||||
|
key="delete"
|
||||||
|
/>,
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ import { useMemo } from 'react';
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { peopleViewFields } from '@/people/constants/peopleViewFields';
|
import { peopleViewFields } from '@/people/constants/peopleViewFields';
|
||||||
|
import { useActionBarEntries } from '@/people/hooks/useActionBarEntries';
|
||||||
|
import { useContextMenuEntries } from '@/people/hooks/useContextMenuEntries';
|
||||||
import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState';
|
import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState';
|
||||||
import { sortsOrderByScopedState } from '@/ui/filter-n-sort/states/sortScopedState';
|
import { sortsOrderByScopedState } from '@/ui/filter-n-sort/states/sortScopedState';
|
||||||
import { turnFilterIntoWhereClause } from '@/ui/filter-n-sort/utils/turnFilterIntoWhereClause';
|
import { turnFilterIntoWhereClause } from '@/ui/filter-n-sort/utils/turnFilterIntoWhereClause';
|
||||||
@ -51,6 +53,9 @@ export function PeopleTable() {
|
|||||||
return { AND: filters.map(turnFilterIntoWhereClause) };
|
return { AND: filters.map(turnFilterIntoWhereClause) };
|
||||||
}, [filters]) as any;
|
}, [filters]) as any;
|
||||||
|
|
||||||
|
const setContextMenu = useContextMenuEntries();
|
||||||
|
const setActionBar = useActionBarEntries();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<GenericEntityTableData
|
<GenericEntityTableData
|
||||||
@ -59,6 +64,8 @@ export function PeopleTable() {
|
|||||||
orderBy={orderBy.length ? orderBy : defaultOrderBy}
|
orderBy={orderBy.length ? orderBy : defaultOrderBy}
|
||||||
whereFilters={whereFilters}
|
whereFilters={whereFilters}
|
||||||
filterDefinitionArray={peopleFilters}
|
filterDefinitionArray={peopleFilters}
|
||||||
|
setContextMenu={setContextMenu}
|
||||||
|
setActionBar={setActionBar}
|
||||||
/>
|
/>
|
||||||
<EntityTable
|
<EntityTable
|
||||||
viewName="All People"
|
viewName="All People"
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
import { useOpenCreateActivityDrawerForSelectedRowIds } from '@/activities/hooks/useOpenCreateActivityDrawerForSelectedRowIds';
|
|
||||||
import { ActivityTargetableEntityType } from '@/activities/types/ActivityTargetableEntity';
|
|
||||||
import { TableActionBarButtonToggleComments } from '@/ui/table/action-bar/components/TableActionBarButtonOpenComments';
|
|
||||||
import { TableActionBarButtonToggleTasks } from '@/ui/table/action-bar/components/TableActionBarButtonOpenTasks';
|
|
||||||
import { ActivityType } from '~/generated/graphql';
|
|
||||||
|
|
||||||
export function TableActionBarButtonCreateActivityPeople() {
|
|
||||||
const openCreateActivityRightDrawer =
|
|
||||||
useOpenCreateActivityDrawerForSelectedRowIds();
|
|
||||||
|
|
||||||
async function handleButtonClick(type: ActivityType) {
|
|
||||||
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Person);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<TableActionBarButtonToggleComments
|
|
||||||
onClick={() => handleButtonClick(ActivityType.Note)}
|
|
||||||
/>
|
|
||||||
<TableActionBarButtonToggleTasks
|
|
||||||
onClick={() => handleButtonClick(ActivityType.Task)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
import { getOperationName } from '@apollo/client/utilities';
|
|
||||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
|
||||||
|
|
||||||
import { GET_PEOPLE } from '@/people/queries';
|
|
||||||
import { IconTrash } from '@/ui/icon/index';
|
|
||||||
import { EntityTableActionBarButton } from '@/ui/table/action-bar/components/EntityTableActionBarButton';
|
|
||||||
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
|
|
||||||
import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowIdsSelector';
|
|
||||||
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
|
||||||
import { useDeleteManyPersonMutation } from '~/generated/graphql';
|
|
||||||
|
|
||||||
export function TableActionBarButtonDeletePeople() {
|
|
||||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
|
||||||
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
|
||||||
|
|
||||||
const resetRowSelection = useResetTableRowSelection();
|
|
||||||
|
|
||||||
const [deleteManyPerson] = useDeleteManyPersonMutation({
|
|
||||||
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
|
||||||
});
|
|
||||||
|
|
||||||
async function handleDeleteClick() {
|
|
||||||
const rowIdsToDelete = selectedRowIds;
|
|
||||||
|
|
||||||
resetRowSelection();
|
|
||||||
|
|
||||||
await deleteManyPerson({
|
|
||||||
variables: {
|
|
||||||
ids: rowIdsToDelete,
|
|
||||||
},
|
|
||||||
optimisticResponse: {
|
|
||||||
__typename: 'Mutation',
|
|
||||||
deleteManyPerson: {
|
|
||||||
count: rowIdsToDelete.length,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
update: () => {
|
|
||||||
setTableRowIds(
|
|
||||||
tableRowIds.filter((id) => !rowIdsToDelete.includes(id)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<EntityTableActionBarButton
|
|
||||||
label="Delete"
|
|
||||||
icon={<IconTrash size={16} />}
|
|
||||||
type="warning"
|
|
||||||
onClick={handleDeleteClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,66 +1,48 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { contextMenuPositionState } from '@/ui/table/states/contextMenuPositionState';
|
import { actionBarEntriesState } from '@/ui/action-bar/states/ActionBarEntriesState';
|
||||||
|
import { contextMenuOpenState } from '@/ui/context-menu/states/ContextMenuIsOpenState';
|
||||||
|
|
||||||
import { PositionType } from '../types/PositionType';
|
import { actionBarOpenState } from '../states/ActionBarIsOpenState';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
children: React.ReactNode | React.ReactNode[];
|
|
||||||
selectedIds: string[];
|
selectedIds: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyledContainerProps = {
|
const StyledContainerActionBar = styled.div`
|
||||||
position: PositionType;
|
|
||||||
};
|
|
||||||
|
|
||||||
const StyledContainer = styled.div<StyledContainerProps>`
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
border: 1px solid ${({ theme }) => theme.border.color.medium};
|
border: 1px solid ${({ theme }) => theme.border.color.medium};
|
||||||
border-radius: ${({ theme }) => theme.border.radius.md};
|
border-radius: ${({ theme }) => theme.border.radius.md};
|
||||||
bottom: ${(props) => (props.position.x ? 'auto' : '38px')};
|
bottom: 38px;
|
||||||
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
|
|
||||||
left: ${(props) => (props.position.x ? `${props.position.x}px` : '50%')};
|
left: 50%;
|
||||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(2)};
|
padding-right: ${({ theme }) => theme.spacing(2)};
|
||||||
position: ${(props) => (props.position.x ? 'fixed' : 'absolute')};
|
position: absolute;
|
||||||
top: ${(props) => (props.position.y ? `${props.position.y}px` : 'auto')};
|
top: auto;
|
||||||
|
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export function ActionBar({ children, selectedIds }: OwnProps) {
|
export function ActionBar({ selectedIds }: OwnProps) {
|
||||||
const position = useRecoilValue(contextMenuPositionState);
|
const actionBarOpen = useRecoilValue(actionBarOpenState);
|
||||||
const setContextMenuPosition = useSetRecoilState(contextMenuPositionState);
|
const contextMenuOpen = useRecoilValue(contextMenuOpenState);
|
||||||
|
const actionBarEntries = useRecoilValue(actionBarEntriesState);
|
||||||
|
const wrapperRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
if (selectedIds.length === 0 || !actionBarOpen || contextMenuOpen) {
|
||||||
function handleClickOutside(event: MouseEvent) {
|
|
||||||
if (!(event.target as HTMLElement).closest('.action-bar')) {
|
|
||||||
setContextMenuPosition({ x: null, y: null });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('mousedown', handleClickOutside);
|
|
||||||
|
|
||||||
// Cleanup the event listener when the component unmounts
|
|
||||||
return () => {
|
|
||||||
document.removeEventListener('mousedown', handleClickOutside);
|
|
||||||
};
|
|
||||||
}, [setContextMenuPosition]);
|
|
||||||
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer className="action-bar" position={position}>
|
<StyledContainerActionBar ref={wrapperRef}>
|
||||||
{children}
|
{actionBarEntries}
|
||||||
</StyledContainer>
|
</StyledContainerActionBar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,18 +4,18 @@ import styled from '@emotion/styled';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
icon: ReactNode;
|
icon: ReactNode;
|
||||||
label: string;
|
label: string;
|
||||||
type?: 'standard' | 'warning';
|
type?: 'standard' | 'danger';
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyledButtonProps = {
|
type StyledButtonProps = {
|
||||||
type: 'standard' | 'warning';
|
type: 'standard' | 'danger';
|
||||||
};
|
};
|
||||||
|
|
||||||
const StyledButton = styled.div<StyledButtonProps>`
|
const StyledButton = styled.div<StyledButtonProps>`
|
||||||
border-radius: ${({ theme }) => theme.border.radius.sm};
|
border-radius: ${({ theme }) => theme.border.radius.sm};
|
||||||
color: ${(props) =>
|
color: ${(props) =>
|
||||||
props.type === 'warning'
|
props.type === 'danger'
|
||||||
? props.theme.color.red
|
? props.theme.color.red
|
||||||
: props.theme.font.color.secondary};
|
: props.theme.font.color.secondary};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -27,7 +27,8 @@ const StyledButton = styled.div<StyledButtonProps>`
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${({ theme }) => theme.background.tertiary};
|
background: ${({ theme, type }) =>
|
||||||
|
type === 'danger' ? theme.tag.background.red : theme.background.tertiary};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ const StyledButtonLabel = styled.div`
|
|||||||
margin-left: ${({ theme }) => theme.spacing(2)};
|
margin-left: ${({ theme }) => theme.spacing(2)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export function EntityTableActionBarButton({
|
export function ActionBarEntry({
|
||||||
label,
|
label,
|
||||||
icon,
|
icon,
|
||||||
type = 'standard',
|
type = 'standard',
|
||||||
@ -1,14 +1,39 @@
|
|||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useActionBarEntries } from '@/companies/hooks/useActionBarEntries';
|
||||||
|
import { CompanyTableMockMode } from '@/companies/table/components/CompanyTableMockMode';
|
||||||
|
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||||
|
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||||
|
|
||||||
|
import { actionBarOpenState } from '../../states/ActionBarIsOpenState';
|
||||||
import { ActionBar } from '../ActionBar';
|
import { ActionBar } from '../ActionBar';
|
||||||
|
|
||||||
|
function FilledActionBar(props: { selectedIds: string[] }) {
|
||||||
|
const setActionBar = useActionBarEntries();
|
||||||
|
setActionBar();
|
||||||
|
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||||
|
setActionBarOpenState(true);
|
||||||
|
return <ActionBar selectedIds={props.selectedIds} />;
|
||||||
|
}
|
||||||
|
|
||||||
const meta: Meta<typeof ActionBar> = {
|
const meta: Meta<typeof ActionBar> = {
|
||||||
title: 'UI/ActionBar/ActionBar',
|
title: 'UI/ActionBar/ActionBar',
|
||||||
component: ActionBar,
|
component: FilledActionBar,
|
||||||
decorators: [ComponentDecorator],
|
decorators: [
|
||||||
args: { children: 'Lorem ipsum', selectedIds: [] },
|
(Story) => (
|
||||||
|
<RecoilScope SpecificContext={TableRecoilScopeContext}>
|
||||||
|
<CompanyTableMockMode></CompanyTableMockMode>
|
||||||
|
<MemoryRouter>
|
||||||
|
<Story />
|
||||||
|
</MemoryRouter>
|
||||||
|
</RecoilScope>
|
||||||
|
),
|
||||||
|
ComponentDecorator,
|
||||||
|
],
|
||||||
|
args: { selectedIds: ['TestId'] },
|
||||||
};
|
};
|
||||||
|
|
||||||
export default meta;
|
export default meta;
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { ReactElement } from 'react';
|
||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const actionBarEntriesState = atom<ReactElement[]>({
|
||||||
|
key: 'actionBarEntriesState',
|
||||||
|
default: [],
|
||||||
|
});
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const actionBarOpenState = atom<boolean>({
|
||||||
|
key: 'actionBarOpenState',
|
||||||
|
default: false,
|
||||||
|
});
|
||||||
@ -2,8 +2,8 @@ import { getOperationName } from '@apollo/client/utilities';
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { GET_PIPELINES } from '@/pipeline/queries';
|
import { GET_PIPELINES } from '@/pipeline/queries';
|
||||||
|
import { ActionBarEntry } from '@/ui/action-bar/components/ActionBarEntry';
|
||||||
import { IconTrash } from '@/ui/icon/index';
|
import { IconTrash } from '@/ui/icon/index';
|
||||||
import { EntityTableActionBarButton } from '@/ui/table/action-bar/components/EntityTableActionBarButton';
|
|
||||||
import { useDeleteManyPipelineProgressMutation } from '~/generated/graphql';
|
import { useDeleteManyPipelineProgressMutation } from '~/generated/graphql';
|
||||||
|
|
||||||
import { useRemoveCardIds } from '../hooks/useRemoveCardIds';
|
import { useRemoveCardIds } from '../hooks/useRemoveCardIds';
|
||||||
@ -38,11 +38,12 @@ export function BoardActionBarButtonDeleteBoardCard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EntityTableActionBarButton
|
<ActionBarEntry
|
||||||
label="Delete"
|
label="Delete"
|
||||||
icon={<IconTrash size={16} />}
|
icon={<IconTrash size={16} />}
|
||||||
type="warning"
|
type="danger"
|
||||||
onClick={() => handleDelete()}
|
onClick={handleDelete}
|
||||||
|
key="delete"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,7 @@ import { ActionBar } from '@/ui/action-bar/components/ActionBar';
|
|||||||
|
|
||||||
import { selectedCardIdsSelector } from '../states/selectors/selectedCardIdsSelector';
|
import { selectedCardIdsSelector } from '../states/selectors/selectedCardIdsSelector';
|
||||||
|
|
||||||
type OwnProps = {
|
export function EntityBoardActionBar() {
|
||||||
children: React.ReactNode | React.ReactNode[];
|
const selectedBoardCards = useRecoilValue(selectedCardIdsSelector);
|
||||||
};
|
return <ActionBar selectedIds={selectedBoardCards}></ActionBar>;
|
||||||
|
|
||||||
export function EntityBoardActionBar({ children }: OwnProps) {
|
|
||||||
const selectedCardIds = useRecoilValue(selectedCardIdsSelector);
|
|
||||||
return <ActionBar selectedIds={selectedCardIds}>{children}</ActionBar>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
13
front/src/modules/ui/board/hooks/useActionBarEntries.tsx
Normal file
13
front/src/modules/ui/board/hooks/useActionBarEntries.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { actionBarEntriesState } from '@/ui/action-bar/states/ActionBarEntriesState';
|
||||||
|
|
||||||
|
import { BoardActionBarButtonDeleteBoardCard } from '../components/BoardActionBarButtonDeleteBoardCard';
|
||||||
|
|
||||||
|
export function useActionBarEntries() {
|
||||||
|
const setActionBarEntries = useSetRecoilState(actionBarEntriesState);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setActionBarEntries([<BoardActionBarButtonDeleteBoardCard key="delete" />]);
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { useRecoilCallback, useRecoilState } from 'recoil';
|
import { useRecoilCallback, useRecoilState, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { actionBarOpenState } from '@/ui/action-bar/states/ActionBarIsOpenState';
|
||||||
|
|
||||||
import { BoardCardIdContext } from '../contexts/BoardCardIdContext';
|
import { BoardCardIdContext } from '../contexts/BoardCardIdContext';
|
||||||
import { isCardSelectedFamilyState } from '../states/isCardSelectedFamilyState';
|
import { isCardSelectedFamilyState } from '../states/isCardSelectedFamilyState';
|
||||||
@ -10,6 +12,7 @@ export function useCurrentCardSelected() {
|
|||||||
const [isCardSelected] = useRecoilState(
|
const [isCardSelected] = useRecoilState(
|
||||||
isCardSelectedFamilyState(currentCardId ?? ''),
|
isCardSelectedFamilyState(currentCardId ?? ''),
|
||||||
);
|
);
|
||||||
|
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||||
|
|
||||||
const setCurrentCardSelected = useRecoilCallback(
|
const setCurrentCardSelected = useRecoilCallback(
|
||||||
({ set }) =>
|
({ set }) =>
|
||||||
@ -17,6 +20,7 @@ export function useCurrentCardSelected() {
|
|||||||
if (!currentCardId) return;
|
if (!currentCardId) return;
|
||||||
|
|
||||||
set(isCardSelectedFamilyState(currentCardId), selected);
|
set(isCardSelectedFamilyState(currentCardId), selected);
|
||||||
|
setActionBarOpenState(true);
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { actionBarOpenState } from '@/ui/action-bar/states/ActionBarIsOpenState';
|
||||||
|
|
||||||
import { isCardSelectedFamilyState } from '../states/isCardSelectedFamilyState';
|
import { isCardSelectedFamilyState } from '../states/isCardSelectedFamilyState';
|
||||||
|
|
||||||
export function useSetCardSelected() {
|
export function useSetCardSelected() {
|
||||||
|
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||||
|
|
||||||
return useRecoilCallback(({ set }) => (cardId: string, selected: boolean) => {
|
return useRecoilCallback(({ set }) => (cardId: string, selected: boolean) => {
|
||||||
set(isCardSelectedFamilyState(cardId), selected);
|
set(isCardSelectedFamilyState(cardId), selected);
|
||||||
|
setActionBarOpenState(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
64
front/src/modules/ui/context-menu/components/ContextMenu.tsx
Normal file
64
front/src/modules/ui/context-menu/components/ContextMenu.tsx
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import React, { useRef } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { actionBarOpenState } from '@/ui/action-bar/states/ActionBarIsOpenState';
|
||||||
|
import { contextMenuPositionState } from '@/ui/context-menu/states/ContextMenuPositionState';
|
||||||
|
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||||
|
|
||||||
|
import { contextMenuEntriesState } from '../states/ContextMenuEntriesState';
|
||||||
|
import { contextMenuOpenState } from '../states/ContextMenuIsOpenState';
|
||||||
|
import { PositionType } from '../types/PositionType';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
selectedIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
type StyledContainerProps = {
|
||||||
|
position: PositionType;
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledContainerContextMenu = styled.div<StyledContainerProps>`
|
||||||
|
align-items: flex-start;
|
||||||
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
|
border: 1px solid ${({ theme }) => theme.border.color.light};
|
||||||
|
border-radius: ${({ theme }) => theme.border.radius.md};
|
||||||
|
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1px;
|
||||||
|
|
||||||
|
left: ${(props) => `${props.position.x}px`};
|
||||||
|
position: fixed;
|
||||||
|
top: ${(props) => `${props.position.y}px`};
|
||||||
|
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 160px;
|
||||||
|
z-index: 1;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function ContextMenu({ selectedIds }: OwnProps) {
|
||||||
|
const position = useRecoilValue(contextMenuPositionState);
|
||||||
|
const contextMenuOpen = useRecoilValue(contextMenuOpenState);
|
||||||
|
const contextMenuEntries = useRecoilValue(contextMenuEntriesState);
|
||||||
|
const setContextMenuOpenState = useSetRecoilState(contextMenuOpenState);
|
||||||
|
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||||
|
const wrapperRef = useRef(null);
|
||||||
|
|
||||||
|
useListenClickOutside({
|
||||||
|
refs: [wrapperRef],
|
||||||
|
callback: () => {
|
||||||
|
setContextMenuOpenState(false);
|
||||||
|
setActionBarOpenState(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedIds.length === 0 || !contextMenuOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<StyledContainerContextMenu ref={wrapperRef} position={position}>
|
||||||
|
{contextMenuEntries}
|
||||||
|
</StyledContainerContextMenu>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
icon: ReactNode;
|
||||||
|
label: string;
|
||||||
|
type?: 'standard' | 'danger';
|
||||||
|
onClick: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
type StyledButtonProps = {
|
||||||
|
type: 'standard' | 'danger';
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledButton = styled.div<StyledButtonProps>`
|
||||||
|
align-items: center;
|
||||||
|
align-self: stretch;
|
||||||
|
border-radius: ${({ theme }) => theme.border.radius.sm};
|
||||||
|
color: ${(props) =>
|
||||||
|
props.type === 'danger'
|
||||||
|
? props.theme.color.red
|
||||||
|
: props.theme.font.color.secondary};
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
gap: ${({ theme }) => theme.spacing(2)};
|
||||||
|
|
||||||
|
height: 32px;
|
||||||
|
padding-left: ${({ theme }) => theme.spacing(1)};
|
||||||
|
padding-right: ${({ theme }) => theme.spacing(1)};
|
||||||
|
transition: background 0.1s ease;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: ${({ theme, type }) =>
|
||||||
|
type === 'danger' ? theme.tag.background.red : theme.background.tertiary};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledButtonLabel = styled.div`
|
||||||
|
font-weight: ${({ theme }) => theme.font.weight.medium};
|
||||||
|
margin-left: ${({ theme }) => theme.spacing(2)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function ContextMenuEntry({
|
||||||
|
label,
|
||||||
|
icon,
|
||||||
|
type = 'standard',
|
||||||
|
onClick,
|
||||||
|
}: OwnProps) {
|
||||||
|
return (
|
||||||
|
<StyledButton type={type} onClick={onClick}>
|
||||||
|
{icon}
|
||||||
|
<StyledButtonLabel>{label}</StyledButtonLabel>
|
||||||
|
</StyledButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useContextMenuEntries } from '@/companies/hooks/useContextMenuEntries';
|
||||||
|
import { CompanyTableMockMode } from '@/companies/table/components/CompanyTableMockMode';
|
||||||
|
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||||
|
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||||
|
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||||
|
|
||||||
|
import { contextMenuOpenState } from '../../states/ContextMenuIsOpenState';
|
||||||
|
import { contextMenuPositionState } from '../../states/ContextMenuPositionState';
|
||||||
|
import { ContextMenu } from '../ContextMenu';
|
||||||
|
|
||||||
|
function FilledContextMenu(props: { selectedIds: string[] }) {
|
||||||
|
const setContextMenu = useContextMenuEntries();
|
||||||
|
setContextMenu();
|
||||||
|
const setContextMenuPosition = useSetRecoilState(contextMenuPositionState);
|
||||||
|
setContextMenuPosition({
|
||||||
|
x: 100,
|
||||||
|
y: 10,
|
||||||
|
});
|
||||||
|
const setContextMenuOpenState = useSetRecoilState(contextMenuOpenState);
|
||||||
|
setContextMenuOpenState(true);
|
||||||
|
return <ContextMenu selectedIds={props.selectedIds} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta: Meta<typeof ContextMenu> = {
|
||||||
|
title: 'UI/ContextMenu/ContextMenu',
|
||||||
|
component: FilledContextMenu,
|
||||||
|
decorators: [
|
||||||
|
(Story) => (
|
||||||
|
<RecoilScope SpecificContext={TableRecoilScopeContext}>
|
||||||
|
<CompanyTableMockMode></CompanyTableMockMode>
|
||||||
|
<MemoryRouter>
|
||||||
|
<Story />
|
||||||
|
</MemoryRouter>
|
||||||
|
</RecoilScope>
|
||||||
|
),
|
||||||
|
ComponentDecorator,
|
||||||
|
],
|
||||||
|
args: { selectedIds: ['TestId'] },
|
||||||
|
};
|
||||||
|
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof ContextMenu>;
|
||||||
|
|
||||||
|
export const Default: Story = {};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { ReactElement } from 'react';
|
||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const contextMenuEntriesState = atom<ReactElement[]>({
|
||||||
|
key: 'contextMenuEntriesState',
|
||||||
|
default: [],
|
||||||
|
});
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const contextMenuOpenState = atom<boolean>({
|
||||||
|
key: 'contextMenuOpenState',
|
||||||
|
default: false,
|
||||||
|
});
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { atom } from 'recoil';
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
import { PositionType } from '@/ui/action-bar/types/PositionType';
|
import { PositionType } from '@/ui/context-menu/types/PositionType';
|
||||||
|
|
||||||
export const contextMenuPositionState = atom<PositionType>({
|
export const contextMenuPositionState = atom<PositionType>({
|
||||||
key: 'contextMenuPositionState',
|
key: 'contextMenuPositionState',
|
||||||
@ -5,12 +5,8 @@ import { ActionBar } from '@/ui/action-bar/components/ActionBar';
|
|||||||
|
|
||||||
import { selectedRowIdsSelector } from '../../states/selectors/selectedRowIdsSelector';
|
import { selectedRowIdsSelector } from '../../states/selectors/selectedRowIdsSelector';
|
||||||
|
|
||||||
type OwnProps = {
|
export function EntityTableActionBar() {
|
||||||
children: React.ReactNode | React.ReactNode[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export function EntityTableActionBar({ children }: OwnProps) {
|
|
||||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||||
|
|
||||||
return <ActionBar selectedIds={selectedRowIds}>{children}</ActionBar>;
|
return <ActionBar selectedIds={selectedRowIds}></ActionBar>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
import { IconNotes } from '@/ui/icon/index';
|
|
||||||
|
|
||||||
import { EntityTableActionBarButton } from './EntityTableActionBarButton';
|
|
||||||
|
|
||||||
type OwnProps = {
|
|
||||||
onClick: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function TableActionBarButtonToggleComments({ onClick }: OwnProps) {
|
|
||||||
return (
|
|
||||||
<EntityTableActionBarButton
|
|
||||||
label="Note"
|
|
||||||
icon={<IconNotes size={16} />}
|
|
||||||
onClick={onClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
import { IconCheckbox } from '@/ui/icon/index';
|
|
||||||
|
|
||||||
import { EntityTableActionBarButton } from './EntityTableActionBarButton';
|
|
||||||
|
|
||||||
type OwnProps = {
|
|
||||||
onClick: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function TableActionBarButtonToggleTasks({ onClick }: OwnProps) {
|
|
||||||
return (
|
|
||||||
<EntityTableActionBarButton
|
|
||||||
label="Task"
|
|
||||||
icon={<IconCheckbox size={16} />}
|
|
||||||
onClick={onClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -2,10 +2,10 @@ import { useCallback } from 'react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { actionBarOpenState } from '@/ui/action-bar/states/ActionBarIsOpenState';
|
||||||
import { Checkbox } from '@/ui/input/checkbox/components/Checkbox';
|
import { Checkbox } from '@/ui/input/checkbox/components/Checkbox';
|
||||||
|
|
||||||
import { useCurrentRowSelected } from '../hooks/useCurrentRowSelected';
|
import { useCurrentRowSelected } from '../hooks/useCurrentRowSelected';
|
||||||
import { contextMenuPositionState } from '../states/contextMenuPositionState';
|
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -18,14 +18,13 @@ const StyledContainer = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export function CheckboxCell() {
|
export function CheckboxCell() {
|
||||||
const setContextMenuPosition = useSetRecoilState(contextMenuPositionState);
|
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||||
|
|
||||||
const { currentRowSelected, setCurrentRowSelected } = useCurrentRowSelected();
|
const { currentRowSelected, setCurrentRowSelected } = useCurrentRowSelected();
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
setCurrentRowSelected(!currentRowSelected);
|
setCurrentRowSelected(!currentRowSelected);
|
||||||
setContextMenuPosition({ x: null, y: null });
|
setActionBarOpenState(true);
|
||||||
}, [currentRowSelected, setContextMenuPosition, setCurrentRowSelected]);
|
}, [currentRowSelected, setActionBarOpenState, setCurrentRowSelected]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer onClick={handleClick}>
|
<StyledContainer onClick={handleClick}>
|
||||||
|
|||||||
@ -1,28 +1,29 @@
|
|||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { contextMenuOpenState } from '@/ui/context-menu/states/ContextMenuIsOpenState';
|
||||||
|
import { contextMenuPositionState } from '@/ui/context-menu/states/ContextMenuPositionState';
|
||||||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||||
|
|
||||||
import { ColumnIndexContext } from '../contexts/ColumnIndexContext';
|
import { ColumnIndexContext } from '../contexts/ColumnIndexContext';
|
||||||
import { ViewFieldContext } from '../contexts/ViewFieldContext';
|
import { ViewFieldContext } from '../contexts/ViewFieldContext';
|
||||||
import { GenericEditableCell } from '../editable-cell/components/GenericEditableCell';
|
import { GenericEditableCell } from '../editable-cell/components/GenericEditableCell';
|
||||||
import { useCurrentRowSelected } from '../hooks/useCurrentRowSelected';
|
import { useCurrentRowSelected } from '../hooks/useCurrentRowSelected';
|
||||||
import { contextMenuPositionState } from '../states/contextMenuPositionState';
|
|
||||||
|
|
||||||
export function EntityTableCell({ cellIndex }: { cellIndex: number }) {
|
export function EntityTableCell({ cellIndex }: { cellIndex: number }) {
|
||||||
const setContextMenuPosition = useSetRecoilState(contextMenuPositionState);
|
const setContextMenuPosition = useSetRecoilState(contextMenuPositionState);
|
||||||
|
const setContextMenuOpenState = useSetRecoilState(contextMenuOpenState);
|
||||||
|
|
||||||
const { setCurrentRowSelected } = useCurrentRowSelected();
|
const { setCurrentRowSelected } = useCurrentRowSelected();
|
||||||
|
|
||||||
function handleContextMenu(event: React.MouseEvent) {
|
function handleContextMenu(event: React.MouseEvent) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
setCurrentRowSelected(true);
|
setCurrentRowSelected(true);
|
||||||
|
|
||||||
setContextMenuPosition({
|
setContextMenuPosition({
|
||||||
x: event.clientX,
|
x: event.clientX,
|
||||||
y: event.clientY,
|
y: event.clientY,
|
||||||
});
|
});
|
||||||
|
setContextMenuOpenState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const viewField = useContext(ViewFieldContext);
|
const viewField = useContext(ViewFieldContext);
|
||||||
|
|||||||
@ -8,12 +8,16 @@ export function GenericEntityTableData({
|
|||||||
orderBy = defaultOrderBy,
|
orderBy = defaultOrderBy,
|
||||||
whereFilters,
|
whereFilters,
|
||||||
filterDefinitionArray,
|
filterDefinitionArray,
|
||||||
|
setActionBar,
|
||||||
|
setContextMenu,
|
||||||
}: {
|
}: {
|
||||||
useGetRequest: any;
|
useGetRequest: any;
|
||||||
getRequestResultKey: string;
|
getRequestResultKey: string;
|
||||||
orderBy?: any;
|
orderBy?: any;
|
||||||
whereFilters?: any;
|
whereFilters?: any;
|
||||||
filterDefinitionArray: FilterDefinition[];
|
filterDefinitionArray: FilterDefinition[];
|
||||||
|
setActionBar?: () => void;
|
||||||
|
setContextMenu?: () => void;
|
||||||
}) {
|
}) {
|
||||||
const setEntityTableData = useSetEntityTableData();
|
const setEntityTableData = useSetEntityTableData();
|
||||||
useGetRequest({
|
useGetRequest({
|
||||||
@ -24,5 +28,11 @@ export function GenericEntityTableData({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (setActionBar) {
|
||||||
|
setActionBar();
|
||||||
|
}
|
||||||
|
if (setContextMenu) {
|
||||||
|
setContextMenu();
|
||||||
|
}
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
|
import { ContextMenu } from '@/ui/context-menu/components/ContextMenu';
|
||||||
|
|
||||||
|
import { selectedRowIdsSelector } from '../../states/selectors/selectedRowIdsSelector';
|
||||||
|
|
||||||
|
export function EntityTableContextMenu() {
|
||||||
|
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||||
|
return <ContextMenu selectedIds={selectedRowIds}></ContextMenu>;
|
||||||
|
}
|
||||||
@ -4,12 +4,11 @@ import styled from '@emotion/styled';
|
|||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
import { CompanyTable } from '@/companies/table/components/CompanyTable';
|
import { CompanyTable } from '@/companies/table/components/CompanyTable';
|
||||||
import { TableActionBarButtonCreateActivityCompany } from '@/companies/table/components/TableActionBarButtonCreateActivityCompany';
|
|
||||||
import { TableActionBarButtonDeleteCompanies } from '@/companies/table/components/TableActionBarButtonDeleteCompanies';
|
|
||||||
import { SEARCH_COMPANY_QUERY } from '@/search/queries/search';
|
import { SEARCH_COMPANY_QUERY } from '@/search/queries/search';
|
||||||
import { IconBuildingSkyscraper } from '@/ui/icon';
|
import { IconBuildingSkyscraper } from '@/ui/icon';
|
||||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||||
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
||||||
|
import { EntityTableContextMenu } from '@/ui/table/context-menu/components/EntityTableContextMenu';
|
||||||
import { useUpsertEntityTableItem } from '@/ui/table/hooks/useUpsertEntityTableItem';
|
import { useUpsertEntityTableItem } from '@/ui/table/hooks/useUpsertEntityTableItem';
|
||||||
import { useUpsertTableRowId } from '@/ui/table/hooks/useUpsertTableRowId';
|
import { useUpsertTableRowId } from '@/ui/table/hooks/useUpsertTableRowId';
|
||||||
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||||
@ -73,10 +72,8 @@ export function Companies() {
|
|||||||
<StyledTableContainer>
|
<StyledTableContainer>
|
||||||
<CompanyTable />
|
<CompanyTable />
|
||||||
</StyledTableContainer>
|
</StyledTableContainer>
|
||||||
<EntityTableActionBar>
|
<EntityTableActionBar></EntityTableActionBar>
|
||||||
<TableActionBarButtonCreateActivityCompany />
|
<EntityTableContextMenu></EntityTableContextMenu>
|
||||||
<TableActionBarButtonDeleteCompanies />
|
|
||||||
</EntityTableActionBar>
|
|
||||||
</RecoilScope>
|
</RecoilScope>
|
||||||
</WithTopBarContainer>
|
</WithTopBarContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,8 +2,6 @@ import { useTheme } from '@emotion/react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { CompanyTableMockMode } from '@/companies/table/components/CompanyTableMockMode';
|
import { CompanyTableMockMode } from '@/companies/table/components/CompanyTableMockMode';
|
||||||
import { TableActionBarButtonCreateActivityCompany } from '@/companies/table/components/TableActionBarButtonCreateActivityCompany';
|
|
||||||
import { TableActionBarButtonDeleteCompanies } from '@/companies/table/components/TableActionBarButtonDeleteCompanies';
|
|
||||||
import { IconBuildingSkyscraper } from '@/ui/icon';
|
import { IconBuildingSkyscraper } from '@/ui/icon';
|
||||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||||
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
||||||
@ -28,10 +26,7 @@ export function CompaniesMockMode() {
|
|||||||
<StyledTableContainer>
|
<StyledTableContainer>
|
||||||
<CompanyTableMockMode />
|
<CompanyTableMockMode />
|
||||||
</StyledTableContainer>
|
</StyledTableContainer>
|
||||||
<EntityTableActionBar>
|
<EntityTableActionBar></EntityTableActionBar>
|
||||||
<TableActionBarButtonCreateActivityCompany />
|
|
||||||
<TableActionBarButtonDeleteCompanies />
|
|
||||||
</EntityTableActionBar>
|
|
||||||
</RecoilScope>
|
</RecoilScope>
|
||||||
</WithTopBarContainer>
|
</WithTopBarContainer>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import {
|
|||||||
defaultPipelineProgressOrderBy,
|
defaultPipelineProgressOrderBy,
|
||||||
PipelineProgressesSelectedSortType,
|
PipelineProgressesSelectedSortType,
|
||||||
} from '@/pipeline/queries';
|
} from '@/pipeline/queries';
|
||||||
import { BoardActionBarButtonDeleteBoardCard } from '@/ui/board/components/BoardActionBarButtonDeleteBoardCard';
|
|
||||||
import { EntityBoard } from '@/ui/board/components/EntityBoard';
|
import { EntityBoard } from '@/ui/board/components/EntityBoard';
|
||||||
import { EntityBoardActionBar } from '@/ui/board/components/EntityBoardActionBar';
|
import { EntityBoardActionBar } from '@/ui/board/components/EntityBoardActionBar';
|
||||||
import { BoardOptionsContext } from '@/ui/board/contexts/BoardOptionsContext';
|
import { BoardOptionsContext } from '@/ui/board/contexts/BoardOptionsContext';
|
||||||
|
import { useActionBarEntries } from '@/ui/board/hooks/useActionBarEntries';
|
||||||
import { reduceSortsToOrderBy } from '@/ui/filter-n-sort/helpers';
|
import { reduceSortsToOrderBy } from '@/ui/filter-n-sort/helpers';
|
||||||
import { IconTargetArrow } from '@/ui/icon/index';
|
import { IconTargetArrow } from '@/ui/icon/index';
|
||||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||||
@ -63,6 +63,8 @@ export function Opportunities() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setActionBar = useActionBarEntries();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithTopBarContainer
|
<WithTopBarContainer
|
||||||
title="Opportunities"
|
title="Opportunities"
|
||||||
@ -70,15 +72,13 @@ export function Opportunities() {
|
|||||||
>
|
>
|
||||||
<BoardOptionsContext.Provider value={opportunitiesBoardOptions}>
|
<BoardOptionsContext.Provider value={opportunitiesBoardOptions}>
|
||||||
<RecoilScope SpecificContext={CompanyBoardRecoilScopeContext}>
|
<RecoilScope SpecificContext={CompanyBoardRecoilScopeContext}>
|
||||||
<HooksCompanyBoard orderBy={orderBy} />
|
<HooksCompanyBoard orderBy={orderBy} setActionBar={setActionBar} />
|
||||||
<EntityBoard
|
<EntityBoard
|
||||||
boardOptions={opportunitiesBoardOptions}
|
boardOptions={opportunitiesBoardOptions}
|
||||||
updateSorts={updateSorts}
|
updateSorts={updateSorts}
|
||||||
onEditColumnTitle={handleEditColumnTitle}
|
onEditColumnTitle={handleEditColumnTitle}
|
||||||
/>
|
/>
|
||||||
<EntityBoardActionBar>
|
<EntityBoardActionBar></EntityBoardActionBar>
|
||||||
<BoardActionBarButtonDeleteBoardCard />
|
|
||||||
</EntityBoardActionBar>
|
|
||||||
</RecoilScope>
|
</RecoilScope>
|
||||||
</BoardOptionsContext.Provider>
|
</BoardOptionsContext.Provider>
|
||||||
</WithTopBarContainer>
|
</WithTopBarContainer>
|
||||||
|
|||||||
@ -3,11 +3,10 @@ import styled from '@emotion/styled';
|
|||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
import { PeopleTable } from '@/people/table/components/PeopleTable';
|
import { PeopleTable } from '@/people/table/components/PeopleTable';
|
||||||
import { TableActionBarButtonCreateActivityPeople } from '@/people/table/components/TableActionBarButtonCreateActivityPeople';
|
|
||||||
import { TableActionBarButtonDeletePeople } from '@/people/table/components/TableActionBarButtonDeletePeople';
|
|
||||||
import { IconUser } from '@/ui/icon';
|
import { IconUser } from '@/ui/icon';
|
||||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||||
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
||||||
|
import { EntityTableContextMenu } from '@/ui/table/context-menu/components/EntityTableContextMenu';
|
||||||
import { useUpsertEntityTableItem } from '@/ui/table/hooks/useUpsertEntityTableItem';
|
import { useUpsertEntityTableItem } from '@/ui/table/hooks/useUpsertEntityTableItem';
|
||||||
import { useUpsertTableRowId } from '@/ui/table/hooks/useUpsertTableRowId';
|
import { useUpsertTableRowId } from '@/ui/table/hooks/useUpsertTableRowId';
|
||||||
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
import { TableRecoilScopeContext } from '@/ui/table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||||
@ -66,10 +65,8 @@ export function People() {
|
|||||||
<StyledTableContainer>
|
<StyledTableContainer>
|
||||||
<PeopleTable />
|
<PeopleTable />
|
||||||
</StyledTableContainer>
|
</StyledTableContainer>
|
||||||
<EntityTableActionBar>
|
<EntityTableActionBar />
|
||||||
<TableActionBarButtonCreateActivityPeople />
|
<EntityTableContextMenu />
|
||||||
<TableActionBarButtonDeletePeople />
|
|
||||||
</EntityTableActionBar>
|
|
||||||
</WithTopBarContainer>
|
</WithTopBarContainer>
|
||||||
</RecoilScope>
|
</RecoilScope>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user