// ───────────────────────────────────────────────────────────────────────────── // features/assistant/data/mock.ts // // All mock data for the Assistant feature lives here. // To connect to a real AI backend, replace fetchAssistantConfig with an actual // HTTP call — the hook and component contract stays identical. // ───────────────────────────────────────────────────────────────────────────── import i18n from '../../../i18n'; // ── Types ───────────────────────────────────────────────────────────────────── export interface AssistantSuggestion { id: string; text: string; } export interface AssistantConfig { suggestions: AssistantSuggestion[]; richSuggestions: AssistantSuggestion[]; feedbackOptions: string[]; } // ── Mock API function ───────────────────────────────────────────────────────── export async function fetchAssistantConfig(): Promise { // Replace with: return fetch('/api/assistant/config').then(r => r.json()); await new Promise(resolve => setTimeout(resolve, 150)); const t = (key: string) => i18n.t(key); return { suggestions: [ { id: '1', text: t('assistant.suggestions.whatCanIAsk') }, { id: '2', text: t('assistant.suggestions.whatDoYouDo') }, { id: '3', text: t('assistant.suggestions.whichProjects') }, { id: '4', text: t('assistant.suggestions.nextProject') }, ], richSuggestions: [ { id: 'rich-1', text: t('assistant.richSuggestions.viewPerformance') }, { id: 'rich-2', text: t('assistant.richSuggestions.generateReport') }, { id: 'rich-3', text: t('assistant.richSuggestions.createDocument') }, { id: 'rich-4', text: t('assistant.richSuggestions.generatePodcast') }, ], feedbackOptions: [ t('assistant.feedback.notWhatIWanted'), t('assistant.feedback.incorrectInfo'), t('assistant.feedback.incompleteAnswer'), ], }; } // ── Static fallback factories ───────────────────────────────────────────────── // Used as fallbacks while useAssistantConfig() is loading. // These are FUNCTIONS (not constants) so i18n.t() is called at invocation time, // ensuring they always return strings in the currently active language. // Using a frozen `const` array here would evaluate i18n.t() once at module load // time and permanently freeze the strings in the initial language. export function getMockRichSuggestions(): AssistantSuggestion[] { return [ { id: 'rich-1', text: i18n.t('assistant.richSuggestions.viewPerformance') }, { id: 'rich-2', text: i18n.t('assistant.richSuggestions.generateReport') }, { id: 'rich-3', text: i18n.t('assistant.richSuggestions.createDocument') }, { id: 'rich-4', text: i18n.t('assistant.richSuggestions.generatePodcast') }, ]; } export function getMockFeedbackOptions(): string[] { return [ i18n.t('assistant.feedback.notWhatIWanted'), i18n.t('assistant.feedback.incorrectInfo'), i18n.t('assistant.feedback.incompleteAnswer'), ]; }