From ce590ccae80e3bd2c7ca5af18aec2268fa3e09bc Mon Sep 17 00:00:00 2001 From: bunker-admin Date: Fri, 27 Feb 2026 20:11:06 -0700 Subject: [PATCH] Add missing pages to command palette and fix feature flag handling Add Social Dashboard/Graph/Moderation, Jitsi Video Meetings, and Ad Analytics to searchable command registry. Add missing ContactsOutlined and ScissorOutlined icons to ICON_MAP. Update defaults-off feature flag list to include enableSocial, enableChat, and enableMeet. Bunker Admin --- .../command-palette/CommandPalette.tsx | 9 ++- .../components/command-palette/registry.ts | 57 +++++++++++++++++++ .../command-palette/useCommandIndex.ts | 5 +- .../command-palette/useEntitySearch.ts | 3 +- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/admin/src/components/command-palette/CommandPalette.tsx b/admin/src/components/command-palette/CommandPalette.tsx index 361607e..f4465f5 100644 --- a/admin/src/components/command-palette/CommandPalette.tsx +++ b/admin/src/components/command-palette/CommandPalette.tsx @@ -40,6 +40,8 @@ import { ThunderboltOutlined, UserOutlined, FileMarkdownOutlined, + ContactsOutlined, + ScissorOutlined, } from '@ant-design/icons'; import { useCommandPaletteStore } from '@/stores/command-palette.store'; import { useAuthStore } from '@/stores/auth.store'; @@ -88,6 +90,8 @@ const ICON_MAP: Record = { TagOutlined: , FileMarkdownOutlined: , UserOutlined: , + ContactsOutlined: , + ScissorOutlined: , }; const CATEGORY_LABELS: Record = { @@ -229,9 +233,8 @@ export default function CommandPalette() { [flatList, selectedIndex, handleSelect], ); - if (!shouldRender) return null; - // Group commands by category for display + // NOTE: These hooks must stay above the early return to satisfy Rules of Hooks const groupedCommands = useMemo(() => { const items = query ? commandResults : recentCommandItems; const groups = new Map(); @@ -253,6 +256,8 @@ export default function CommandPalette() { return groups; }, [entityResults]); + if (!shouldRender) return null; + // Get flat index for a given item let flatIndex = 0; diff --git a/admin/src/components/command-palette/registry.ts b/admin/src/components/command-palette/registry.ts index 1226910..67c036b 100644 --- a/admin/src/components/command-palette/registry.ts +++ b/admin/src/components/command-palette/registry.ts @@ -49,6 +49,41 @@ export const commandRegistry: CommandItem[] = [ requiredRoles: ['SUPER_ADMIN'], }, + // ── Navigation: Social ─────────────────────────────── + { + id: 'nav-social-dashboard', + title: 'Social Dashboard', + group: 'Social', + path: '/app/social', + icon: 'TeamOutlined', + keywords: ['social', 'community', 'friends', 'connections', 'engagement'], + category: 'navigation', + featureFlag: 'enableSocial', + requiredRoles: ['SUPER_ADMIN', 'INFLUENCE_ADMIN', 'MAP_ADMIN'], + }, + { + id: 'nav-social-graph', + title: 'Social Graph', + group: 'Social', + path: '/app/social/graph', + icon: 'BranchesOutlined', + keywords: ['network', 'connections', 'graph', 'relationships', 'visualization'], + category: 'navigation', + featureFlag: 'enableSocial', + requiredRoles: ['SUPER_ADMIN', 'INFLUENCE_ADMIN', 'MAP_ADMIN'], + }, + { + id: 'nav-social-moderation', + title: 'Social Moderation', + group: 'Social', + path: '/app/social/moderation', + icon: 'MessageOutlined', + keywords: ['moderation', 'reports', 'flagged', 'content review', 'social moderation'], + category: 'navigation', + featureFlag: 'enableSocial', + requiredRoles: ['SUPER_ADMIN', 'INFLUENCE_ADMIN', 'MAP_ADMIN'], + }, + // ── Navigation: Advocacy ────────────────────────────── { id: 'nav-campaigns', @@ -366,6 +401,17 @@ export const commandRegistry: CommandItem[] = [ featureFlag: 'enablePayments', requiredRoles: ['SUPER_ADMIN'], }, + { + id: 'nav-ad-analytics', + title: 'Ad Analytics', + group: 'Payments', + path: '/app/payments/ads/analytics', + icon: 'LineChartOutlined', + keywords: ['ad performance', 'ad metrics', 'banner stats', 'ad dashboard'], + category: 'navigation', + featureFlag: 'enablePayments', + requiredRoles: ['SUPER_ADMIN'], + }, { id: 'nav-media-jobs', title: 'Processing Jobs', @@ -557,6 +603,17 @@ export const commandRegistry: CommandItem[] = [ category: 'navigation', requiredRoles: ['SUPER_ADMIN'], }, + { + id: 'nav-jitsi', + title: 'Video Meetings', + group: 'Services', + path: '/app/services/jitsi', + icon: 'PlaySquareOutlined', + keywords: ['jitsi', 'video call', 'conference', 'meeting', 'webrtc'], + category: 'navigation', + featureFlag: 'enableMeet', + requiredRoles: ['SUPER_ADMIN'], + }, { id: 'nav-qr-codes', title: 'QR Codes', diff --git a/admin/src/components/command-palette/useCommandIndex.ts b/admin/src/components/command-palette/useCommandIndex.ts index 10bb024..2e67c41 100644 --- a/admin/src/components/command-palette/useCommandIndex.ts +++ b/admin/src/components/command-palette/useCommandIndex.ts @@ -28,8 +28,9 @@ export function useCommandIndex() { if (!flag) return true; if (!settings) return true; // show all when settings haven't loaded const value = (settings as unknown as Record)[flag]; - // enablePayments, enableSms, and enablePeople default off, others default on - if (flag === 'enablePayments' || flag === 'enableSms' || flag === 'enablePeople') return value === true; + // Flags that default to false — only show when explicitly enabled + const defaultsOff = ['enablePayments', 'enableSms', 'enablePeople', 'enableSocial', 'enableChat', 'enableMeet']; + if (defaultsOff.includes(flag)) return value === true; return value !== false; }; diff --git a/admin/src/components/command-palette/useEntitySearch.ts b/admin/src/components/command-palette/useEntitySearch.ts index fa572dc..65b575c 100644 --- a/admin/src/components/command-palette/useEntitySearch.ts +++ b/admin/src/components/command-palette/useEntitySearch.ts @@ -158,7 +158,8 @@ export function useEntitySearch(query: string) { const activeConfigs = entityConfigs.filter((cfg) => { if (cfg.featureFlag && settings) { const val = (settings as unknown as Record)[cfg.featureFlag]; - if (cfg.featureFlag === 'enablePayments' || cfg.featureFlag === 'enableSms' || cfg.featureFlag === 'enablePeople') { + const defaultsOff = ['enablePayments', 'enableSms', 'enablePeople', 'enableSocial', 'enableChat', 'enableMeet']; + if (defaultsOff.includes(cfg.featureFlag)) { if (val !== true) return false; } else if (val === false) return false; }