Compare commits

...
3 Commits
Author SHA1 Message Date
anbraten 89e7e6a349 ✨ add app manifest 2026-09-24 21:00:31 +02:00
anbraten 280989a8cc ✨ show language select on start page 2026-09-24 21:00:16 +02:00
anbraten fa16a60d24 ✨ show total expense amount and your part 2026-09-24 20:59:44 +02:00
12 changed files with 113 additions and 20 deletions

No files matched your search

-19
View File
@@ -1,28 +1,9 @@
<script setup lang="ts">
const { locale, locales, setLocale } = useI18n();
</script>
<template>
<div
class="min-h-screen bg-orange-50/40 text-stone-900 dark:bg-stone-950 dark:text-stone-100"
>
<NuxtRouteAnnouncer />
<main class="mx-auto max-w-md px-4 py-8">
<div class="mb-4 flex justify-end">
<select
:value="locale"
class="rounded-lg border border-stone-300 bg-white px-2 py-1 text-xs font-medium text-stone-600 shadow-sm dark:border-stone-700 dark:bg-stone-900 dark:text-stone-300"
@change="
setLocale(
($event.target as HTMLSelectElement).value as typeof locale,
)
"
>
<option v-for="loc in locales" :key="loc.code" :value="loc.code">
{{ loc.name }}
</option>
</select>
</div>
<NuxtPage />
</main>
</div>
+43
View File
@@ -5,6 +5,7 @@ const props = defineProps<{
expenses: ExpenseView[];
participants: ParticipantView[];
currency: string;
currentParticipantId?: number;
}>();
const emit = defineEmits<{
@@ -37,10 +38,52 @@ function toggle(id: number) {
const sorted = computed(() =>
[...props.expenses].sort((a, b) => b.createdAt - a.createdAt),
);
const totalExpensesCents = computed(() =>
props.expenses
.filter((expense) => expense.type === 'expense')
.reduce((sum, expense) => sum + expense.amountCents, 0),
);
const myExpensesCents = computed(() => {
const myId = props.currentParticipantId;
if (myId === undefined) return 0;
return props.expenses
.filter(
(expense) =>
expense.type === 'expense' && expense.participantIds.includes(myId),
)
.reduce((sum, expense) => {
const shares = computeSplit(expense.amountCents, expense.participantIds);
return sum + (shares[myId] ?? 0);
}, 0);
});
</script>
<template>
<div class="space-y-3">
<div
v-if="expenses.length > 0"
class="flex gap-3 rounded-2xl border border-stone-200 bg-white p-4 shadow-sm dark:border-stone-800 dark:bg-stone-900"
>
<div class="flex-1">
<p class="text-xs text-stone-500 dark:text-stone-400">
{{ t('expenses.total') }}
</p>
<p class="font-medium text-stone-900 dark:text-stone-100">
{{ formatCurrency(totalExpensesCents, currency) }}
</p>
</div>
<div v-if="currentParticipantId !== undefined" class="flex-1">
<p class="text-xs text-stone-500 dark:text-stone-400">
{{ t('expenses.mine') }}
</p>
<p class="font-medium text-orange-600 dark:text-orange-400">
{{ formatCurrency(myExpensesCents, currency) }}
</p>
</div>
</div>
<p
v-if="expenses.length === 0"
class="rounded-2xl border border-dashed border-stone-300 p-4 text-center text-sm text-stone-500 dark:border-stone-700 dark:text-stone-400"
+21 -1
View File
@@ -1,8 +1,13 @@
<script setup lang="ts">
const { t } = useI18n();
const { t, locale, locales, setLocale } = useI18n();
const { name, setName } = useIdentity();
const { pots: visitedPots } = useVisitedPots();
const localeFlags: Record<string, string> = {
en: '🇬🇧',
de: '🇩🇪',
};
const potName = ref('');
const currency = ref('EUR');
const creating = ref(false);
@@ -34,6 +39,21 @@ async function createPot() {
<template>
<div class="space-y-8">
<div class="flex justify-end gap-1">
<button
v-for="loc in locales"
:key="loc.code"
type="button"
class="rounded-lg px-1.5 py-1 text-lg leading-none transition-opacity"
:class="loc.code === locale ? 'opacity-100' : 'opacity-40 hover:opacity-70'"
:aria-label="loc.name"
:aria-current="loc.code === locale"
@click="setLocale(loc.code as typeof locale)"
>
{{ localeFlags[loc.code] ?? loc.code }}
</button>
</div>
<div class="space-y-1 text-center">
<div class="text-4xl">🍯</div>
<h1 class="text-2xl font-bold text-stone-900 dark:text-stone-100">
+1
View File
@@ -69,6 +69,7 @@ async function removeExpense(id: number) {
:expenses="data.expenses"
:participants="data.participants"
:currency="data.pot.currency"
:current-participant-id="me?.id"
@edit="editExpense"
@remove="removeExpense"
/>
+2
View File
@@ -50,6 +50,8 @@
},
"expenses": {
"empty": "Noch keine Ausgaben. Füge die erste unten hinzu.",
"total": "Gesamtausgaben",
"mine": "Deine Ausgaben",
"addExpense": "+ Ausgabe hinzufügen",
"paidBy": "bezahlt von {name}",
"paymentDescription": "{payer} hat {recipient} bezahlt",
+2
View File
@@ -50,6 +50,8 @@
},
"expenses": {
"empty": "No expenses yet. Add the first one below.",
"total": "Total expenses",
"mine": "Your expenses",
"addExpense": "+ Add expense",
"paidBy": "paid by {name}",
"paymentDescription": "{payer} paid {recipient}",
+14
View File
@@ -6,6 +6,20 @@ export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/i18n'],
css: ['~/assets/css/tailwind.css'],
app: {
head: {
link: [
{ rel: 'manifest', href: '/manifest.webmanifest' },
{ rel: 'apple-touch-icon', href: '/apple-touch-icon.png' },
],
meta: [
{ name: 'theme-color', content: '#ea580c' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
{ name: 'apple-mobile-web-app-title', content: 'Splitt' },
],
},
},
vite: {
plugins: [tailwindcss()],
},
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

+30
View File
@@ -0,0 +1,30 @@
{
"name": "Splitt the Bill",
"short_name": "Splitt",
"description": "Track shared costs with friends, the easy way.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#fff7ed",
"theme_color": "#ea580c",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}