feat: add shared-branding package and extend shared-utils

NEW PACKAGE: @manacore/shared-branding
- AppLogo: SVG logo component for any Mana app
- AppLogoWithName: Logo with app name for headers
- ManaIcon: Universal Mana drop icon for credits
- Branding config: Centralized colors, names, taglines
- Support for memoro, manacore, manadeck, maerchenzauber

ENHANCED: @manacore/shared-utils
- formatTimestamp: Relative day labels (Today/Yesterday) with i18n
- Re-export isToday, isYesterday from date-fns

App branding centralized:
- memoro: Gold (#f8d62b), AI Voice Memos
- manacore: Indigo (#6366f1), Central Hub
- manadeck: Purple (#8b5cf6), AI Flashcards
- maerchenzauber: Pink (#ec4899), AI Story Creator

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Till-JS 2025-11-24 22:12:24 +01:00
parent afdc30bd5f
commit 7d426d57fd
10 changed files with 493 additions and 1 deletions

View file

@ -2,7 +2,7 @@
* Date utility functions
*/
import { format, formatDistanceToNow, parseISO } from 'date-fns';
import { format, formatDistanceToNow, parseISO, isToday, isYesterday } from 'date-fns';
import { de, enUS } from 'date-fns/locale';
const locales = {
@ -41,3 +41,40 @@ export function formatRelativeTime(date: string | Date, locale: LocaleKey = 'de'
export function toISOString(date: Date): string {
return date.toISOString();
}
/**
* Format timestamp with relative day labels (Today, Yesterday, or full date)
*
* Examples:
* - Today "Today, 14:30" / "Heute, 14:30"
* - Yesterday "Yesterday, 14:30" / "Gestern, 14:30"
* - Other "15. März 2024, 14:30" / "March 15, 2024, 2:30 PM"
*/
export function formatTimestamp(
date: string | Date,
locale: LocaleKey = 'de'
): string {
const dateObj = typeof date === 'string' ? parseISO(date) : date;
const timeFormat = locale === 'de' ? 'HH:mm' : 'h:mm a';
const labels = {
de: { today: 'Heute', yesterday: 'Gestern' },
en: { today: 'Today', yesterday: 'Yesterday' },
};
if (isToday(dateObj)) {
return `${labels[locale].today}, ${format(dateObj, timeFormat)}`;
}
if (isYesterday(dateObj)) {
return `${labels[locale].yesterday}, ${format(dateObj, timeFormat)}`;
}
const dateFormat = locale === 'de' ? 'd. MMMM yyyy' : 'MMMM d, yyyy';
return `${format(dateObj, dateFormat, { locale: locales[locale] })}, ${format(dateObj, timeFormat)}`;
}
/**
* Check if a date is today
*/
export { isToday, isYesterday } from 'date-fns';