Open source personal finance application
chore: refactor
ilkome29b38ebd2485
diff --git a/assets/stylus/shame.styl b/assets/stylus/shame.stylindex 3d131e08..02680957 100644--- a/assets/stylus/shame.styl+++ b/assets/stylus/shame.styl@@ -1,6 +1,3 @@-.button- button-base-1()-.form-linemargin-bottom $m9padding $m7 $m6diff --git a/assets/stylus/variables.styl b/assets/stylus/variables.stylindex d85f4ee2..c26f1394 100644--- a/assets/stylus/variables.styl+++ b/assets/stylus/variables.styl@@ -1,26 +1 @@@import 'variables/*'--button-base-1()- cursor pointer- display flex- flex 1 1 50%- align-items center- justify-content center- height 44px- max-width 280px- margin 0 auto- padding 0 $m9- font-size 12px- text-decoration none- background var(--c-item-bg-main)- border 1px solid var(--c-bg-4)- border-radius $m9- anim()-- +media-hover()- background var(--c-item-bg-hover)- border 1px solid var(--c-item-bd-hover)-- +media(700px)- height 48px- max-width 280pxdiff --git a/components/categories/page/List.vue b/components/categories/page/List.vueindex 3dcec93a..56d5129c 100644--- a/components/categories/page/List.vue+++ b/components/categories/page/List.vue@@ -55,19 +55,10 @@ export default defineComponent({@onClick="id => $router.push(`/categories/${category.id}`)")- .pb-4.px-3.flex.gap-4- .button(@click="$store.dispatch('ui/setActiveTab', 'createCategory')") {{ $t('categories.new') }}+ .pb-4.px-3.flex.justify-evenly.gap-6+ //- Create+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="$store.dispatch('ui/setActiveTab', 'createCategory')"+ ) {{ $t('categories.new') }}</template>--<style lang="stylus" scoped>-.shame1- display grid- grid-template-columns repeat(2, 1fr)- grid-column-gap $m6- grid-row-gap $m6-- +media(600px)- grid-template-columns repeat(auto-fill, minmax(200px, 1fr))- grid-column-gap $m6- grid-row-gap $m6-</style>diff --git a/components/date/Selector.vue b/components/date/Selector.vueindex f44711e6..3cff51f7 100644--- a/components/date/Selector.vue+++ b/components/date/Selector.vue@@ -63,8 +63,9 @@ Portal(to="modal")@click="periodCounts.onSelect(periodCount)") {{ periodCount }}- .flex.py-3.px-3- .button(+ .pb-4.px-3.flex.justify-evenly.gap-6+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"@click="close()") {{ $t('close') }}</template>diff --git a/components/modal/ModalBottom.vue b/components/modal/ModalBottom.vueindex f94fda0c..9c66648c 100644--- a/components/modal/ModalBottom.vue+++ b/components/modal/ModalBottom.vue@@ -116,10 +116,6 @@ export default {.modalLinksslot(name="btns")- //- Buttons 2 collumns- .modalLinks._two- slot(name="btnsTwo" :closeModal="closeModal")-//- Defaultslot(:closeModal="closeModal")</template>diff --git a/components/modal/ModalBottomConfirm.vue b/components/modal/ModalBottomConfirm.vueindex b6e4730d..3a7c078a 100644--- a/components/modal/ModalBottomConfirm.vue+++ b/components/modal/ModalBottomConfirm.vue@@ -22,21 +22,21 @@ Portal(:title="$t('base.sure')"@onClose="$emit('onClose')")- template(v-if="description")- template(slot="description")- .descError {{ description }}- template(#btnsTwo="{ closeModal }")- ModalButton(- :name="$t('base.no')"- icon="mdi mdi-close"- @onClick="closeModal"- )- ModalButton(- :name="$t('base.yes')"- icon="mdi mdi-check"- @onClick="$emit('onConfirm')"- )+ template(#default="{ closeModal }")+ .pb-8.text-skin-red-base.text-center(v-if="description") {{ description }}++ .pb-4.px-3.flex.justify-evenly.gap-6+ ModalButton.grow(+ :name="$t('base.no')"+ icon="mdi mdi-close"+ @onClick="closeModal"+ )+ ModalButton.grow(+ :name="$t('base.yes')"+ icon="mdi mdi-check"+ @onClick="$emit('onConfirm')"+ )</template><style lang="stylus">diff --git a/components/modal/styles/modalLinks.styl b/components/modal/styles/modalLinks.stylindex 98a7f638..10495c85 100644--- a/components/modal/styles/modalLinks.styl+++ b/components/modal/styles/modalLinks.styl@@ -6,8 +6,5 @@padding 0 $m7padding-bottom $m5- &._two- grid-template-columns repeat(2, 1fr)-&._noPaddingpadding 0diff --git a/components/trnForm/TrnForm.vue b/components/trnForm/TrnForm.vueindex 17954c50..07835cde 100644--- a/components/trnForm/TrnForm.vue+++ b/components/trnForm/TrnForm.vue@@ -11,7 +11,6 @@ import { random, successEmo } from '~/assets/js/emo'SwiperCore.use([Pagination])-const props = withDefaults(defineProps<{show: boolean}>(), {@@ -79,7 +78,7 @@ function init() {longSwipesMs: 60,pagination: {el: '.trnForm__pagination',- clickable: false,+ clickable: true,},})setTrnFormHeight()@@ -267,9 +266,18 @@ function handleSubmitForm() {@onClick="onCategoryClick")- .buttons- .button(@click="$store.commit('trnForm/showTrnFormModal', 'wallets')") {{ $t('wallets.title') }}- .button(@click="$store.commit('trnForm/showTrnFormModal', 'categories')") {{ $t('categories.title') }}+ .pb-6.px-3.flex.justify-evenly.gap-6+ //- Wallets+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="$store.commit('trnForm/showTrnFormModal', 'wallets')"+ ) {{ $t('wallets.title') }}++ //- Categories+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="$store.commit('trnForm/showTrnFormModal', 'categories')"+ ) {{ $t('categories.title') }}.trnForm__paginationdiff --git a/components/trnForm/TrnFormTrns.vue b/components/trnForm/TrnFormTrns.vueindex 9018cd07..54f246e9 100644--- a/components/trnForm/TrnFormTrns.vue+++ b/components/trnForm/TrnFormTrns.vue@@ -123,8 +123,11 @@ export default defineComponent({:trnId="trnId")- .pages(v-if="!isShowedAllTrns")- .button(@click="showMoreTrns") {{ $t('trns.more') }}+ .py-4.pb-6.px-3.flex-center(v-if="!isShowedAllTrns")+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="showMoreTrns"+ ) {{ $t('trns.more') }}.pt-2.pb-5.px-3.overflow-hidden.rounded-md.items-center.flex.text-xs.text-center.bg-gray-50.dark_bg-dark4.dark_shadow@@ -158,10 +161,6 @@ export default defineComponent({text-align centerfontFamilyNunito()-.pages- padding 16px 8px- padding-top 0-.contentWrapposition relativedisplay griddiff --git a/components/trnForm/modal/TrnFormModalWallets.vue b/components/trnForm/modal/TrnFormModalWallets.vueindex fed8278f..709536f2 100644--- a/components/trnForm/modal/TrnFormModalWallets.vue+++ b/components/trnForm/modal/TrnFormModalWallets.vue@@ -32,9 +32,4 @@ TrnFormModal(@closed="afterClose")overflow hiddenoverflow-y autoheight 100%-- .wallets__toogle- button-base-1()- margin-top $m7- margin-bottom $m5</style>diff --git a/components/trns/Modal.vue b/components/trns/Modal.vueindex db327dc3..866682d5 100644--- a/components/trns/Modal.vue+++ b/components/trns/Modal.vue@@ -41,7 +41,7 @@ export default {wallet() {return this.$store.state.wallets.items[this.$store.state.trns.items[this.trnId].walletId]- }+ },},methods: {@@ -93,7 +93,7 @@ export default {this.showModalConfirm = falsethis.$store.commit('trns/hideTrnModal')this.$store.commit('trns/setTrnModalId', null)- }+ },},}</script>@@ -167,8 +167,9 @@ Portal(:background="wallet.color")- .wrap- .button.my-2.mx-auto(+ .pt-4.px-4.flex-center+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"@click="close()") {{ $t('close') }}@@ -194,35 +195,8 @@ Portal(background var(--c-bg-3)border-radius $m7 $m7 0 0-.groupItem- cursor pointer- display flex- width 100%- flex-grow 1- padding $m7 $m8- border-bottom 1px solid var(--c-bg-6)-- &:last-child- border-bottom 0-- &:hover- background var(--c-bg-5)-- &__active- flex-grow 0- width 40px-- &__name- flex-grow 1-.contentbackground var(--c-bg-3)+media(600px)border-radius 0 0 $m7 $m7--.wrap- padding 0 $m8--.button- button-base-1()</style>diff --git a/components/wallets/list/WalletsList3.vue b/components/wallets/list/WalletsList3.vueindex a04910a0..dbae4a14 100644--- a/components/wallets/list/WalletsList3.vue+++ b/components/wallets/list/WalletsList3.vue@@ -1,8 +1,5 @@<script>-export default {- name: 'WalletsList3',-props: {activeItemId: { type: String, default: null },limit: { type: [Number, Boolean], default: null },@@ -50,10 +47,6 @@ export default {:showBase="showBase"v-on="$listeners")-- .wallets__toogle(v-if="showToogle && $store.getters['wallets/walletsSortedIds'].length > limit" @click="toogleWallets")- template(v-if="stateLimit > 0") {{ this.$t('wallets.showAll') }}- template(v-else) {{ this.$t('wallets.showOnly') }} {{ limit }}</template><style lang="stylus" scoped>@@ -68,9 +61,4 @@ export default {grid-template-columns repeat(auto-fill, minmax(200px, 1fr))grid-column-gap $m6grid-row-gap $m6-- &__toogle- button-base-1()- margin-top $m9- margin-bottom $m9</style>diff --git a/components/wallets/page/List.vue b/components/wallets/page/List.vueindex 8f208a10..3831dca4 100644--- a/components/wallets/page/List.vue+++ b/components/wallets/page/List.vue@@ -52,20 +52,23 @@ export default defineComponent({//- List//---------------------------------.pb-12.px-3.grid.gap-y-1.gap-x-6.md_grid-cols-2- //- Item- .cursor-pointer.py-2.px-3.rounded-md.bg-gray-50.dark_bg-dark5.hocus_bg-gray-100.dark_hocus_bg-neutral-800(+ //- Wallet+ .cursor-pointer.py-2.px-3.rounded-md.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(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(+ //- Icon+ .w-6.h-6.rounded-md.flex-center.text-skin-icon-base.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 }}+ //- Name+ .grow.text-sm.text-skin-item-base {{ walletItem.name }}+ //- AmountAmount(:currency="walletItem.currency":value="walletItem.amount"@@ -74,9 +77,16 @@ export default defineComponent({vertical="right")- .pb-4.px-3.flex.gap-4- //- Create- .button(@click="$store.dispatch('ui/setActiveTab', 'createWallet')") {{ $t('wallets.new') }}+ .pb-4.px-3.flex.justify-evenly.gap-6//- Sort- .button(@click="$store.dispatch('ui/setActiveTab', 'walletsSort')") {{ $t('base.sort') }}+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="$store.dispatch('ui/setActiveTab', 'walletsSort')"+ ) {{ $t('base.sort') }}++ //- Create+ .cursor-pointer.grow.py-3.px-5.flex-center.rounded-full.text-sm.bg-skin-item-main-bg.hocus_bg-skin-item-main-hover(+ class="basis-1/2 max-w-[280px]"+ @click="$store.dispatch('ui/setActiveTab', 'createWallet')"+ ) {{ $t('wallets.new') }}</template>diff --git a/components/wallets/page/id/Edit.vue b/components/wallets/page/id/Edit.vueindex 1dd57ad2..cd732315 100644--- a/components/wallets/page/id/Edit.vue+++ b/components/wallets/page/id/Edit.vue@@ -6,8 +6,6 @@ import { currencies } from '~/components/currencies/currencies'export default defineComponent({setup() {- console.log(currencies)-const { $store } = useNuxtApp()const activeTab = ref('data')@@ -17,16 +15,16 @@ export default defineComponent({currency: 'RUB',isCredit: false,name: null,- order: Object.keys($store.state.wallets.items).length || 1,+ order: 1,})function findWalletWithThisColor(color) {- const wallets = $store.state.wallets.items- if (wallets) {- const categoryIdWithThisColor = Object.keys($store.state.wallets.items)?.find(id => wallets[id]?.color === color)- if (categoryIdWithThisColor)- return 'mdi mdi-credit-card-multiple'- }+ const walletsItems = $store.state.wallets.items+ if (!walletsItems) return false+ const walletIdWithThisColor = Object.keys(walletsItems)?.find(id => walletsItems[id]?.color === color)+ if (!walletIdWithThisColor) return false++ return true}function onSelectColor(color) {@@ -81,7 +79,6 @@ export default defineComponent({created() {this.colors = allColors- this.colors = allColorsif (!this.walletId)this.wallet.color = random(popularColors)},@@ -244,13 +241,10 @@ export default defineComponent({@click="handleCurrencySelect(currency)").flex.items-center- template(v-if="currencies.find(c => c.code === currency)")- .grow {{ currencies.find(c => c.code === currency).currency }}- div {{ currency }}-- template(v-else)- .grow- div {{ currency }}+ .w-14 {{ currency }}+ .text-sm(+ v-if="currencies.find(c => c.code === currency)"+ ) {{ currencies.find(c => c.code === currency).currency }}//- Colors//---------------------------------@@ -268,13 +262,13 @@ export default defineComponent({template(v-if="color")template(v-if="findWalletWithThisColor(color)")Icon(- icon="mdi mdi-credit-card-multiple"+ icon="mdi mdi-circle-small":color="color === wallet.color ? null : color"big)template(v-else-if="color === wallet.color")Icon(- icon="mdi mdi-credit-card-multiple"+ icon="mdi mdi-circle-small"background="transparent"big)@@ -294,13 +288,13 @@ export default defineComponent({template(v-if="color")template(v-if="findWalletWithThisColor(color)")Icon(- icon="mdi mdi-credit-card-multiple"+ icon="mdi mdi-circle-small":color="color === wallet.color ? null : color"big)template(v-else-if="color === wallet.color")Icon(- icon="mdi mdi-credit-card-multiple"+ icon="mdi mdi-circle-small"background="transparent"big)