feat(dashboard): implement transparent setup roadmap and fix translations
- Added SetupChecklist component for clear progress visualization - Refactored LifecycleHero to show readiness state - Fixed remaining untranslated keys in tool grid and readiness hook
This commit is contained in:
@@ -4,22 +4,22 @@ import { adminPath } from '../../constants';
|
||||
export type ReadinessStep = {
|
||||
id: string;
|
||||
label: string;
|
||||
description?: string; // New: Contextual Why
|
||||
isComplete: boolean;
|
||||
ctaLabel: string;
|
||||
targetPath: string;
|
||||
priority: number; // Lower is higher priority
|
||||
priority: number;
|
||||
};
|
||||
|
||||
export type ReadinessStatus = {
|
||||
steps: ReadinessStep[];
|
||||
totalSteps: number;
|
||||
completedSteps: number;
|
||||
progress: number; // 0 to 1
|
||||
progress: number;
|
||||
nextStep: ReadinessStep | null;
|
||||
isReady: boolean;
|
||||
};
|
||||
|
||||
// We pass `t` (translation function) to localise the return values
|
||||
export function useEventReadiness(event: TenantEvent | null, t: (key: string, fallback?: string) => string): ReadinessStatus {
|
||||
if (!event) {
|
||||
return { steps: [], totalSteps: 0, completedSteps: 0, progress: 0, nextStep: null, isReady: false };
|
||||
@@ -27,7 +27,6 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
|
||||
const settings = (event.settings ?? {}) as Record<string, unknown>;
|
||||
|
||||
// 1. Basics: Date & Location
|
||||
const hasDate = Boolean(event.event_date);
|
||||
const hasLocation = Boolean(
|
||||
(settings.location as string) ||
|
||||
@@ -35,17 +34,16 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
(settings.city as string)
|
||||
);
|
||||
|
||||
// 2. Engagement: Tasks (only if tasks are enabled)
|
||||
const tasksEnabled = event.engagement_mode !== 'photo_only';
|
||||
const hasTasks = (event.tasks_count ?? 0) > 0;
|
||||
|
||||
// 3. Access: QR / Invites
|
||||
const hasInvite = (event.active_invites_count ?? 0) > 0 || (event.total_invites_count ?? 0) > 0;
|
||||
|
||||
const steps: ReadinessStep[] = [
|
||||
{
|
||||
id: 'basics',
|
||||
label: t('management:events.form.date', 'Datum & Ort'),
|
||||
description: 'Grundlage für die Gäste-Info.',
|
||||
isComplete: hasDate && hasLocation,
|
||||
ctaLabel: t('management:events.actions.edit', 'Bearbeiten'),
|
||||
targetPath: `/mobile/events/${event.slug}/edit`,
|
||||
@@ -54,6 +52,7 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
{
|
||||
id: 'access',
|
||||
label: t('management:invites.badge', 'QR-Codes'),
|
||||
description: 'Der Schlüssel für deine Gäste.',
|
||||
ctaLabel: t('management:invites.actions.create', 'QR-Code erstellen'),
|
||||
isComplete: hasInvite,
|
||||
targetPath: `/mobile/events/${event.slug}/qr`,
|
||||
@@ -65,6 +64,7 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
steps.push({
|
||||
id: 'tasks',
|
||||
label: t('management:tasks.badge', 'Aufgaben'),
|
||||
description: 'Sorgt für 3x mehr Interaktion.',
|
||||
isComplete: hasTasks,
|
||||
ctaLabel: t('management:tasks.actions.assign', 'Aufgaben hinzufügen'),
|
||||
targetPath: `/mobile/events/${event.slug}/tasks`,
|
||||
@@ -72,7 +72,6 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
});
|
||||
}
|
||||
|
||||
// Sort by priority
|
||||
steps.sort((a, b) => a.priority - b.priority);
|
||||
|
||||
const completedSteps = steps.filter(s => s.isComplete).length;
|
||||
@@ -87,4 +86,4 @@ export function useEventReadiness(event: TenantEvent | null, t: (key: string, fa
|
||||
nextStep,
|
||||
isReady: !nextStep
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user