♻️ refactor: unify web app patterns across monorepo

- Rename authStore.svelte.ts to auth.svelte.ts (manacore, manadeck, moodlit)
- Add i18n setup to Finance and Mail apps (DE, EN, FR, ES, IT)
- Add feedback pages using shared component to Finance and Mail
- Create @manacore/shared-api-client package with API client factory
- Create @manacore/shared-vite-config package with SSR config helpers
- Create @manacore/shared-stores package with toast, navigation, theme factories

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Till-JS 2025-12-05 03:35:26 +01:00
parent c93aca0cce
commit cfbc8a2c15
60 changed files with 2213 additions and 173 deletions

View file

@ -0,0 +1,58 @@
/**
* i18n setup for Finance app
* Supports: DE, EN, FR, ES, IT
*/
import { browser } from '$app/environment';
import { init, register, locale, getLocaleFromNavigator } from 'svelte-i18n';
// Supported locales
export const supportedLocales = ['de', 'en', 'fr', 'es', 'it'] as const;
export type SupportedLocale = (typeof supportedLocales)[number];
// Register locales
register('de', () => import('./locales/de.json'));
register('en', () => import('./locales/en.json'));
register('fr', () => import('./locales/fr.json'));
register('es', () => import('./locales/es.json'));
register('it', () => import('./locales/it.json'));
// Get initial locale
function getInitialLocale(): SupportedLocale {
if (browser) {
// Check localStorage first
const saved = localStorage.getItem('finance-locale');
if (saved && supportedLocales.includes(saved as SupportedLocale)) {
return saved as SupportedLocale;
}
// Fall back to browser language
const browserLocale = getLocaleFromNavigator();
if (browserLocale) {
const shortLocale = browserLocale.split('-')[0] as SupportedLocale;
if (supportedLocales.includes(shortLocale)) {
return shortLocale;
}
}
}
// Default to German
return 'de';
}
// Initialize i18n at module scope (required for SSR)
init({
fallbackLocale: 'de',
initialLocale: getInitialLocale(),
});
// Set locale and persist
export function setLocale(newLocale: SupportedLocale) {
locale.set(newLocale);
if (browser) {
localStorage.setItem('finance-locale', newLocale);
}
}
// Wait for locale to be loaded (useful for SSR)
export { waitLocale } from 'svelte-i18n';

View file

