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
This commit is contained in:
parent
06ce9dac1b
commit
ce590ccae8
@ -40,6 +40,8 @@ import {
|
|||||||
ThunderboltOutlined,
|
ThunderboltOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
FileMarkdownOutlined,
|
FileMarkdownOutlined,
|
||||||
|
ContactsOutlined,
|
||||||
|
ScissorOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useCommandPaletteStore } from '@/stores/command-palette.store';
|
import { useCommandPaletteStore } from '@/stores/command-palette.store';
|
||||||
import { useAuthStore } from '@/stores/auth.store';
|
import { useAuthStore } from '@/stores/auth.store';
|
||||||
@ -88,6 +90,8 @@ const ICON_MAP: Record<string, React.ReactNode> = {
|
|||||||
TagOutlined: <TagOutlined />,
|
TagOutlined: <TagOutlined />,
|
||||||
FileMarkdownOutlined: <FileMarkdownOutlined />,
|
FileMarkdownOutlined: <FileMarkdownOutlined />,
|
||||||
UserOutlined: <UserOutlined />,
|
UserOutlined: <UserOutlined />,
|
||||||
|
ContactsOutlined: <ContactsOutlined />,
|
||||||
|
ScissorOutlined: <ScissorOutlined />,
|
||||||
};
|
};
|
||||||
|
|
||||||
const CATEGORY_LABELS: Record<CommandCategory, string> = {
|
const CATEGORY_LABELS: Record<CommandCategory, string> = {
|
||||||
@ -229,9 +233,8 @@ export default function CommandPalette() {
|
|||||||
[flatList, selectedIndex, handleSelect],
|
[flatList, selectedIndex, handleSelect],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!shouldRender) return null;
|
|
||||||
|
|
||||||
// Group commands by category for display
|
// Group commands by category for display
|
||||||
|
// NOTE: These hooks must stay above the early return to satisfy Rules of Hooks
|
||||||
const groupedCommands = useMemo(() => {
|
const groupedCommands = useMemo(() => {
|
||||||
const items = query ? commandResults : recentCommandItems;
|
const items = query ? commandResults : recentCommandItems;
|
||||||
const groups = new Map<string, CommandItem[]>();
|
const groups = new Map<string, CommandItem[]>();
|
||||||
@ -253,6 +256,8 @@ export default function CommandPalette() {
|
|||||||
return groups;
|
return groups;
|
||||||
}, [entityResults]);
|
}, [entityResults]);
|
||||||
|
|
||||||
|
if (!shouldRender) return null;
|
||||||
|
|
||||||
// Get flat index for a given item
|
// Get flat index for a given item
|
||||||
let flatIndex = 0;
|
let flatIndex = 0;
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,41 @@ export const commandRegistry: CommandItem[] = [
|
|||||||
requiredRoles: ['SUPER_ADMIN'],
|
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 ──────────────────────────────
|
// ── Navigation: Advocacy ──────────────────────────────
|
||||||
{
|
{
|
||||||
id: 'nav-campaigns',
|
id: 'nav-campaigns',
|
||||||
@ -366,6 +401,17 @@ export const commandRegistry: CommandItem[] = [
|
|||||||
featureFlag: 'enablePayments',
|
featureFlag: 'enablePayments',
|
||||||
requiredRoles: ['SUPER_ADMIN'],
|
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',
|
id: 'nav-media-jobs',
|
||||||
title: 'Processing Jobs',
|
title: 'Processing Jobs',
|
||||||
@ -557,6 +603,17 @@ export const commandRegistry: CommandItem[] = [
|
|||||||
category: 'navigation',
|
category: 'navigation',
|
||||||
requiredRoles: ['SUPER_ADMIN'],
|
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',
|
id: 'nav-qr-codes',
|
||||||
title: 'QR Codes',
|
title: 'QR Codes',
|
||||||
|
|||||||
@ -28,8 +28,9 @@ export function useCommandIndex() {
|
|||||||
if (!flag) return true;
|
if (!flag) return true;
|
||||||
if (!settings) return true; // show all when settings haven't loaded
|
if (!settings) return true; // show all when settings haven't loaded
|
||||||
const value = (settings as unknown as Record<string, unknown>)[flag];
|
const value = (settings as unknown as Record<string, unknown>)[flag];
|
||||||
// enablePayments, enableSms, and enablePeople default off, others default on
|
// Flags that default to false — only show when explicitly enabled
|
||||||
if (flag === 'enablePayments' || flag === 'enableSms' || flag === 'enablePeople') return value === true;
|
const defaultsOff = ['enablePayments', 'enableSms', 'enablePeople', 'enableSocial', 'enableChat', 'enableMeet'];
|
||||||
|
if (defaultsOff.includes(flag)) return value === true;
|
||||||
return value !== false;
|
return value !== false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,8 @@ export function useEntitySearch(query: string) {
|
|||||||
const activeConfigs = entityConfigs.filter((cfg) => {
|
const activeConfigs = entityConfigs.filter((cfg) => {
|
||||||
if (cfg.featureFlag && settings) {
|
if (cfg.featureFlag && settings) {
|
||||||
const val = (settings as unknown as Record<string, unknown>)[cfg.featureFlag];
|
const val = (settings as unknown as Record<string, unknown>)[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;
|
if (val !== true) return false;
|
||||||
} else if (val === false) return false;
|
} else if (val === false) return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user