Fix notification event names and allow welcome onboarding
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-02-04 11:22:38 +01:00
parent 049c4f82b9
commit 9ddb135c03
5 changed files with 53 additions and 3 deletions

View File

@@ -43,6 +43,16 @@ type NotificationSwipeRowProps = {
children: React.ReactNode;
};
function resolveEventName(name: TenantEvent['name'], t: (key: string, fallback?: string) => string): string {
if (typeof name === 'string') {
return name;
}
if (name && typeof name === 'object') {
return name.de ?? name.en ?? Object.values(name)[0] ?? t('events.placeholders.untitled', 'Unbenanntes Event');
}
return t('events.placeholders.untitled', 'Unbenanntes Event');
}
function NotificationSwipeRow({ item, onOpen, onMarkRead, children }: NotificationSwipeRowProps) {
const { t } = useTranslation('management');
const { successBg, successText, infoBg, infoText } = useAdminTheme();
@@ -296,7 +306,7 @@ async function loadNotifications(
});
const lookup = new Map<number, string>();
(events ?? []).forEach((event) => {
lookup.set(event.id, typeof event.name === 'string' ? event.name : (event.name as Record<string, string>)?.en ?? '');
lookup.set(event.id, resolveEventName(event.name, t));
});
return (response.data ?? [])
@@ -756,7 +766,7 @@ export default function MobileNotificationsPage() {
<XStack alignItems="center" justifyContent="space-between" paddingVertical="$2">
<YStack>
<Text fontSize="$sm" fontWeight="700" color={text}>
{ev.name}
{resolveEventName(ev.name, t)}
</Text>
<Text fontSize="$xs" color={muted}>
{ev.slug}