@ -0,0 +1,133 @@
{
"app": {
"name": "Finance",
"loading": "Laden..."
},
"nav": {
"dashboard": "Übersicht",
"accounts": "Konten",
"transactions": "Transaktionen",
"budgets": "Budgets",
"categories": "Kategorien",
"reports": "Berichte",
"settings": "Einstellungen",
"feedback": "Feedback"
},
"auth": {
"login": "Anmelden",
"register": "Registrieren",
"logout": "Abmelden",
"forgotPassword": "Passwort vergessen",
"email": "E-Mail",
"password": "Passwort",
"confirmPassword": "Passwort bestätigen"
},
"dashboard": {
"title": "Finanzübersicht",
"totalBalance": "Gesamtguthaben",
"income": "Einnahmen",
"expenses": "Ausgaben",
"savings": "Ersparnis",
"recentTransactions": "Letzte Transaktionen",
"budgetOverview": "Budget-Übersicht"
},
"accounts": {
"title": "Konten",
"add": "Konto hinzufügen",
"edit": "Konto bearbeiten",
"delete": "Konto löschen",
"name": "Kontoname",
"type": "Kontotyp",
"balance": "Kontostand",
"currency": "Währung",
"noAccounts": "Keine Konten vorhanden",
"types": {
"checking": "Girokonto",
"savings": "Sparkonto",
"credit": "Kreditkarte",
"cash": "Bargeld",
"investment": "Investment"
}
},
"transactions": {
"title": "Transaktionen",
"add": "Transaktion hinzufügen",
"edit": "Transaktion bearbeiten",
"delete": "Transaktion löschen",
"amount": "Betrag",
"date": "Datum",
"description": "Beschreibung",
"category": "Kategorie",
"account": "Konto",
"type": "Art",
"noTransactions": "Keine Transaktionen vorhanden",
"types": {
"income": "Einnahme",
"expense": "Ausgabe",
"transfer": "Überweisung"
}
},
"budgets": {
"title": "Budgets",
"add": "Budget hinzufügen",
"edit": "Budget bearbeiten",
"delete": "Budget löschen",
"name": "Budgetname",
"amount": "Betrag",
"spent": "Ausgegeben",
"remaining": "Verbleibend",
"period": "Zeitraum",
"category": "Kategorie",
"noBudgets": "Keine Budgets vorhanden",
"periods": {
"weekly": "Wöchentlich",
"monthly": "Monatlich",
"yearly": "Jährlich"
}
},
"categories": {
"title": "Kategorien",
"add": "Kategorie hinzufügen",
"edit": "Kategorie bearbeiten",
"delete": "Kategorie löschen",
"name": "Name",
"icon": "Symbol",
"color": "Farbe",
"noCategories": "Keine Kategorien vorhanden"
},
"reports": {
"title": "Berichte",
"incomeVsExpenses": "Einnahmen vs. Ausgaben",
"categoryBreakdown": "Aufschlüsselung nach Kategorien",
"trends": "Trends",
"export": "Exportieren"
},
"settings": {
"title": "Einstellungen",
"general": "Allgemein",
"appearance": "Darstellung",
"currency": "Standardwährung",
"language": "Sprache",
"theme": "Design",
"darkMode": "Dunkelmodus",
"notifications": "Benachrichtigungen"
},
"common": {
"save": "Speichern",
"cancel": "Abbrechen",
"delete": "Löschen",
"edit": "Bearbeiten",
"add": "Hinzufügen",
"confirm": "Bestätigen",
"yes": "Ja",
"no": "Nein",
"ok": "OK",
"loading": "Laden...",
"error": "Fehler",
"success": "Erfolg",
"back": "Zurück",
"search": "Suchen",
"filter": "Filtern",
"sort": "Sortieren"
}
}

View file

@ -0,0 +1,133 @@
{
"app": {
"name": "Finance",
"loading": "Loading..."
},
"nav": {
"dashboard": "Dashboard",
"accounts": "Accounts",
"transactions": "Transactions",
"budgets": "Budgets",
"categories": "Categories",
"reports": "Reports",
"settings": "Settings",
"feedback": "Feedback"
},
"auth": {
"login": "Sign In",
"register": "Sign Up",
"logout": "Sign Out",
"forgotPassword": "Forgot Password",
"email": "Email",
"password": "Password",
"confirmPassword": "Confirm Password"
},
"dashboard": {
"title": "Financial Overview",
"totalBalance": "Total Balance",
"income": "Income",
"expenses": "Expenses",
"savings": "Savings",
"recentTransactions": "Recent Transactions",
"budgetOverview": "Budget Overview"
},
"accounts": {
"title": "Accounts",
"add": "Add Account",
"edit": "Edit Account",
"delete": "Delete Account",
"name": "Account Name",
"type": "Account Type",
"balance": "Balance",
"currency": "Currency",
"noAccounts": "No accounts yet",
"types": {
"checking": "Checking",
"savings": "Savings",
"credit": "Credit Card",
"cash": "Cash",
"investment": "Investment"
}
},
"transactions": {
"title": "Transactions",
"add": "Add Transaction",
"edit": "Edit Transaction",
"delete": "Delete Transaction",
"amount": "Amount",
"date": "Date",
"description": "Description",
"category": "Category",
"account": "Account",
"type": "Type",
"noTransactions": "No transactions yet",
"types": {
"income": "Income",
"expense": "Expense",
"transfer": "Transfer"
}
},
"budgets": {
"title": "Budgets",
"add": "Add Budget",
"edit": "Edit Budget",
"delete": "Delete Budget",
"name": "Budget Name",
"amount": "Amount",
"spent": "Spent",
"remaining": "Remaining",
"period": "Period",
"category": "Category",
"noBudgets": "No budgets yet",
"periods": {
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly"
}
},
"categories": {
"title": "Categories",
"add": "Add Category",
"edit": "Edit Category",
"delete": "Delete Category",
"name": "Name",
"icon": "Icon",
"color": "Color",
"noCategories": "No categories yet"
},
"reports": {
"title": "Reports",
"incomeVsExpenses": "Income vs. Expenses",
"categoryBreakdown": "Category Breakdown",
"trends": "Trends",
"export": "Export"
},
"settings": {
"title": "Settings",
"general": "General",
"appearance": "Appearance",
"currency": "Default Currency",
"language": "Language",
"theme": "Theme",
"darkMode": "Dark Mode",
"notifications": "Notifications"
},
"common": {
"save": "Save",
"cancel": "Cancel",
"delete": "Delete",
"edit": "Edit",
"add": "Add",
"confirm": "Confirm",
"yes": "Yes",
"no": "No",
"ok": "OK",
"loading": "Loading...",
"error": "Error",
"success": "Success",
"back": "Back",
"search": "Search",
"filter": "Filter",
"sort": "Sort"
}
}

