frontend_nyla/src/core/PageManager/pageInterface.ts
2026-04-13 09:54:11 +02:00

44 lines
1.2 KiB
TypeScript

/**
* PageManager page interface and helpers.
* Used by PageData definitions and SidebarProvider.
*/
import type React from 'react';
export interface GenericPageData {
id: string;
path: string;
name: string;
description?: string;
parentPath?: string;
icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
title?: string;
subtitle?: string;
headerButtons?: Array<Record<string, unknown>>;
content?: Array<Record<string, unknown>>;
moduleEnabled?: boolean;
order?: number;
hide?: boolean;
showInSidebar?: boolean;
showInSidebarIf?: boolean;
hasSubpages?: boolean;
privilegeChecker?: () => Promise<boolean> | boolean;
persistent?: boolean;
preload?: boolean;
preserveState?: boolean;
onActivate?: () => void | Promise<void>;
onLoad?: () => void | Promise<void>;
onUnload?: () => void | Promise<void>;
}
type TranslationFunction = (key: string, params?: Record<string, string | number | boolean | null | undefined>) => string;
/**
* Resolve display text from a page name (i18n key) via the translation function.
*/
export function resolveLanguageText(
name: string,
t: TranslationFunction
): string {
return t(name);
}