Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

add [frecency-fe] - feature flag off frecency (#854)

Daniel Kweon0b7c13d657a4
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index 0b40cb7d46..ec51ad9ec3 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -24,6 +24,7 @@ import {
fileTypeToBlockName,
} from '@core/constant/allBlocks';
import {
+ ENABLE_FRECENCY,
ENABLE_PROPERTY_DISPLAY_CONTROL,
ENABLE_SOUP_FROM_FILTER,
ENABLE_TASKS_TABS,
@@ -189,11 +190,15 @@ const sortOptions = [
label: 'Created',
sortFn: sortByCreatedAt,
},
- {
- value: 'frecency',
- label: 'Frecency',
- sortFn: sortByFrecencyScore,
- },
+ ...(ENABLE_FRECENCY
+ ? [
+ {
+ value: 'frecency' as const,
+ label: 'Frecency',
+ sortFn: sortByFrecencyScore,
+ },
+ ]
+ : []),
] satisfies SortOption<EntityData, SystemSortOption>[];
export type UnifiedListViewProps = {
diff --git a/js/app/packages/app/component/ViewConfig.tsx b/js/app/packages/app/component/ViewConfig.tsx
index 1cdb55bc06..732b6ae00a 100644
--- a/js/app/packages/app/component/ViewConfig.tsx
+++ b/js/app/packages/app/component/ViewConfig.tsx
@@ -1,4 +1,7 @@
-import { ENABLE_TASKS_TABS } from '@core/constant/featureFlags';
+import {
+ ENABLE_FRECENCY,
+ ENABLE_TASKS_TABS,
+} from '@core/constant/featureFlags';
import {
DEFAULT_VIEWS,
type DefaultView,
@@ -331,7 +334,7 @@ export const VIEWCONFIG_SORT_BY: readonly SystemSortOption[] = [
'updated_at',
'created_at',
'viewed_at',
- 'frecency',
+ ...(ENABLE_FRECENCY ? (['frecency'] as const) : []),
] as const;
export const VIEWCONFIG_SORT_ORDER: readonly SortOptions['sortOrder'][] = [
'ascending',
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 58c9a03f9b..48b1abd07a 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -136,3 +136,5 @@ export const ENABLE_CREATE_TASK = true;
export const ENABLE_TASKS_TABS = true;
export const ENABLE_EMAIL_SHARING = false;
+
+export const ENABLE_FRECENCY = false;
diff --git a/js/app/packages/macro-entity/src/components/Sort.tsx b/js/app/packages/macro-entity/src/components/Sort.tsx
index 2ac19aa901..479e7fd7fd 100644
--- a/js/app/packages/macro-entity/src/components/Sort.tsx
+++ b/js/app/packages/macro-entity/src/components/Sort.tsx
@@ -1,4 +1,7 @@
-import { ENABLE_PROPERTY_DISPLAY_CONTROL } from '@core/constant/featureFlags';
+import {
+ ENABLE_FRECENCY,
+ ENABLE_PROPERTY_DISPLAY_CONTROL,
+} from '@core/constant/featureFlags';
import ClockIcon from '@phosphor-icons/core/assets/regular/clock.svg';
import LightningIcon from '@phosphor-icons/core/assets/regular/lightning.svg';
import MagnifyingGlassIcon from '@phosphor-icons/core/assets/regular/magnifying-glass.svg';
@@ -225,7 +228,15 @@ export const defaultSortOptions: SortOption<WithNotification<EntityData>>[] = [
{ value: 'important', label: 'Important', sortFn: notifiedSortFn },
{ value: 'updatedAt', label: 'Updated', sortFn: sortByUpdatedAt },
{ value: 'viewedAt', label: 'Viewed', sortFn: sortByViewedAt },
- { value: 'frecency', label: 'Frecency', sortFn: sortByFrecencyScore },
+ ...(ENABLE_FRECENCY
+ ? [
+ {
+ value: 'frecency' as const,
+ label: 'Frecency',
+ sortFn: sortByFrecencyScore,
+ },
+ ]
+ : []),
];
type InferSortFn<Options extends SortOption<any, string>[]> =
@@ -434,20 +445,22 @@ export function createSort<
<ClockIcon class="size-3.5" />
Created
</button>
- <button
- type="button"
- onClick={() => props.onSelect('frecency')}
- disabled={props.disabled?.()}
- class={pillClass}
- classList={{
- 'bg-ink text-panel border-ink': isSelected('frecency'),
- 'bg-transparent text-ink border-edge hover:bg-hover':
- !isSelected('frecency'),
- }}
- >
- <LightningIcon class="size-3.5" />
- Frecency
- </button>
+ <Show when={ENABLE_FRECENCY}>
+ <button
+ type="button"
+ onClick={() => props.onSelect('frecency')}
+ disabled={props.disabled?.()}
+ class={pillClass}
+ classList={{
+ 'bg-ink text-panel border-ink': isSelected('frecency'),
+ 'bg-transparent text-ink border-edge hover:bg-hover':
+ !isSelected('frecency'),
+ }}
+ >
+ <LightningIcon class="size-3.5" />
+ Frecency
+ </button>
+ </Show>
</div>
);
};