View file

@ -0,0 +1,133 @@
{
"app": {
"name": "Finance",
"loading": "Cargando..."
},
"nav": {
"dashboard": "Panel",
"accounts": "Cuentas",
"transactions": "Transacciones",
"budgets": "Presupuestos",
"categories": "Categorías",
"reports": "Informes",
"settings": "Configuración",
"feedback": "Feedback"
},
"auth": {
"login": "Iniciar sesión",
"register": "Registrarse",
"logout": "Cerrar sesión",
"forgotPassword": "Olvidé mi contraseña",
"email": "Correo electrónico",
"password": "Contraseña",
"confirmPassword": "Confirmar contraseña"
},
"dashboard": {
"title": "Resumen financiero",
"totalBalance": "Saldo total",
"income": "Ingresos",
"expenses": "Gastos",
"savings": "Ahorros",
"recentTransactions": "Transacciones recientes",
"budgetOverview": "Resumen de presupuesto"
},
"accounts": {
"title": "Cuentas",
"add": "Añadir cuenta",
"edit": "Editar cuenta",
"delete": "Eliminar cuenta",
"name": "Nombre de cuenta",
"type": "Tipo de cuenta",
"balance": "Saldo",
"currency": "Moneda",
"noAccounts": "Sin cuentas",
"types": {
"checking": "Cuenta corriente",
"savings": "Cuenta de ahorro",
"credit": "Tarjeta de crédito",
"cash": "Efectivo",
"investment": "Inversión"
}
},
"transactions": {
"title": "Transacciones",
"add": "Añadir transacción",
"edit": "Editar transacción",
"delete": "Eliminar transacción",
"amount": "Importe",
"date": "Fecha",
"description": "Descripción",
"category": "Categoría",
"account": "Cuenta",
"type": "Tipo",
"noTransactions": "Sin transacciones",
"types": {
"income": "Ingreso",
"expense": "Gasto",
"transfer": "Transferencia"
}
},
"budgets": {
"title": "Presupuestos",
"add": "Añadir presupuesto",
"edit": "Editar presupuesto",
"delete": "Eliminar presupuesto",
"name": "Nombre del presupuesto",
"amount": "Importe",
"spent": "Gastado",
"remaining": "Restante",
"period": "Período",
"category": "Categoría",
"noBudgets": "Sin presupuestos",
"periods": {
"weekly": "Semanal",
"monthly": "Mensual",
"yearly": "Anual"
}
},
"categories": {
"title": "Categorías",
"add": "Añadir categoría",
"edit": "Editar categoría",
"delete": "Eliminar categoría",
"name": "Nombre",
"icon": "Icono",
"color": "Color",
"noCategories": "Sin categorías"
},
"reports": {
"title": "Informes",
"incomeVsExpenses": "Ingresos vs. Gastos",
"categoryBreakdown": "Desglose por categoría",
"trends": "Tendencias",
"export": "Exportar"
},
"settings": {
"title": "Configuración",
"general": "General",
"appearance": "Apariencia",
"currency": "Moneda predeterminada",
"language": "Idioma",
"theme": "Tema",
"darkMode": "Modo oscuro",
"notifications": "Notificaciones"
},
"common": {
"save": "Guardar",
"cancel": "Cancelar",
"delete": "Eliminar",
"edit": "Editar",
"add": "Añadir",
"confirm": "Confirmar",
"yes": "Sí",
"no": "No",
"ok": "OK",
"loading": "Cargando...",
"error": "Error",
"success": "Éxito",
"back": "Atrás",
"search": "Buscar",
"filter": "Filtrar",
"sort": "Ordenar"
}
}

