Compare commits

..
5 Commits
Author SHA1 Message Date
anbratenandClaude Sonnet 5.5 27a38c82a0 ♻️ move add expense button above list
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 18:20:06 +02:00
anbraten ba8b9c9409 🐛 fix settings icon 2026-09-24 21:37:38 +02:00
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
13 changed files with 123 additions and 30 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 -1
View File
@@ -107,7 +107,7 @@ async function copyLink() {
<svg class="h-4.5 w-4.5" viewBox="0 0 20 20" fill="currentColor">
<path
fill-rule="evenodd"
d="M8.34 1.804A1 1 0 0 1 9.32 1h1.36a1 1 0 0 1 .98.804l.24 1.192c.428.183.83.41 1.2.674l1.146-.386a1 1 0 0 1 1.212.464l.68 1.178a1 1 0 0 1-.208 1.267l-.912.816a6.5 6.5 0 0 1 0 1.382l.912.816a1 1 0 0 1 .208 1.267l-.68 1.178a1 1 0 0 1-1.212.464l-1.146-.386c-.37.264-.772.49-1.2.674l-.24 1.192a1 1 0 0 1-.98.804H9.32a1 1 0 0 1-.98-.804l-.24-1.192a6.5 6.5 0 0 1-1.2-.674l-1.146.386a1 1 0 0 1-1.212-.464l-.68-1.178a1 1 0 0 1 .208-1.267l.912-.816a6.5 6.5 0 0 1 0-1.382l-.912-.816a1 1 0 0 1-.208-1.267l.68-1.178a1 1 0 0 1 1.212-.464l1.146.386c.37-.264.772-.49 1.2-.674l.24-1.192ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
d="M7.83922 1.80388C7.93271 1.33646 8.34312 1 8.81981 1H11.1802C11.6569 1 12.0673 1.33646 12.1608 1.80388L12.4913 3.45629C13.1956 3.72458 13.8454 4.10332 14.4196 4.57133L16.0179 4.03065C16.4694 3.8779 16.966 4.06509 17.2043 4.47791L18.3845 6.52207C18.6229 6.93489 18.5367 7.45855 18.1786 7.77322L16.9119 8.88645C16.9699 9.24909 17 9.62103 17 10C17 10.379 16.9699 10.7509 16.9119 11.1135L18.1786 12.2268C18.5367 12.5414 18.6229 13.0651 18.3845 13.4779L17.2043 15.5221C16.966 15.9349 16.4694 16.1221 16.0179 15.9693L14.4196 15.4287C13.8454 15.8967 13.1956 16.2754 12.4913 16.5437L12.1608 18.1961C12.0673 18.6635 11.6569 19 11.1802 19H8.81981C8.34312 19 7.93271 18.6635 7.83922 18.1961L7.50874 16.5437C6.80443 16.2754 6.1546 15.8967 5.58043 15.4287L3.98214 15.9694C3.5306 16.1221 3.03401 15.9349 2.79567 15.5221L1.61547 13.4779C1.37713 13.0651 1.4633 12.5415 1.82136 12.2268L3.08808 11.1135C3.03012 10.7509 3 10.379 3 10C3 9.62103 3.03012 9.2491 3.08808 8.88647L1.82136 7.77324C1.46331 7.45857 1.37713 6.93491 1.61547 6.52209L2.79567 4.47793C3.03401 4.06511 3.5306 3.87791 3.98214 4.03066L5.58042 4.57134C6.15459 4.10332 6.80442 3.72459 7.50874 3.45629L7.83922 1.80388ZM10 13C11.6569 13 13 11.6569 13 10C13 8.34315 11.6569 7 10 7C8.34315 7 7 8.34315 7 10C7 11.6569 8.34315 13 10 13Z"
clip-rule="evenodd"
/>
</svg>
+10 -9
View File
@@ -64,11 +64,21 @@ async function removeExpense(id: number) {
<template>
<section v-if="data" class="space-y-3">
<button
v-if="!showExpenseForm"
type="button"
class="w-full rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600"
@click="newExpense"
>
{{ t('expenses.addExpense') }}
</button>
<ExpenseList
v-if="!showExpenseForm"
:expenses="data.expenses"
:participants="data.participants"
:currency="data.pot.currency"
:current-participant-id="me?.id"
@edit="editExpense"
@remove="removeExpense"
/>
@@ -82,14 +92,5 @@ async function removeExpense(id: number) {
@submit="submitExpense"
@cancel="cancelExpenseForm"
/>
<button
v-if="!showExpenseForm"
type="button"
class="w-full rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600"
@click="newExpense"
>
{{ t('expenses.addExpense') }}
</button>
</section>
</template>
+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"
}
]
}