Open source personal finance application
feat: add back navigation to category and wallet pages
Ilya Komicheva9db1d084c5f
diff --git a/app/components/categories/page/id/Edit.vue b/app/components/categories/page/id/Edit.vueindex 6b16b610..c7ce0521 100644--- a/app/components/categories/page/id/Edit.vue+++ b/app/components/categories/page/id/Edit.vue@@ -23,7 +23,7 @@ useHead({v-if="category"class="flex h-full flex-col">- <UiHeader>+ <UiHeader :backTo="`/categories/${categoryId}`"><UiHeaderTitle>{{ t('base.edit') }} : {{ category.name }}</UiHeaderTitle></UiHeader>diff --git a/app/components/categories/page/id/Index.vue b/app/components/categories/page/id/Index.vueindex e02f69ed..5365bd1e 100644--- a/app/components/categories/page/id/Index.vue+++ b/app/components/categories/page/id/Index.vue@@ -187,6 +187,7 @@ const categoriesIds = computed(() => categoriesStore.getChildrenIds(categoryId.v<UiPage v-if="category"><StatHeaderv-model:activeTab="activeTab"+ :backTo="category.parentId ? `/categories/${category.parentId}` : '/categories'"filterWallets><template #title>diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vueindex bd39d284..86f342fa 100644--- a/app/components/stat/Header.vue+++ b/app/components/stat/Header.vue@@ -7,6 +7,7 @@ import { useTrnsFormStore } from '~/components/trnForm/useTrnsFormStore'import { useWalletsStore } from '~/components/wallets/useWalletsStore'defineProps<{+ backTo?: stringconfigWallets?: booleanfilterCategories?: booleanfilterWallets?: boolean@@ -36,7 +37,7 @@ const isPopoverOpen = ref(false)</script><template>- <UiHeader>+ <UiHeader :backTo="backTo"><slot name="title" /><template #actions>diff --git a/app/components/ui/Header.vue b/app/components/ui/Header.vueindex 0541dc00..f9502163 100644--- a/app/components/ui/Header.vue+++ b/app/components/ui/Header.vue@@ -1,6 +1,10 @@<script setup lang="ts">import { useSearch } from '~/components/search/useSearch'+const { backTo } = defineProps<{+ backTo?: string+}>()+const { isSearchOpen } = useSearch()</script>@@ -8,9 +12,19 @@ const { isSearchOpen } = useSearch()<div class="bg-default/90 sticky top-0 z-20 mb-2 backdrop-blur"><div class="border-item-4 grid min-h-12 max-w-7xl items-center border-b px-2 py-2 lg:px-4 lg:py-4"><div class="flex grow items-center gap-2">- <slot />+ <NuxtLink+ v-if="backTo"+ :to="backTo"+ class="interactive text-muted flex min-h-[42px] min-w-[42px] shrink-0 cursor-default items-center justify-center rounded-sm text-xl"+ >+ <Icon name="lucide:arrow-left" size="20" />+ </NuxtLink>++ <div class="min-w-0 overflow-x-auto">+ <slot />+ </div>- <div class="ml-auto flex items-center gap-1">+ <div class="ml-auto flex shrink-0 items-center gap-1"><UTooltip:text="$t('search.title')":kbds="['meta', 'K']"diff --git a/app/components/ui/HeaderTitle.vue b/app/components/ui/HeaderTitle.vueindex f0626443..295b9cf6 100644--- a/app/components/ui/HeaderTitle.vue+++ b/app/components/ui/HeaderTitle.vue@@ -1,7 +1,7 @@<template><divclass="- font-tertiary flex grow items-center gap-2 px-1 pl-2 text-lg leading-none font-semibold tracking-wide+ font-tertiary flex grow items-center gap-2 overflow-x-auto px-1 pl-2 text-lg leading-none font-semibold tracking-widetext-(--ui-text-highlighted) @lg:text-xl">diff --git a/app/components/wallets/page/id/Edit.vue b/app/components/wallets/page/id/Edit.vueindex 16df66ad..a47baaf7 100644--- a/app/components/wallets/page/id/Edit.vue+++ b/app/components/wallets/page/id/Edit.vue@@ -31,7 +31,7 @@ useHead({ title: `${t('base.edit')}: ${walletForm.value?.name || t('wallets.formv-if="wallet && walletForm"class="flex h-full flex-col">- <UiHeader>+ <UiHeader :backTo="`/wallets/${walletId}`"><UiHeaderTitle>{{ t('base.edit') }}:{{ walletForm.name ? walletForm.name : t('wallets.form.name.label') }}diff --git a/app/components/wallets/page/id/Index.vue b/app/components/wallets/page/id/Index.vueindex 4ec3316a..ac5f669c 100644--- a/app/components/wallets/page/id/Index.vue+++ b/app/components/wallets/page/id/Index.vue@@ -113,6 +113,7 @@ async function onDeleteConfirm() {<UiPage v-if="wallet"><StatHeaderv-model:activeTab="activeTab"+ backTo="/wallets"filterCategories><template #title>