View file

@ -0,0 +1,133 @@
{
"app": {
"name": "Finance",
"loading": "Chargement..."
},
"nav": {
"dashboard": "Tableau de bord",
"accounts": "Comptes",
"transactions": "Transactions",
"budgets": "Budgets",
"categories": "Catégories",
"reports": "Rapports",
"settings": "Paramètres",
"feedback": "Feedback"
},
"auth": {
"login": "Se connecter",
"register": "S'inscrire",
"logout": "Se déconnecter",
"forgotPassword": "Mot de passe oublié",
"email": "E-mail",
"password": "Mot de passe",
"confirmPassword": "Confirmer le mot de passe"
},
"dashboard": {
"title": "Aperçu financier",
"totalBalance": "Solde total",
"income": "Revenus",
"expenses": "Dépenses",
"savings": "Épargne",
"recentTransactions": "Transactions récentes",
"budgetOverview": "Aperçu du budget"
},
"accounts": {
"title": "Comptes",
"add": "Ajouter un compte",
"edit": "Modifier le compte",
"delete": "Supprimer le compte",
"name": "Nom du compte",
"type": "Type de compte",
"balance": "Solde",
"currency": "Devise",
"noAccounts": "Aucun compte",
"types": {
"checking": "Compte courant",
"savings": "Compte épargne",
"credit": "Carte de crédit",
"cash": "Espèces",
"investment": "Investissement"
}
},
"transactions": {
"title": "Transactions",
"add": "Ajouter une transaction",
"edit": "Modifier la transaction",
"delete": "Supprimer la transaction",
"amount": "Montant",
"date": "Date",
"description": "Description",
"category": "Catégorie",
"account": "Compte",
"type": "Type",
"noTransactions": "Aucune transaction",
"types": {
"income": "Revenu",
"expense": "Dépense",
"transfer": "Virement"
}
},
"budgets": {
"title": "Budgets",
"add": "Ajouter un budget",
"edit": "Modifier le budget",
"delete": "Supprimer le budget",
"name": "Nom du budget",
"amount": "Montant",
"spent": "Dépensé",
"remaining": "Restant",
"period": "Période",
"category": "Catégorie",
"noBudgets": "Aucun budget",
"periods": {
"weekly": "Hebdomadaire",
"monthly": "Mensuel",
"yearly": "Annuel"
}
},
"categories": {
"title": "Catégories",
"add": "Ajouter une catégorie",
"edit": "Modifier la catégorie",
"delete": "Supprimer la catégorie",
"name": "Nom",
"icon": "Icône",
"color": "Couleur",
"noCategories": "Aucune catégorie"
},
"reports": {
"title": "Rapports",
"incomeVsExpenses": "Revenus vs. Dépenses",
"categoryBreakdown": "Répartition par catégorie",
"trends": "Tendances",
"export": "Exporter"
},
"settings": {
"title": "Paramètres",
"general": "Général",
"appearance": "Apparence",
"currency": "Devise par défaut",
"language": "Langue",
"theme": "Thème",
"darkMode": "Mode sombre",
"notifications": "Notifications"
},
"common": {
"save": "Enregistrer",
"cancel": "Annuler",
"delete": "Supprimer",
"edit": "Modifier",
"add": "Ajouter",
"confirm": "Confirmer",
"yes": "Oui",
"no": "Non",
"ok": "OK",
"loading": "Chargement...",
"error": "Erreur",
"success": "Succès",
"back": "Retour",
"search": "Rechercher",
"filter": "Filtrer",
"sort": "Trier"
}
}

