feat(documents): admin-configurable Expired tab visibility
New documents_show_expired_tab system setting (default true). Public read via GET /api/v1/documents/feature-flags (gated on documents.view so reps can read it without holding manage_settings). When off, the Expired tab is hidden from the documents hub — useful when expired EOIs are noise that distracts reps from active deals. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -210,6 +210,14 @@ const KNOWN_SETTINGS: Array<{
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
},
|
||||
{
|
||||
key: 'documents_show_expired_tab',
|
||||
label: 'Documents — show Expired tab',
|
||||
description:
|
||||
'When off, the Expired tab on the documents hub is hidden. Use this when expired EOIs are noise that distracts reps from active deals.',
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
},
|
||||
];
|
||||
|
||||
export function SettingsManager() {
|
||||
|
||||
@@ -119,6 +119,13 @@ export function DocumentsHub({ portSlug, initialTab = 'all' }: DocumentsHubProps
|
||||
staleTime: 30_000,
|
||||
});
|
||||
|
||||
const { data: flagsResp } = useQuery<{ data: { showExpiredTab: boolean } }>({
|
||||
queryKey: ['documents', 'feature-flags'],
|
||||
queryFn: () => apiFetch('/api/v1/documents/feature-flags'),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
const showExpiredTab = flagsResp?.data.showExpiredTab ?? true;
|
||||
|
||||
useRealtimeInvalidation({
|
||||
'document:created': [['documents']],
|
||||
'document:updated': [['documents']],
|
||||
@@ -275,7 +282,7 @@ export function DocumentsHub({ portSlug, initialTab = 'all' }: DocumentsHubProps
|
||||
}}
|
||||
>
|
||||
<TabsList>
|
||||
{documentsHubTabs.map((t) => (
|
||||
{documentsHubTabs.filter((t) => t !== 'expired' || showExpiredTab).map((t) => (
|
||||
<TabsTrigger key={t} value={t}>
|
||||
{TAB_LABELS[t]}
|
||||
{t !== 'all' && counts[t] > 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user