Skip to content

Commit

Permalink
Remove dead code linked to quick actions (twentyhq#6587)
Browse files Browse the repository at this point in the history
Removing dead code, we'll take another approach to build this
  • Loading branch information
FelixMalfait authored Aug 9, 2024
1 parent a2a5ab4 commit 7e01843
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 655 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { isNonEmptyString } from '@sniptt/guards';
import { useCallback, useMemo, useState } from 'react';
import { useRecoilCallback, useSetRecoilState } from 'recoil';
import {
IconClick,
IconFileExport,
IconHeart,
IconHeartOff,
IconMail,
IconPuzzle,
IconTrash,
} from 'twenty-ui';
import { IconFileExport, IconHeart, IconHeartOff, IconTrash } from 'twenty-ui';

import { useFavorites } from '@/favorites/hooks/useFavorites';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { DELETE_MAX_COUNT } from '@/object-record/constants/DeleteMaxCount';
import { useExecuteQuickActionOnOneRecord } from '@/object-record/hooks/useExecuteQuickActionOnOneRecord';
import { useDeleteTableData } from '@/object-record/record-index/options/hooks/useDeleteTableData';
import {
displayedExportProgress,
Expand All @@ -25,7 +16,6 @@ import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModa
import { actionBarEntriesState } from '@/ui/navigation/action-bar/states/actionBarEntriesState';
import { contextMenuEntriesState } from '@/ui/navigation/context-menu/states/contextMenuEntriesState';
import { ContextMenuEntry } from '@/ui/navigation/context-menu/types/ContextMenuEntry';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from '~/utils/isDefined';

type useRecordActionBarProps = {
Expand All @@ -48,10 +38,6 @@ export const useRecordActionBar = ({

const { createFavorite, favorites, deleteFavorite } = useFavorites();

const { executeQuickActionOnOneRecord } = useExecuteQuickActionOnOneRecord({
objectNameSingular: objectMetadataItem.nameSingular,
});

const handleFavoriteButtonClick = useRecoilCallback(
({ snapshot }) =>
() => {
Expand Down Expand Up @@ -99,15 +85,6 @@ export const useRecordActionBar = ({
deleteTableData(selectedRecordIds);
}, [deleteTableData, selectedRecordIds]);

const handleExecuteQuickActionOnClick = useCallback(async () => {
callback?.();
await Promise.all(
selectedRecordIds.map(async (recordId) => {
await executeQuickActionOnOneRecord(recordId);
}),
);
}, [callback, executeQuickActionOnOneRecord, selectedRecordIds]);

const { progress, download } = useExportTableData({
...baseTableDataParams,
filename: `${objectMetadataItem.nameSingular}.csv`,
Expand Down Expand Up @@ -168,10 +145,6 @@ export const useRecordActionBar = ({
],
);

const dataExecuteQuickActionOnmentEnabled = useIsFeatureEnabled(
'IS_QUICK_ACTIONS_ENABLED',
);

const hasOnlyOneRecordSelected = selectedRecordIds.length === 1;

const isFavorite =
Expand Down Expand Up @@ -212,12 +185,13 @@ export const useRecordActionBar = ({

setActionBarEntries: useCallback(() => {
setActionBarEntriesState([
...(dataExecuteQuickActionOnmentEnabled
? [
/*
{
label: 'Actions',
Icon: IconClick,
subActions: [
subActions:
/* [
{
label: 'Enrich',
Icon: IconPuzzle,
Expand All @@ -228,16 +202,9 @@ export const useRecordActionBar = ({
Icon: IconMail,
},
],
},
]
: []),
*/
...menuActions,
]);
}, [
menuActions,
dataExecuteQuickActionOnmentEnabled,
handleExecuteQuickActionOnClick,
setActionBarEntriesState,
]),
}, [menuActions, setActionBarEntriesState]),
};
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export type FeatureFlagKey =
| 'IS_BLOCKLIST_ENABLED'
| 'IS_QUICK_ACTIONS_ENABLED'
| 'IS_EVENT_OBJECT_ENABLED'
| 'IS_AIRTABLE_INTEGRATION_ENABLED'
| 'IS_POSTGRESQL_INTEGRATION_ENABLED'
Expand Down
Loading

0 comments on commit 7e01843

Please sign in to comment.