View file

@ -0,0 +1,133 @@
{
"app": {
"name": "Finance",
"loading": "Caricamento..."
},
"nav": {
"dashboard": "Panoramica",
"accounts": "Conti",
"transactions": "Transazioni",
"budgets": "Budget",
"categories": "Categorie",
"reports": "Report",
"settings": "Impostazioni",
"feedback": "Feedback"
},
"auth": {
"login": "Accedi",
"register": "Registrati",
"logout": "Esci",
"forgotPassword": "Password dimenticata",
"email": "E-mail",
"password": "Password",
"confirmPassword": "Conferma password"
},
"dashboard": {
"title": "Panoramica finanziaria",
"totalBalance": "Saldo totale",
"income": "Entrate",
"expenses": "Spese",
"savings": "Risparmi",
"recentTransactions": "Transazioni recenti",
"budgetOverview": "Panoramica budget"
},
"accounts": {
"title": "Conti",
"add": "Aggiungi conto",
"edit": "Modifica conto",
"delete": "Elimina conto",
"name": "Nome conto",
"type": "Tipo conto",
"balance": "Saldo",
"currency": "Valuta",
"noAccounts": "Nessun conto",
"types": {
"checking": "Conto corrente",
"savings": "Conto risparmio",
"credit": "Carta di credito",
"cash": "Contanti",
"investment": "Investimento"
}
},
"transactions": {
"title": "Transazioni",
"add": "Aggiungi transazione",
"edit": "Modifica transazione",
"delete": "Elimina transazione",
"amount": "Importo",
"date": "Data",
"description": "Descrizione",
"category": "Categoria",
"account": "Conto",
"type": "Tipo",
"noTransactions": "Nessuna transazione",
"types": {
"income": "Entrata",
"expense": "Spesa",
"transfer": "Trasferimento"
}
},
"budgets": {
"title": "Budget",
"add": "Aggiungi budget",
"edit": "Modifica budget",
"delete": "Elimina budget",
"name": "Nome budget",
"amount": "Importo",
"spent": "Speso",
"remaining": "Rimanente",
"period": "Periodo",
"category": "Categoria",
"noBudgets": "Nessun budget",
"periods": {
"weekly": "Settimanale",
"monthly": "Mensile",
"yearly": "Annuale"
}
},
"categories": {
"title": "Categorie",
"add": "Aggiungi categoria",
"edit": "Modifica categoria",
"delete": "Elimina categoria",
"name": "Nome",
"icon": "Icona",
"color": "Colore",
"noCategories": "Nessuna categoria"
},
"reports": {
"title": "Report",
"incomeVsExpenses": "Entrate vs. Spese",
"categoryBreakdown": "Suddivisione per categoria",
"trends": "Tendenze",
"export": "Esporta"
},
"settings": {
"title": "Impostazioni",
"general": "Generale",
"appearance": "Aspetto",
"currency": "Valuta predefinita",
"language": "Lingua",
"theme": "Tema",
"darkMode": "Modalità scura",
"notifications": "Notifiche"
},
"common": {
"save": "Salva",
"cancel": "Annulla",
"delete": "Elimina",
"edit": "Modifica",
"add": "Aggiungi",
"confirm": "Conferma",
"yes": "Sì",
"no": "No",
"ok": "OK",
"loading": "Caricamento...",
"error": "Errore",
"success": "Successo",
"back": "Indietro",
"search": "Cerca",
"filter": "Filtra",
"sort": "Ordina"
}
}

View file

@ -1,5 +1,6 @@
<script lang="ts">
import '../app.css';
import '$lib/i18n';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { authStore } from '$lib/stores';

View file

