Add package summary banner
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-06 12:01:12 +01:00
parent a796973861
commit cc89cc667a
5 changed files with 204 additions and 13 deletions

View File

@@ -0,0 +1,65 @@
type Translate = (key: string, options?: Record<string, unknown> | string) => string;
const FEATURE_LABELS: Record<string, { key: string; fallback: string }> = {
priority_support: {
key: 'mobileDashboard.packageSummary.feature.priority_support',
fallback: 'Priority support',
},
custom_domain: {
key: 'mobileDashboard.packageSummary.feature.custom_domain',
fallback: 'Custom domain',
},
analytics: {
key: 'mobileDashboard.packageSummary.feature.analytics',
fallback: 'Analytics',
},
team_management: {
key: 'mobileDashboard.packageSummary.feature.team_management',
fallback: 'Team management',
},
moderation_tools: {
key: 'mobileDashboard.packageSummary.feature.moderation_tools',
fallback: 'Moderation tools',
},
prints: {
key: 'mobileDashboard.packageSummary.feature.prints',
fallback: 'Print uploads',
},
photo_likes_enabled: {
key: 'mobileDashboard.packageSummary.feature.photo_likes_enabled',
fallback: 'Photo likes',
},
event_checklist: {
key: 'mobileDashboard.packageSummary.feature.event_checklist',
fallback: 'Event checklist',
},
advanced_analytics: {
key: 'mobileDashboard.packageSummary.feature.advanced_analytics',
fallback: 'Advanced analytics',
},
branding_allowed: {
key: 'mobileDashboard.packageSummary.feature.branding_allowed',
fallback: 'Branding',
},
watermark_allowed: {
key: 'mobileDashboard.packageSummary.feature.watermark_allowed',
fallback: 'Watermarks',
},
};
export function getPackageFeatureLabel(feature: string, t: Translate): string {
const entry = FEATURE_LABELS[feature];
if (entry) {
return t(entry.key, entry.fallback);
}
return t(`mobileDashboard.packageSummary.feature.${feature}`, feature);
}
export function formatPackageLimit(value: number | null | undefined, t: Translate): string {
if (value === null || value === undefined) {
return t('mobileDashboard.packageSummary.unlimited', 'Unlimited');
}
return String(value);
}