Skip to content

Open source personal finance application

refactor: update trnForm

ilkome9f2eede62b43
diff --git a/components/trnForm/TrnForm.vue b/components/trnForm/TrnForm.vue
index 07835cde..09dae493 100644
--- a/components/trnForm/TrnForm.vue
+++ b/components/trnForm/TrnForm.vue
@@ -235,36 +235,37 @@ function handleSubmitForm() {
//- Wallets
.pt-5.pb-7
.subTitle.text-center.pb-2.text-xs {{ $t('wallets.title') }}
- WalletsList3(
- :activeItemId="$store.state.trnForm.values.walletId"
- :limit="4"
- :showBase="false"
- @onClick="onClickWallet"
- )
+ .pb-3.px-3
+ WalletsList3(
+ :activeItemId="$store.state.trnForm.values.walletId"
+ :limit="4"
+ :showBase="false"
+ @onClick="onClickWallet"
+ )
//- Favorite categories
.pb-7
.subTitle.text-center.pb-2.text-xs {{ $t('categories.favoriteTitle') }} {{ $t('categories.title') }}
- CategoriesView(
- v-if="sliderObj"
- :ids="$store.getters['categories/quickSelectorCategoriesIds']"
- :activeItemId="$store.state.trnForm.values.categoryId"
- :slider="sliderObj"
- noPaddingBottom
- @onClick="onCategoryClick"
- )
+ .px-3
+ CategoriesList(
+ v-if="sliderObj"
+ :ids="$store.getters['categories/quickSelectorCategoriesIds']"
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ :slider="sliderObj"
+ @onClick="onCategoryClick"
+ )
//- Last used categories
.pb-7
.subTitle.text-center.pb-2.text-xs {{ $t('categories.lastUsedTitle') }} {{ $t('categories.title') }}
- CategoriesView(
- v-if="sliderObj"
- :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
- :activeItemId="$store.state.trnForm.values.categoryId"
- :slider="sliderObj"
- noPaddingBottom
- @onClick="onCategoryClick"
- )
+ .px-3
+ CategoriesList(
+ v-if="sliderObj"
+ :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ :slider="sliderObj"
+ @onClick="onCategoryClick"
+ )
.pb-6.px-3.flex.justify-evenly.gap-6
//- Wallets
@@ -282,13 +283,14 @@ function handleSubmitForm() {
.trnForm__pagination
//- Modals
- LazyTrnFormModalCalendar(v-if="$store.state.trnForm.modal.calendar")
- LazyTrnFormModalCats(v-if="$store.state.trnForm.modal.categories")
- LazyTrnFormModalCatsChild(v-if="$store.state.trnForm.modal.categoriesChild")
- LazyTrnFormModalWallets(v-if="$store.state.trnForm.modal.wallets")
- LazyTrnFormModalDescription(v-if="$store.state.trnForm.modal.description")
- LazyTrnFormModalTransferFrom(v-if="$store.state.trnForm.modal.transferFrom")
- LazyTrnFormModalTransferTo(v-if="$store.state.trnForm.modal.transferTo")
+ Portal(to="modal")
+ TrnFormModalCalendar(v-if="$store.state.trnForm.modal.calendar")
+ TrnFormModalCats(v-if="$store.state.trnForm.modal.categories")
+ TrnFormModalCatsChild(v-if="$store.state.trnForm.modal.categoriesChild")
+ TrnFormModalDescription(v-if="$store.state.trnForm.modal.description")
+ TrnFormModalTransferFrom(v-if="$store.state.trnForm.modal.transferFrom")
+ TrnFormModalTransferTo(v-if="$store.state.trnForm.modal.transferTo")
+ TrnFormModalWallets(v-if="$store.state.trnForm.modal.wallets")
</template>
<style lang="stylus">
diff --git a/components/trnForm/TrnFormCategories.vue b/components/trnForm/TrnFormCategories.vue
index 2f9b949c..8fcbd3ee 100644
--- a/components/trnForm/TrnFormCategories.vue
+++ b/components/trnForm/TrnFormCategories.vue
@@ -50,22 +50,20 @@ export default {
.scrollBlock.scrollerBlock(
v-if="$store.getters['categories/lastUsedCategoriesIdsByDate'] && $store.getters['categories/lastUsedCategoriesIdsByDate'].length > 0"
)
- .header {{ $t('categories.lastUsedTitle') }} {{ $t('categories.title') }}
- .pb-4
- CategoriesView(
+ .py-5.header {{ $t('categories.lastUsedTitle') }} {{ $t('categories.title') }}
+ .pb-1.px-3
+ CategoriesList(
:activeItemId="$store.state.trnForm.values.categoryId"
:ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
- noPaddingBottom
@onClick="handleCategoryClick"
)
.swiper-slide
.scrollBlock.scrollerBlock
- .header {{ $t('categories.title') }}
- .pb-4
- CategoriesView(
+ .py-5.header {{ $t('categories.title') }}
+ .pb-1.px-3
+ CategoriesList(
:ids="$store.getters['categories/categoriesRootIds']"
- noPaddingBottom
@onClick="handleCategoryClick"
)
@@ -73,12 +71,11 @@ export default {
.scrollBlock.scrollerBlock(
v-if="$store.getters['categories/quickSelectorCategoriesIds'] && $store.getters['categories/quickSelectorCategoriesIds'].length"
)
- .header {{ $t('categories.favoriteTitle') }} {{ $t('categories.title') }}
- .pb-4
- CategoriesView(
+ .py-5.header {{ $t('categories.favoriteTitle') }} {{ $t('categories.title') }}
+ .pb-1.px-3
+ CategoriesList(
:activeItemId="$store.state.trnForm.values.categoryId"
:ids="$store.getters['categories/quickSelectorCategoriesIds']"
- noPaddingBottom
@onClick="handleCategoryClick"
)
@@ -127,8 +124,6 @@ export default {
align-items center
.header
- padding 40px 0
- padding-bottom 60px
font-h1()
font-size 22px
font-weight 600
diff --git a/components/trnForm/TrnFormHeader.vue b/components/trnForm/TrnFormHeader.vue
index b123bc2e..cd593d94 100644
--- a/components/trnForm/TrnFormHeader.vue
+++ b/components/trnForm/TrnFormHeader.vue
@@ -5,7 +5,7 @@ export default {
</script>
<template lang="pug">
-.trnFormHeader(
+.px-3.pb-6.grid.grid-cols-2.gap-3(
v-show="$store.state.trnForm.values.amountType !== 2"
)
TrnFormHeaderItemWallet
@@ -13,15 +13,6 @@ export default {
</template>
<style lang="stylus">
-.trnFormHeader
- display grid
- grid-template-columns repeat(2, 1fr)
- grid-column-gap $m8
- grid-row-gap $m8
- padding 0 $m7
- padding-top 0
- padding-bottom $m9
-
.trnFormHeaderItem
cursor pointer
position relative
diff --git a/components/trnForm/TrnFormHeaderTransfer.vue b/components/trnForm/TrnFormHeaderTransfer.vue
index bac0f0d1..54204cbe 100644
--- a/components/trnForm/TrnFormHeaderTransfer.vue
+++ b/components/trnForm/TrnFormHeaderTransfer.vue
@@ -116,7 +116,7 @@ div(v-if="$store.getters['wallets/walletsSortedIds'].length > 1")
.mdi.mdi-equal
//- Same
- .relative.trnFormHeader(v-if="isSameCurency")
+ .relative.px-3.pb-6.grid.grid-cols-2.gap-3(v-if="isSameCurency")
//- Wallet from
template(v-if="expenseWallet")
.trnFormHeaderItem
diff --git a/components/trnForm/modal/TrnFormModalCats.vue b/components/trnForm/modal/TrnFormModalCats.vue
index 83894fb6..b2b7b5d3 100644
--- a/components/trnForm/modal/TrnFormModalCats.vue
+++ b/components/trnForm/modal/TrnFormModalCats.vue
@@ -1,17 +1,25 @@
-<script>
-export default {
- name: 'TrnFormModalCats',
+<script setup lang="ts">
+import { useWindowSize } from '@vueuse/core'
- methods: {
- afterClose() {
- this.$store.commit('trnForm/closeTrnFormModal', 'categories')
- },
- },
+const { $store } = useNuxtApp()
+const { height } = useWindowSize()
+
+function closed() {
+ $store.commit('trnForm/closeTrnFormModal', 'categories')
}
</script>
<template lang="pug">
-TrnFormModal(@closed="afterClose")
+BaseBottomSheet(
+ :height="height"
+ insideClass="rounded-t-2xl bg-skin-layout-main"
+ @closed="closed"
+)
+ template(#handler="{ close }")
+ BaseBottomSheetHandler
+ BaseBottomSheetClose(@onClick="close")
+
template(#default="{ close }")
- TrnFormCategories(@closeModal="close")
+ .h-full.overflow-hidden
+ TrnFormCategories(@closeModal="close")
</template>
diff --git a/components/trnForm/modal/TrnFormModalCatsChild.vue b/components/trnForm/modal/TrnFormModalCatsChild.vue
index c49df8fd..6ede6e7e 100644
--- a/components/trnForm/modal/TrnFormModalCatsChild.vue
+++ b/components/trnForm/modal/TrnFormModalCatsChild.vue
@@ -44,9 +44,8 @@ TrnFormModal(@closed="afterClose")
template(#default="{ close }")
template(v-if="id && category")
.pb_base
- CategoriesView(
+ CategoriesList(
:ids="childCategoriesIds"
- noPaddingBottom
@onClick="catId => handleCategoryClick(catId, close)"
)
</template>
diff --git a/components/trnForm/modal/TrnFormModalTransferFrom.vue b/components/trnForm/modal/TrnFormModalTransferFrom.vue
index 256751c2..85c4cd2e 100644
--- a/components/trnForm/modal/TrnFormModalTransferFrom.vue
+++ b/components/trnForm/modal/TrnFormModalTransferFrom.vue
@@ -1,34 +1,37 @@
<script setup lang="ts">
+import { useWindowSize } from '@vueuse/core'
+
const { $store } = useNuxtApp()
+const { height } = useWindowSize()
function onClickWallet(walletId, close) {
$store.commit('trnForm/setTrnFormValues', { expenseWalletId: walletId })
close()
}
-function afterClose() {
+function closed() {
$store.commit('trnForm/closeTrnFormModal', 'transferFrom')
}
</script>
<template lang="pug">
-TrnFormModal(@closed="afterClose")
- template(#header)
- template {{ $t('transfer') }}
+BaseBottomSheet(
+ :maxHeight="height"
+ insideClass="rounded-t-2xl bg-skin-layout-main"
+ @closed="closed"
+)
+ template(#handler="{ close }")
+ BaseBottomSheetHandler
+ BaseBottomSheetClose(@onClick="close")
template(#default="{ close }")
- .trnFormWalletsList.scrollerBlock
- WalletsList3(@onClick="walletId => onClickWallet(walletId, close)")
+ .subTitle.pt-6.text-center.text-xs {{ $t('transfer') }}
+ .pt-3.pb-3.px-3
+ WalletsList3(
+ @onClick="walletId => onClickWallet(walletId, close)"
+ )
</template>
-<style lang="stylus">
-.trnFormWalletsList
- overflow hidden
- overflow-y auto
- height 100%
- padding-bottom 16px
-</style>
-
<i18n lang="json5">
{
"en": {
diff --git a/components/trnForm/modal/TrnFormModalTransferTo.vue b/components/trnForm/modal/TrnFormModalTransferTo.vue
index 8e0b0a30..3251c613 100644
--- a/components/trnForm/modal/TrnFormModalTransferTo.vue
+++ b/components/trnForm/modal/TrnFormModalTransferTo.vue
@@ -1,34 +1,37 @@
<script setup lang="ts">
+import { useWindowSize } from '@vueuse/core'
+
const { $store } = useNuxtApp()
+const { height } = useWindowSize()
function onClickWallet(walletId, close) {
$store.commit('trnForm/setTrnFormValues', { incomeWalletId: walletId })
close()
}
-function afterClose() {
+function closed() {
$store.commit('trnForm/closeTrnFormModal', 'transferTo')
}
</script>
<template lang="pug">
-TrnFormModal(@closed="afterClose")
- template(#header)
- template {{ $t('transfer') }}
+BaseBottomSheet(
+ :maxHeight="height"
+ insideClass="rounded-t-2xl bg-skin-layout-main"
+ @closed="closed"
+)
+ template(#handler="{ close }")
+ BaseBottomSheetHandler
+ BaseBottomSheetClose(@onClick="close")
template(#default="{ close }")
- .trnFormWalletsList.scrollerBlock
- WalletsList3(@onClick="walletId => onClickWallet(walletId, close)")
+ .subTitle.pt-6.text-center.text-xs {{ $t('transfer') }}
+ .pt-3.pb-3.px-3
+ WalletsList3(
+ @onClick="walletId => onClickWallet(walletId, close)"
+ )
</template>
-<style lang="stylus">
-.trnFormWalletsList
- overflow hidden
- overflow-y auto
- height 100%
- padding-bottom 16px
-</style>
-
<i18n lang="json5">
{
"en": {
diff --git a/components/trnForm/modal/TrnFormModalWallets.vue b/components/trnForm/modal/TrnFormModalWallets.vue
index 709536f2..55920223 100644
--- a/components/trnForm/modal/TrnFormModalWallets.vue
+++ b/components/trnForm/modal/TrnFormModalWallets.vue
@@ -1,35 +1,34 @@
-<script>
-export default {
- methods: {
- handleSetWallet(walletId, close) {
- this.$store.commit('trnForm/setTrnFormValues', { walletId })
- close()
- },
+<script setup lang="ts">
+import { useWindowSize } from '@vueuse/core'
- afterClose() {
- this.$store.commit('trnForm/closeTrnFormModal', 'wallets')
- },
- },
+const { $store } = useNuxtApp()
+const { height } = useWindowSize()
+
+function onClickWallet(walletId, close) {
+ $store.commit('trnForm/setTrnFormValues', { walletId })
+ close()
+}
+
+function closed() {
+ $store.commit('trnForm/closeTrnFormModal', 'wallets')
}
</script>
<template lang="pug">
-TrnFormModal(@closed="afterClose")
- template(#header)
- template {{ $t('wallets.title') }}
+BaseBottomSheet(
+ :maxHeight="height"
+ insideClass="rounded-t-2xl bg-skin-layout-main"
+ @closed="closed"
+)
+ template(#handler="{ close }")
+ BaseBottomSheetHandler
+ BaseBottomSheetClose(@onClick="close")
template(#default="{ close }")
- .trnFormWalletsList.scrollerBlock
+ .pt-6.pb-3.px-3
WalletsList3(
:activeItemId="$store.state.trnForm.values.walletId"
:showBase="false"
- @onClick="walletId => handleSetWallet(walletId, close)"
+ @onClick="walletId => onClickWallet(walletId, close)"
)
</template>
-
-<style lang="stylus">
-.trnFormWalletsList
- overflow hidden
- overflow-y auto
- height 100%
-</style>