Open source personal finance application
ui: update
ilkome79c33affab08
diff --git a/components/amount/Amount.vue b/components/amount/Amount.vueindex b484ae0e..1768468a 100644--- a/components/amount/Amount.vue+++ b/components/amount/Amount.vue@@ -72,16 +72,16 @@ export default {<template lang="pug">.amount(:class="className")- .amountItem._original(:class="className")+ .amountItem._original.flex.items-baseline(:class="className").amountItem__prefix(v-if="isShowPrefix && value !== 0") {{ type === 0 ? '-' : '+' }}- .amountItem__value {{ formatAmount(value) }}- .amountItem__symbol {{ getCurrencySymbol(currency) }}+ .amountItem__value.leading-none {{ formatAmount(value) }}+ .amountItem__symbol.leading-none {{ getCurrencySymbol(currency) }}template(v-if="showBase && (value !== 0) && (currency !== $store.state.currencies.base)")- .amountItem._base(:class="className")+ .amountItem._base.pt-1.flex.items-baseline(:class="className").amountItem__prefix(v-if="isShowPrefix && value !== 0") {{ type === 0 ? '-' : '+' }}- .amountItem__value {{ amountInBaseCurrency }}- .amountItem__symbol {{ getCurrencySymbol($store.state.currencies.base) }}+ .amountItem__value.leading-none {{ amountInBaseCurrency }}+ .amountItem__symbol.leading-none {{ getCurrencySymbol($store.state.currencies.base) }}</template><style lang="stylus" scoped>@@ -136,7 +136,6 @@ export default {.amountItemdisplay flex- align-items flex-endjustify-content flex-end&._left@@ -178,7 +177,7 @@ export default {&__valuefont-secondary()- font-size 14px+ font-size 16pxfont-weight 400~/._base &@@ -206,8 +205,7 @@ export default {font-weight 400~/._original &- padding-bottom 1px- font-size 12px+ font-size 11px~/._base &font-size 10pxdiff --git a/components/amount/Amount3.vue b/components/amount/Amount3.vueindex 200f9425..af656012 100644--- a/components/amount/Amount3.vue+++ b/components/amount/Amount3.vue@@ -18,5 +18,5 @@ const amount = computed(() =></script><template lang="pug">-span.whitespace-nowrap {{ amount }}+span.whitespace-nowrap.font-unica {{ amount }}</template>diff --git a/components/trnForm/TrnFormTrns.vue b/components/trnForm/TrnFormTrns.vueindex c37c3f71..9018cd07 100644--- a/components/trnForm/TrnFormTrns.vue+++ b/components/trnForm/TrnFormTrns.vue@@ -107,7 +107,7 @@ export default defineComponent({.pt-5.subTitle.text-center.pb-1.text-xs {{ $t('trns.history') }}- .mx-3.my-2.overflow-hidden.rounded-md.bg-dark4(+ .overflow-hidden.mx-3.my-2.rounded-md.bg-gray-50.dark_bg-dark4(v-for="(trnsIds, date) in groupedTrns":key="date")diff --git a/components/trns/item/History.vue b/components/trns/item/History.vueindex 71893fe2..16510b51 100644--- a/components/trns/item/History.vue+++ b/components/trns/item/History.vue@@ -59,8 +59,7 @@ export default defineComponent({</script><template lang="pug">-.space-x-3.flex.cursor-context-menu(- class="hocus_bg-neutral-100 dark_hocus_bg-neutral-800"+.space-x-3.flex.cursor-context-menu.hocus_bg-neutral-100.dark_hocus_bg-neutral-800(@click="actions.onOpenDetails").text-neutral-50.text-xl.leading-none.w-8.h-8.rounded-full.justify-center.items-center.flex(diff --git a/components/trns/types.ts b/components/trns/types.tsindex b4298fea..e58a52bf 100644--- a/components/trns/types.ts+++ b/components/trns/types.ts@@ -10,7 +10,7 @@ export enum TrnType {}// TODO: make WalletId optional only if TrnType.Transfer-export interface TrnTransaction{+export interface TrnTransaction {amount: numbertype: TrnType.Income | TrnType.ExpensecategoryId: CategoryID@@ -18,7 +18,7 @@ export interface TrnTransaction{date: number}-export interface TrnTransfer{+export interface TrnTransfer {type: TrnType.Transferdate: numbercategoryId: 'transfer'diff --git a/components/wallets/form/WalletForm.vue b/components/wallets/form/WalletForm.vueindex 75020d39..74c04113 100644--- a/components/wallets/form/WalletForm.vue+++ b/components/wallets/form/WalletForm.vue@@ -127,7 +127,7 @@ export default {<template lang="pug">.h-full.overflow.overflow-x-auto- .mb-2.py-10.pt-12.px-3.text-center.text-neutral-800.dark_text-white.text-2xl.font-semibold.font-nunito+ .pb-4.text-neutral-800.dark_text-white.text-2xl.font-semibold.font-nunitotemplate(v-if="!walletId") {{ $t('wallets.createNewTitle') }}template(v-else) {{ $t('wallets.editTitle') }}@@ -169,7 +169,7 @@ export default {@onClick="wallet.isCredit = !wallet.isCredit")- .col(style="padding-top: 16px")+ .pt-6SharedButton(:class="['_text-center _blue2', { _inline: $store.state.ui.pc }]":title="$t('wallets.form.save')"diff --git a/components/wallets/pages/List.vue b/components/wallets/pages/List.vuenew file mode 100644index 00000000..fa1ea6c8--- /dev/null+++ b/components/wallets/pages/List.vue@@ -0,0 +1,87 @@+<script setup lang="ts">+import useWallets from '~/components/wallets/useWallets'++const { walletsIdsSorted, walletsItemsSorted } = useWallets()+console.log(walletsItemsSorted)+</script>++<script lang="ts">+export default defineComponent({+ head() {+ return {+ title: this.$t('wallets.title'),+ }+ },+})+</script>++<template lang="pug">+.h-full.overflow.overflow-x-auto+ .max-w-3xl+ .flex+ .grow.py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold+ | {{ $t('wallets.name') }}++ .flex-center.gap-3.pr-3+ //- Sort+ .cursor-pointer.bg.rounded-full.w-10.h-10.flex-center.hocus-text-white.hocus_bg-blue2(+ @click="$store.dispatch('ui/setActiveTab', 'walletsSort')"+ )+ svg.w-6.h-6(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24")+ path(fill="currentColor" d="M7 20h2V8h3L8 4L4 8h3zm13-4h-3V4h-2v12h-3l4 4z")++ //- Add+ .cursor-pointer.bg.rounded-full.w-10.h-10.flex-center.hocus-text-white.hocus_bg-blue2(+ @click="$store.dispatch('ui/setActiveTab', 'createWallet')"+ )+ svg.w-6.h-6(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12")+ path(fill="currentColor" d="M6 1.5a.5.5 0 0 0-1 0V5H1.5a.5.5 0 0 0 0 1H5v3.5a.5.5 0 0 0 1 0V6h3.5a.5.5 0 0 0 0-1H6V1.5Z")++ .pb-6.px-3+ WalletsTotalAlt(+ isShowCredits+ isShowSavings+ )++ .flex.pt-4(v-if="$store.getters['user/isTester']")+ .cursor-pointer.p-1.px-3.flex.items-center.gap-3.bg-gray-50.dark_bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(+ class="dark_text-white/60"+ @click="$router.push('/wallets/total')"+ )+ .mdi.mdi-poll.text-xl+ .text-xs.leading-none Total+ .mdi.mdi-chevron-right.opacity-70.text-lg.leading-none++ .pb-12.px-3.grid.gap-y-1.gap-x-6.lg_grid-cols-2+ .bg.cursor-pointer.py-3.px-3.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800(+ v-for="(walletItem, walletId) in walletsItemsSorted"+ :key="walletId"+ @click="$router.push(`/wallets/${walletId}`)"+ )+ .gap-x-3.flex.items-center+ .grow.flex-center.gap-x-3+ .w-6.h-6.rounded-md.flex-center.text-neutral-50.text-xs.leading-none(+ :style="{ background: walletItem.color }"+ class="mt-[2px]"+ ) {{ walletItem.name.substring(0, 2) }}+ .grow.text-sm.text-neutral-500(class="dark_text-neutral-400") {{ walletItem.name }}++ Amount(+ :currency="walletItem.currency"+ :value="walletItem.amount"+ alwaysShowSymbol+ showBase+ vertical="right"+ )++ .pb-4.px-3.flex.gap-4+ //- Create+ .button(@click="$store.dispatch('ui/setActiveTab', 'createWallet')") {{ $t('wallets.new') }}+ //- Sort+ .button(@click="$store.dispatch('ui/setActiveTab', 'walletsSort')") {{ $t('base.sort') }}+</template>++<style lang="stylus" scoped>+.bg+ background var(--c-item-bg-main)+</style>diff --git a/components/wallets/sort/WalletsSort.vue b/components/wallets/sort/WalletsSort.vueindex 7d053ae9..745dc8e9 100644--- a/components/wallets/sort/WalletsSort.vue+++ b/components/wallets/sort/WalletsSort.vue@@ -7,7 +7,7 @@ export default {data() {return {- sortedWalletsIds: this.$store.getters['wallets/walletsSortedIds'],+ sortedWalletsIds: [...this.$store.getters['wallets/walletsSortedIds']],}},@@ -39,28 +39,37 @@ export default {<template lang="pug">.h-full.overflow.overflow-x-auto- .mb-2.py-10.pt-12.px-3.text-center.text-neutral-800.dark_text-white.text-2xl.font-semibold.font-nunito- | {{ $t('wallets.sortTitle') }}-- WalletsList2(- :style="{ paddingTop: '10px' }"- v-slot="{ wallets }")- Draggable(- v-model="sortedWalletsIds"- handle=".handle"- ghost-class="_draggable"- )- template(v-for="walletId in sortedWalletsIds")- .walletItem2(:key="walletId")- .walletItem2__icon.handle- Icon(- :abbr="$store.state.wallets.items[walletId].name"- :background="$store.state.wallets.items[walletId].color || $store.state.ui.defaultBgColor")-- .walletItem2__name {{ $store.state.wallets.items[walletId].name }}- .walletItem2__drag.handle.doNotCloseModal: .mdi.mdi-drag-horizontal-variant+ .pb-8.flex.justify-between+ .text-neutral-800.dark_text-white.text-2xl.font-semibold.font-nunito+ | {{ $t('wallets.sortTitle') }}- .col+ .cursor-pointer.text-white.bg-blue2.rounded-full.w-10.h-10.flex-center.hocus-text-white.hocus_bg-blue1(+ @click="saveWalletsOrder"+ )+ svg.w-6.h-6(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16")+ path(fill="currentColor" d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06a.733.733 0 0 1 1.047 0l3.052 3.093l5.4-6.425a.247.247 0 0 1 .02-.022Z")++ Draggable.grid.gap-1(+ v-model="sortedWalletsIds"+ handle=".handle"+ ghost-class="_draggable"+ )+ .overflow-hidden.flex.items-center.gap-3.bg.py-0.pl-3.rounded-md(+ v-for="walletId in sortedWalletsIds"+ :key="walletId"+ )+ .grow.flex-center.gap-x-3+ .w-6.h-6.rounded-md.flex-center.text-neutral-50.text-xs.leading-none(+ :style="{ background: $store.state.wallets.items[walletId].color }"+ class="mt-[2px]"+ ) {{ $store.state.wallets.items[walletId].name.substring(0, 2) }}+ .grow.text-sm.text-neutral-500(class="dark_text-neutral-400") {{ $store.state.wallets.items[walletId].name }}++ .cursor-grab.flex-center.w-11.h-11.handle.doNotCloseModal.hocus_bg-gray-100.dark_hocus_bg-neutral-800+ svg.w-6.h-6(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24")+ path(fill="currentColor" d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2s.9-2 2-2s2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2s-2 .9-2 2s.9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z")++ .pt-6SharedButton(className="_blue2 _text-center":title="$t('base.save')"@@ -71,6 +80,9 @@ export default {<style lang="stylus" scoped>@import "~assets/stylus/variables"+.bg+ background var(--c-item-bg-main)+item-bg-active()background var(--c-bg-6)@@ -110,17 +122,4 @@ item-icon()grid-row 1 / 3align-self centeritem-main-text()-- &__drag- cursor pointer- grid-column 3 / 4- grid-row 1 / 3- align-self center- justify-self cent- item-icon()- display flex- align-items center- justify-content center- width 40px- height 40px</style>diff --git a/components/wallets/types.ts b/components/wallets/types.tsindex 3ec4e5a3..cc5471c3 100644--- a/components/wallets/types.ts+++ b/components/wallets/types.ts@@ -5,3 +5,7 @@ export interface WalletItem {color: stringcurrency: string}++export interface WalletItemWithAmount extends WalletItem {+ amount: number+}diff --git a/components/wallets/useWallets.ts b/components/wallets/useWallets.tsnew file mode 100644index 00000000..ecfb48b2--- /dev/null+++ b/components/wallets/useWallets.ts@@ -0,0 +1,38 @@+import type { ComputedRef } from '@vue/composition-api'+import type { WalletID, WalletItemWithAmount } from '~/components/wallets/types'++export default function useWallets() {+ const { $store } = useNuxtApp()++ /**+ * Wallets IDs sorted+ *+ */+ const walletsIdsSorted: ComputedRef<WalletID[]> = computed(() => $store.getters['wallets/walletsSortedIds'])++ /**+ * Wallets items sorted+ *+ */+ const walletsItemsSorted: ComputedRef<Record<WalletID, WalletItemWithAmount>> = computed(() => {+ const walletsIdsSorted: WalletID[] = $store.getters['wallets/walletsSortedIds']+ let wallets: Record<WalletID, WalletItemWithAmount> = {}++ for (const walletId of walletsIdsSorted) {+ wallets = {+ ...wallets,+ [walletId]: {+ ...$store.state.wallets.items[walletId],+ amount: $store.getters['wallets/walletsTotal'][walletId].base,+ },+ }+ }++ return wallets+ })++ return {+ walletsIdsSorted,+ walletsItemsSorted,+ }+}diff --git a/pages/categories/index.vue b/pages/categories/index.vueindex 10e1b116..e0a52ca6 100644--- a/pages/categories/index.vue+++ b/pages/categories/index.vue@@ -23,23 +23,24 @@ export default defineComponent({.py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold| {{ $t('categories.name') }}- .pb-4- CategoriesListSlot(- :ids="catsIds"- v-slot="{ categories }"- )- .shame1.px-3- CategoriesItemCategoryItem(- v-for="category in categories"- :category="category"- :slider="() => ({})"- :id="category.id"- :key="category.id"- @onClick="id => $router.push(`/categories/${category.id}`)"- )+ .max-w-3xl+ .pb-4+ CategoriesListSlot(+ :ids="catsIds"+ v-slot="{ categories }"+ )+ .shame1.px-3+ CategoriesItemCategoryItem(+ v-for="category in categories"+ :category="category"+ :slider="() => ({})"+ :id="category.id"+ :key="category.id"+ @onClick="id => $router.push(`/categories/${category.id}`)"+ )- .pb-4.px-3.flex.gap-4.pt-4- .button(@click="$store.dispatch('ui/setActiveTab', 'createCategory')") {{ $t('categories.new') }}+ .pb-4.px-3.flex.gap-4.pt-4+ .button(@click="$store.dispatch('ui/setActiveTab', 'createCategory')") {{ $t('categories.new') }}</template><style lang="stylus" scoped>diff --git a/pages/wallets/index.vue b/pages/wallets/index.vueindex f44a8ca4..94360850 100644--- a/pages/wallets/index.vue+++ b/pages/wallets/index.vue@@ -1,31 +1,3 @@-<script lang="ts">-export default defineComponent({- head() {- return {- title: this.$t('wallets.title'),- }- },-})-</script>-<template lang="pug">-.h-full.overflow.overflow-x-auto- .py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold- | {{ $t('wallets.name') }}-- .pb-6.px-3- .flex.gap-4.justify-between.items-center- WalletsTotalAlt(- isShowCredits- isShowSavings- )-- .pb-12- WalletsList3(@onClick="id => $router.push(`/wallets/${id}`)")-- .pb-4.px-3.flex.gap-4- //- Create- .button(@click="$store.dispatch('ui/setActiveTab', 'createWallet')") {{ $t('wallets.new') }}- //- Sort- .button(@click="$store.dispatch('ui/setActiveTab', 'walletsSort')") {{ $t('base.sort') }}+WalletsPagesList</template>