✨ add german translation
This commit is contained in:
15 files changed
+3282
-4101
No files matched your search
+19
@@ -1,9 +1,28 @@
|
||||
<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>
|
||||
|
||||
@@ -20,6 +20,8 @@ const emit = defineEmits<{
|
||||
cancel: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const description = ref(props.editing?.description ?? '');
|
||||
const amount = ref(
|
||||
props.editing ? fromCents(props.editing.amountCents).toString() : '',
|
||||
@@ -45,15 +47,15 @@ function onSubmit() {
|
||||
const amountCents = toCents(Number(amount.value));
|
||||
|
||||
if (!description.value.trim()) {
|
||||
error.value = 'Description is required.';
|
||||
error.value = t('expenseForm.errorDescriptionRequired');
|
||||
return;
|
||||
}
|
||||
if (!Number.isFinite(amountCents) || amountCents <= 0) {
|
||||
error.value = 'Enter a valid amount.';
|
||||
error.value = t('expenseForm.errorInvalidAmount');
|
||||
return;
|
||||
}
|
||||
if (selectedIds.value.length === 0) {
|
||||
error.value = 'Select at least one participant to split with.';
|
||||
error.value = t('expenseForm.errorSelectParticipant');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ function onSubmit() {
|
||||
<label
|
||||
for="description"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>Description</label
|
||||
>{{ t('expenseForm.descriptionLabel') }}</label
|
||||
>
|
||||
<input
|
||||
id="description"
|
||||
@@ -83,7 +85,7 @@ function onSubmit() {
|
||||
type="text"
|
||||
required
|
||||
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
placeholder="Dinner, taxi, groceries…"
|
||||
:placeholder="t('expenseForm.descriptionPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -92,7 +94,7 @@ function onSubmit() {
|
||||
for="amount"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>
|
||||
Amount ({{ currency }})
|
||||
{{ t('expenseForm.amountLabel', { currency }) }}
|
||||
</label>
|
||||
<input
|
||||
id="amount"
|
||||
@@ -102,7 +104,7 @@ function onSubmit() {
|
||||
min="0.01"
|
||||
required
|
||||
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
placeholder="0.00"
|
||||
:placeholder="t('expenseForm.amountPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -110,7 +112,7 @@ function onSubmit() {
|
||||
<label
|
||||
for="payer"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>Paid by</label
|
||||
>{{ t('expenseForm.paidByLabel') }}</label
|
||||
>
|
||||
<select
|
||||
id="payer"
|
||||
@@ -128,8 +130,9 @@ function onSubmit() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>Split equally among</span
|
||||
<span
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>{{ t('expenseForm.splitEquallyLabel') }}</span
|
||||
>
|
||||
<div class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
@@ -159,13 +162,15 @@ function onSubmit() {
|
||||
class="flex-1 rounded-xl border border-stone-300 px-4 py-2 font-medium text-stone-700 dark:border-stone-700 dark:text-stone-300"
|
||||
@click="emit('cancel')"
|
||||
>
|
||||
Cancel
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="flex-1 rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600"
|
||||
>
|
||||
{{ editing ? 'Save changes' : 'Add expense' }}
|
||||
{{
|
||||
editing ? t('expenseForm.saveChanges') : t('expenseForm.addExpense')
|
||||
}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -12,6 +12,7 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{ settled: []; updated: [] }>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const { lastLink, rememberLink } = usePaymentLinkCache();
|
||||
|
||||
const showSettlements = ref(false);
|
||||
@@ -22,7 +23,9 @@ const editError = ref('');
|
||||
const savingLink = ref(false);
|
||||
|
||||
function nameOf(id: number) {
|
||||
return props.participants.find((p) => p.id === id)?.name ?? 'Unknown';
|
||||
return (
|
||||
props.participants.find((p) => p.id === id)?.name ?? t('common.unknown')
|
||||
);
|
||||
}
|
||||
|
||||
function paymentLinkOf(id: number) {
|
||||
@@ -51,7 +54,7 @@ function cancelEdit() {
|
||||
async function saveEdit(participant: ParticipantView) {
|
||||
const trimmed = editValue.value.trim();
|
||||
if (trimmed && !isValidPaymentLink(trimmed)) {
|
||||
editError.value = 'Enter a valid link starting with http:// or https://.';
|
||||
editError.value = t('balances.invalidLink');
|
||||
return;
|
||||
}
|
||||
savingLink.value = true;
|
||||
@@ -93,7 +96,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
v-if="participants.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"
|
||||
>
|
||||
No one's in this Pot yet. Add people from the settings page.
|
||||
{{ t('balances.empty') }}
|
||||
</p>
|
||||
|
||||
<ul v-else class="space-y-2">
|
||||
@@ -131,7 +134,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
class="text-xs font-medium text-orange-600 hover:underline dark:text-orange-400"
|
||||
@click.stop
|
||||
>
|
||||
Payment link
|
||||
{{ t('balances.paymentLink') }}
|
||||
</a>
|
||||
<span
|
||||
class="text-sm font-semibold"
|
||||
@@ -145,7 +148,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
}"
|
||||
>
|
||||
<template v-if="(netBalances[participant.id] ?? 0) === 0">
|
||||
settled up
|
||||
{{ t('balances.settledUp') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ (netBalances[participant.id] ?? 0) > 0 ? '+' : '−'
|
||||
@@ -167,13 +170,13 @@ async function markSettled(settlement: SettlementView) {
|
||||
<label
|
||||
class="block text-xs font-medium text-stone-500 dark:text-stone-400"
|
||||
>
|
||||
Payment link for {{ participant.name }}
|
||||
{{ t('balances.paymentLinkLabelFor', { name: participant.name }) }}
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<input
|
||||
v-model="editValue"
|
||||
type="url"
|
||||
placeholder="https://paypal.me/yourname"
|
||||
:placeholder="t('balances.paymentLinkPlaceholder')"
|
||||
class="block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-sm text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
@keyup.enter="saveEdit(participant)"
|
||||
/>
|
||||
@@ -183,14 +186,14 @@ async function markSettled(settlement: SettlementView) {
|
||||
class="shrink-0 rounded-xl bg-orange-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-orange-600 disabled:opacity-50"
|
||||
@click="saveEdit(participant)"
|
||||
>
|
||||
{{ savingLink ? 'Saving…' : 'Save' }}
|
||||
{{ savingLink ? t('common.saving') : t('common.save') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-xl border border-stone-300 px-3 py-2 text-sm font-medium text-stone-600 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-300 dark:hover:border-orange-700 dark:hover:text-orange-400"
|
||||
@click="cancelEdit"
|
||||
>
|
||||
Cancel
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="editError" class="text-xs text-rose-600 dark:text-rose-400">
|
||||
@@ -206,7 +209,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
class="flex w-full items-center justify-between gap-2 text-sm font-medium text-orange-600 dark:text-orange-400"
|
||||
@click="showSettlements = !showSettlements"
|
||||
>
|
||||
<span>Suggested payments</span>
|
||||
<span>{{ t('balances.suggestedPayments') }}</span>
|
||||
<svg
|
||||
class="h-4 w-4 shrink-0 transition-transform"
|
||||
:class="{ 'rotate-180': showSettlements }"
|
||||
@@ -225,7 +228,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
v-if="showSettlements && settlements.length === 0"
|
||||
class="text-sm text-stone-500 dark:text-stone-400"
|
||||
>
|
||||
Everyone is settled up.
|
||||
{{ t('balances.allSettled') }}
|
||||
</p>
|
||||
<ul v-else-if="showSettlements" class="space-y-2">
|
||||
<li
|
||||
@@ -283,7 +286,7 @@ async function markSettled(settlement: SettlementView) {
|
||||
rel="noopener noreferrer"
|
||||
class="rounded-full border border-orange-300 px-3 py-1 text-xs font-medium text-orange-700 transition-colors hover:bg-white dark:border-orange-800 dark:text-orange-300 dark:hover:bg-stone-900"
|
||||
>
|
||||
Pay now
|
||||
{{ t('balances.payNow') }}
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
@@ -292,7 +295,9 @@ async function markSettled(settlement: SettlementView) {
|
||||
@click="markSettled(settlement)"
|
||||
>
|
||||
{{
|
||||
settlingKey === keyOf(settlement) ? 'Marking…' : 'Mark as paid'
|
||||
settlingKey === keyOf(settlement)
|
||||
? t('balances.marking')
|
||||
: t('balances.markAsPaid')
|
||||
}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -12,14 +12,22 @@ const emit = defineEmits<{
|
||||
remove: [id: number];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const expandedId = ref<number | null>(null);
|
||||
|
||||
function nameOf(id: number) {
|
||||
return props.participants.find((p) => p.id === id)?.name ?? 'Unknown';
|
||||
return (
|
||||
props.participants.find((p) => p.id === id)?.name ?? t('common.unknown')
|
||||
);
|
||||
}
|
||||
|
||||
function namesOf(ids: number[]) {
|
||||
return ids.map(nameOf).join(', ');
|
||||
function splitOf(expense: ExpenseView) {
|
||||
const shares = computeSplit(expense.amountCents, expense.participantIds);
|
||||
return expense.participantIds.map((id) => ({
|
||||
id,
|
||||
name: nameOf(id),
|
||||
amountCents: shares[id]!,
|
||||
}));
|
||||
}
|
||||
|
||||
function toggle(id: number) {
|
||||
@@ -37,7 +45,7 @@ const sorted = computed(() =>
|
||||
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"
|
||||
>
|
||||
No expenses yet. Add the first one below.
|
||||
{{ t('expenses.empty') }}
|
||||
</p>
|
||||
|
||||
<div
|
||||
@@ -73,8 +81,12 @@ const sorted = computed(() =>
|
||||
<p
|
||||
class="truncate font-medium text-emerald-800 dark:text-emerald-300"
|
||||
>
|
||||
{{ nameOf(expense.payerId) }} paid
|
||||
{{ nameOf(expense.participantIds[0]!) }}
|
||||
{{
|
||||
t('expenses.paymentDescription', {
|
||||
payer: nameOf(expense.payerId),
|
||||
recipient: nameOf(expense.participantIds[0]!),
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
<div v-else class="min-w-0">
|
||||
@@ -82,7 +94,7 @@ const sorted = computed(() =>
|
||||
{{ expense.description }}
|
||||
</p>
|
||||
<p class="text-sm text-stone-500 dark:text-stone-400">
|
||||
paid by {{ nameOf(expense.payerId) }}
|
||||
{{ t('expenses.paidBy', { name: nameOf(expense.payerId) }) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
@@ -120,12 +132,19 @@ const sorted = computed(() =>
|
||||
: 'border-stone-100 dark:border-stone-800'
|
||||
"
|
||||
>
|
||||
<p
|
||||
<ul
|
||||
v-if="expense.type === 'expense'"
|
||||
class="text-xs text-stone-400 dark:text-stone-500"
|
||||
class="space-y-1 text-xs text-stone-400 dark:text-stone-500"
|
||||
>
|
||||
split among {{ namesOf(expense.participantIds) }}
|
||||
</p>
|
||||
<li
|
||||
v-for="share in splitOf(expense)"
|
||||
:key="share.id"
|
||||
class="flex justify-between gap-2"
|
||||
>
|
||||
<span>{{ share.name }}</span>
|
||||
<span>{{ formatCurrency(share.amountCents, currency) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="flex gap-3">
|
||||
<button
|
||||
v-if="expense.type === 'expense'"
|
||||
@@ -133,14 +152,14 @@ const sorted = computed(() =>
|
||||
class="text-sm font-medium text-orange-600 dark:text-orange-400"
|
||||
@click="emit('edit', expense)"
|
||||
>
|
||||
Edit
|
||||
{{ t('expenses.edit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm font-medium text-rose-600 dark:text-rose-400"
|
||||
@click="emit('remove', expense.id)"
|
||||
>
|
||||
Delete
|
||||
{{ t('expenses.delete') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{ title?: string; buttonLabel?: string }>();
|
||||
const emit = defineEmits<{ submit: [name: string] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const name = ref('');
|
||||
|
||||
@@ -17,7 +18,7 @@ function onSubmit() {
|
||||
for="name"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>
|
||||
{{ props.title ?? "What's your name?" }}
|
||||
{{ props.title ?? t('nameForm.defaultTitle') }}
|
||||
</label>
|
||||
<input
|
||||
id="name"
|
||||
@@ -26,14 +27,14 @@ function onSubmit() {
|
||||
autocomplete="name"
|
||||
required
|
||||
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-900 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
placeholder="Your name"
|
||||
:placeholder="t('nameForm.placeholder')"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600"
|
||||
>
|
||||
{{ props.buttonLabel ?? 'Continue' }}
|
||||
{{ props.buttonLabel ?? t('nameForm.continue') }}
|
||||
</button>
|
||||
</form>
|
||||
</template>
|
||||
+10
-9
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n();
|
||||
const { name, setName } = useIdentity();
|
||||
const { pots: visitedPots } = useVisitedPots();
|
||||
|
||||
@@ -24,7 +25,7 @@ async function createPot() {
|
||||
});
|
||||
await navigateTo(`/p/${pot.slug}/setup`);
|
||||
} catch {
|
||||
error.value = 'Could not create the Pot. Please try again.';
|
||||
error.value = t('home.createError');
|
||||
} finally {
|
||||
creating.value = false;
|
||||
}
|
||||
@@ -36,16 +37,16 @@ async function createPot() {
|
||||
<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">
|
||||
Splitt the Bill
|
||||
{{ t('home.title') }}
|
||||
</h1>
|
||||
<p class="text-sm text-stone-500 dark:text-stone-400">
|
||||
Track shared costs with friends, the easy way.
|
||||
{{ t('home.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<section v-if="visitedPots.length" class="space-y-2">
|
||||
<h2 class="text-sm font-semibold text-stone-500 dark:text-stone-400">
|
||||
Your Pots
|
||||
{{ t('home.yourPots') }}
|
||||
</h2>
|
||||
<ul class="space-y-2">
|
||||
<li v-for="pot in visitedPots" :key="pot.slug">
|
||||
@@ -73,14 +74,14 @@ async function createPot() {
|
||||
@submit.prevent="createPot"
|
||||
>
|
||||
<p class="text-sm text-stone-600 dark:text-stone-400">
|
||||
Hi {{ name }}! Create a new Pot to start splitting costs.
|
||||
{{ t('home.greeting', { name }) }}
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<label
|
||||
for="pot-name"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>Pot name</label
|
||||
>{{ t('home.potNameLabel') }}</label
|
||||
>
|
||||
<input
|
||||
id="pot-name"
|
||||
@@ -88,7 +89,7 @@ async function createPot() {
|
||||
type="text"
|
||||
required
|
||||
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
placeholder="Weekend in Lisbon"
|
||||
:placeholder="t('home.potNamePlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -96,7 +97,7 @@ async function createPot() {
|
||||
<label
|
||||
for="currency"
|
||||
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
|
||||
>Currency</label
|
||||
>{{ t('home.currencyLabel') }}</label
|
||||
>
|
||||
<select
|
||||
id="currency"
|
||||
@@ -118,7 +119,7 @@ async function createPot() {
|
||||
:disabled="creating"
|
||||
class="w-full rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600 disabled:opacity-50"
|
||||
>
|
||||
{{ creating ? 'Creating…' : 'Create Pot' }}
|
||||
{{ creating ? t('home.creating') : t('home.createPot') }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
+11
-10
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { PotView } from '~/types';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const slug = route.params.slug as string;
|
||||
const { name, setName } = useIdentity();
|
||||
@@ -53,15 +54,15 @@ async function copyLink() {
|
||||
|
||||
<template>
|
||||
<div v-if="error" class="space-y-3 text-center">
|
||||
<p class="text-rose-600 dark:text-rose-400">This Pot couldn't be found.</p>
|
||||
<p class="text-rose-600 dark:text-rose-400">{{ t('pot.notFound') }}</p>
|
||||
<NuxtLink to="/" class="font-medium text-orange-600 dark:text-orange-400">
|
||||
Go home
|
||||
{{ t('pot.goHome') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
<NameForm
|
||||
v-else-if="!name && isPotTab"
|
||||
title="What's your name?"
|
||||
:title="t('pot.whatIsYourName')"
|
||||
@submit="setName"
|
||||
/>
|
||||
|
||||
@@ -78,7 +79,7 @@ async function copyLink() {
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
All Pots
|
||||
{{ t('pot.allPots') }}
|
||||
</NuxtLink>
|
||||
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
@@ -96,12 +97,12 @@ async function copyLink() {
|
||||
class="rounded-xl border border-stone-300 px-3 py-1.5 text-sm font-medium text-stone-700 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-300 dark:hover:border-orange-700 dark:hover:text-orange-400"
|
||||
@click="copyLink"
|
||||
>
|
||||
{{ linkCopied ? 'Copied!' : 'Copy link' }}
|
||||
{{ linkCopied ? t('pot.linkCopied') : t('pot.copyLink') }}
|
||||
</button>
|
||||
<NuxtLink
|
||||
:to="`/p/${slug}/settings`"
|
||||
class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-stone-300 text-stone-600 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-300 dark:hover:border-orange-700 dark:hover:text-orange-400"
|
||||
aria-label="Pot settings"
|
||||
:aria-label="t('pot.settingsLabel')"
|
||||
>
|
||||
<svg class="h-4.5 w-4.5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path
|
||||
@@ -119,14 +120,14 @@ async function copyLink() {
|
||||
class="rounded-2xl border border-orange-200 bg-orange-50 p-4 text-sm dark:border-orange-900 dark:bg-orange-950/40"
|
||||
>
|
||||
<p class="mb-2 text-stone-700 dark:text-stone-300">
|
||||
You're not in this Pot's participant list yet.
|
||||
{{ t('pot.notInPot') }}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-orange-500 px-3 py-1.5 font-medium text-white shadow-sm transition-colors hover:bg-orange-600"
|
||||
@click="addMyself"
|
||||
>
|
||||
Add myself as {{ name }}
|
||||
{{ t('pot.addMyself', { name }) }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -142,7 +143,7 @@ async function copyLink() {
|
||||
: 'text-stone-500 hover:text-stone-700 dark:text-stone-400 dark:hover:text-stone-200'
|
||||
"
|
||||
>
|
||||
People & balances
|
||||
{{ t('pot.tabPeople') }}
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
:to="`/p/${slug}/expenses`"
|
||||
@@ -153,7 +154,7 @@ async function copyLink() {
|
||||
: 'text-stone-500 hover:text-stone-700 dark:text-stone-400 dark:hover:text-stone-200'
|
||||
"
|
||||
>
|
||||
Expenses
|
||||
{{ t('pot.tabExpenses') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { ExpenseView, PotView } from '~/types';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const slug = route.params.slug as string;
|
||||
const { name } = useIdentity();
|
||||
@@ -55,7 +56,7 @@ function cancelExpenseForm() {
|
||||
}
|
||||
|
||||
async function removeExpense(id: number) {
|
||||
if (!confirm('Delete this expense?')) return;
|
||||
if (!confirm(t('expenses.deleteConfirm'))) return;
|
||||
await $fetch(`/api/pots/${slug}/expenses/${id}`, { method: 'DELETE' });
|
||||
await refresh();
|
||||
}
|
||||
@@ -88,7 +89,7 @@ async function removeExpense(id: number) {
|
||||
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"
|
||||
>
|
||||
+ Add expense
|
||||
{{ t('expenses.addExpense') }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { PotView } from '~/types';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const slug = route.params.slug as string;
|
||||
|
||||
@@ -25,7 +26,7 @@ async function addParticipant(participantName: string) {
|
||||
}
|
||||
|
||||
async function removeParticipant(participant: { id: number; name: string }) {
|
||||
if (!confirm(`Remove ${participant.name} from this Pot?`)) return;
|
||||
if (!confirm(t('settings.removeConfirm', { name: participant.name }))) return;
|
||||
|
||||
removeError.value = '';
|
||||
removingId.value = participant.id;
|
||||
@@ -35,7 +36,7 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
});
|
||||
await refresh();
|
||||
} catch {
|
||||
removeError.value = `Couldn't remove ${participant.name}. They may have expenses or payments recorded.`;
|
||||
removeError.value = t('settings.removeError', { name: participant.name });
|
||||
} finally {
|
||||
removingId.value = null;
|
||||
}
|
||||
@@ -44,9 +45,9 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
|
||||
<template>
|
||||
<div v-if="error" class="space-y-3 text-center">
|
||||
<p class="text-rose-600 dark:text-rose-400">This Pot couldn't be found.</p>
|
||||
<p class="text-rose-600 dark:text-rose-400">{{ t('pot.notFound') }}</p>
|
||||
<NuxtLink to="/" class="font-medium text-orange-600 dark:text-orange-400">
|
||||
Go home
|
||||
{{ t('pot.goHome') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
@@ -55,7 +56,7 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
<NuxtLink
|
||||
:to="`/p/${slug}`"
|
||||
class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-stone-300 text-stone-600 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-300 dark:hover:border-orange-700 dark:hover:text-orange-400"
|
||||
aria-label="Back to Pot"
|
||||
:aria-label="t('settings.backToPot')"
|
||||
>
|
||||
<svg class="h-4.5 w-4.5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path
|
||||
@@ -67,7 +68,7 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
</NuxtLink>
|
||||
<div>
|
||||
<h1 class="text-lg font-bold text-stone-900 dark:text-stone-100">
|
||||
Pot settings
|
||||
{{ t('settings.title') }}
|
||||
</h1>
|
||||
<p class="text-sm text-stone-500 dark:text-stone-400">
|
||||
{{ data.pot.name }} · {{ data.pot.currency }}
|
||||
@@ -79,7 +80,7 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
<h2
|
||||
class="text-sm font-semibold uppercase tracking-wide text-stone-500 dark:text-stone-400"
|
||||
>
|
||||
Participants
|
||||
{{ t('settings.participants') }}
|
||||
</h2>
|
||||
<ul class="space-y-2">
|
||||
<li
|
||||
@@ -102,14 +103,18 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
class="shrink-0 text-sm font-medium text-rose-600 disabled:opacity-50 dark:text-rose-400"
|
||||
@click="removeParticipant(participant)"
|
||||
>
|
||||
{{ removingId === participant.id ? 'Removing…' : 'Remove' }}
|
||||
{{
|
||||
removingId === participant.id
|
||||
? t('settings.removing')
|
||||
: t('settings.remove')
|
||||
}}
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
v-if="data.participants.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"
|
||||
>
|
||||
No one's in this Pot yet.
|
||||
{{ t('settings.noParticipants') }}
|
||||
</li>
|
||||
</ul>
|
||||
<p v-if="removeError" class="text-sm text-rose-600 dark:text-rose-400">
|
||||
@@ -123,11 +128,11 @@ async function removeParticipant(participant: { id: number; name: string }) {
|
||||
<h2
|
||||
class="text-sm font-semibold uppercase tracking-wide text-stone-500 dark:text-stone-400"
|
||||
>
|
||||
Add a participant
|
||||
{{ t('settings.addParticipant') }}
|
||||
</h2>
|
||||
<NameForm
|
||||
title="Name"
|
||||
:button-label="adding ? 'Adding…' : 'Add'"
|
||||
:title="t('settings.nameLabel')"
|
||||
:button-label="adding ? t('settings.adding') : t('settings.add')"
|
||||
@submit="addParticipant"
|
||||
/>
|
||||
</section>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const slug = route.params.slug as string;
|
||||
|
||||
@@ -34,10 +35,10 @@ function skip() {
|
||||
<div class="space-y-1 text-center">
|
||||
<div class="text-3xl">👋</div>
|
||||
<h1 class="text-xl font-bold text-stone-900 dark:text-stone-100">
|
||||
Add the rest of the group
|
||||
{{ t('setup.title') }}
|
||||
</h1>
|
||||
<p class="text-sm text-stone-500 dark:text-stone-400">
|
||||
Add everyone else's name now, or skip and add them later from settings.
|
||||
{{ t('setup.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +49,7 @@ function skip() {
|
||||
v-model="names[index]"
|
||||
type="text"
|
||||
class="block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-900 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
|
||||
placeholder="Participant name"
|
||||
:placeholder="t('setup.placeholder')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -57,7 +58,7 @@ function skip() {
|
||||
class="w-full rounded-xl border border-dashed border-stone-300 px-4 py-2 text-sm font-medium text-stone-600 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-400 dark:hover:border-orange-700 dark:hover:text-orange-400"
|
||||
@click="addRow"
|
||||
>
|
||||
+ Add another
|
||||
{{ t('setup.addAnother') }}
|
||||
</button>
|
||||
|
||||
<div class="flex gap-3">
|
||||
@@ -66,7 +67,7 @@ function skip() {
|
||||
class="flex-1 rounded-xl border border-stone-300 px-4 py-2 font-medium text-stone-700 dark:border-stone-700 dark:text-stone-300"
|
||||
@click="skip"
|
||||
>
|
||||
Skip
|
||||
{{ t('setup.skip') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -74,7 +75,7 @@ function skip() {
|
||||
class="flex-1 rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600 disabled:opacity-50"
|
||||
@click="continueToPot"
|
||||
>
|
||||
{{ saving ? 'Saving…' : 'Continue' }}
|
||||
{{ saving ? t('setup.saving') : t('setup.continue') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user