@ -1,124 +1,20 @@
<script lang="ts">
let type = $state<'bug' | 'feature' | 'other'>('feature');
let message = $state('');
let email = $state('');
let isSubmitting = $state(false);
let success = $state(false);
let error = $state<string | null>(null);
import { FeedbackPage } from '@manacore/shared-feedback-ui';
import { createFeedbackService } from '@manacore/shared-feedback-service';
import { authStore } from '$lib/stores/auth.svelte';
async function handleSubmit(e: Event) {
e.preventDefault();
isSubmitting = true;
error = null;
const feedbackService = createFeedbackService({
appName: 'finance',
apiUrl: 'http://localhost:3001', // Mana Core API
});
try {
// TODO: Implement feedback submission
console.log('Feedback:', { type, message, email });
success = true;
} catch (e) {
error = e instanceof Error ? e.message : 'Feedback konnte nicht gesendet werden';
} finally {
isSubmitting = false;
}
async function handleSubmit(data: { type: string; message: string; email?: string }) {
const token = await authStore.getAccessToken();
return feedbackService.submit({
...data,
token: token || undefined,
});
}
</script>
<svelte:head>
<title>Feedback | Finance</title>
</svelte:head>
<div class="mx-auto max-w-2xl space-y-6">
<h1 class="text-2xl font-bold">Feedback</h1>
{#if success}
<div class="rounded-lg border border-green-500/50 bg-green-500/10 p-8 text-center">
<div class="mb-4 text-4xl"></div>
<h2 class="text-xl font-semibold text-green-600">Vielen Dank für Ihr Feedback!</h2>
<p class="mt-2 text-muted-foreground">Wir werden uns Ihre Nachricht ansehen.</p>
<a
href="/"
class="mt-4 inline-block rounded-lg bg-primary px-6 py-2 text-primary-foreground hover:bg-primary/90"
>
Zurück zur Startseite
</a>
</div>
{:else}
<form onsubmit={handleSubmit} class="space-y-6">
<div class="rounded-lg border border-border bg-card p-6">
<h2 class="mb-4 text-lg font-semibold">Was möchten Sie uns mitteilen?</h2>
<div class="mb-4 flex gap-2">
<button
type="button"
onclick={() => (type = 'bug')}
class="rounded-lg px-4 py-2 {type === 'bug'
? 'bg-red-500 text-white'
: 'border border-border hover:bg-accent'}"
>
🐛 Bug melden
</button>
<button
type="button"
onclick={() => (type = 'feature')}
class="rounded-lg px-4 py-2 {type === 'feature'
? 'bg-blue-500 text-white'
: 'border border-border hover:bg-accent'}"
>
💡 Feature-Wunsch
</button>
<button
type="button"
onclick={() => (type = 'other')}
class="rounded-lg px-4 py-2 {type === 'other'
? 'bg-gray-500 text-white'
: 'border border-border hover:bg-accent'}"
>
💬 Sonstiges
</button>
</div>
<div class="space-y-4">
<div>
<label for="message" class="mb-1 block text-sm font-medium">Ihre Nachricht</label>
<textarea
id="message"
bind:value={message}
required
rows="6"
class="w-full rounded-lg border border-border bg-background px-3 py-2"
placeholder="Beschreiben Sie Ihr Anliegen..."
></textarea>
</div>
<div>
<label for="email" class="mb-1 block text-sm font-medium">E-Mail (optional)</label>
<input
id="email"
type="email"
bind:value={email}
class="w-full rounded-lg border border-border bg-background px-3 py-2"
placeholder="ihre@email.de"
/>
<p class="mt-1 text-xs text-muted-foreground">
Falls wir Rückfragen haben oder Sie über Updates informieren möchten
</p>
</div>
</div>
</div>
{#if error}
<div class="rounded-lg bg-destructive/10 p-4 text-destructive">{error}</div>
{/if}
<div class="flex justify-end">
<button
type="submit"
disabled={isSubmitting || !message.trim()}
class="rounded-lg bg-primary px-6 py-2 text-primary-foreground hover:bg-primary/90 disabled:opacity-50"
>
{isSubmitting ? 'Senden...' : 'Feedback senden'}
</button>
</div>
</form>
{/if}
</div>
<FeedbackPage appName="Finance" onSubmit={handleSubmit} userEmail={authStore.user?.email} />