Skip to content

Open source personal finance application

feat (TrnForm): use VueBottomSheet

ilkome28ea131217e9
diff --git a/components/chart/Periods.vue b/components/chart/Periods.vue
index ae105ca2..8a063f58 100644
--- a/components/chart/Periods.vue
+++ b/components/chart/Periods.vue
@@ -104,9 +104,6 @@ export default {
font-size 10px
border-radius $m3
- &:active
- background var(--c-bg-5)
-
+media-hover()
color var(--c-font-2)
background var(--c-blue-1)
diff --git a/components/layout/Mobile.vue b/components/layout/Mobile.vue
index 1b76bdd9..e4eefcaf 100644
--- a/components/layout/Mobile.vue
+++ b/components/layout/Mobile.vue
@@ -81,10 +81,29 @@ export default {
//-----------------------------------
CategoriesModalCategoryModal
CurrenciesCurrencyModal
- TrnForm(
- v-if="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories']"
- :isShow="$store.state.trnForm.show"
+
+ BaseBottomSheet(
+ keepAlive
+ :show="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories'] && $store.state.trnForm.show"
+ @closed="$store.dispatch('trnForm/closeTrnForm')"
)
+ template(#handler="{ close }")
+ .handler
+
+ .handler__close(@click="close")
+ svg(
+ viewBox='0 0 24 24'
+ fill='none'
+ stroke='#000'
+ stroke-linecap='round'
+ stroke-linejoin='round'
+ stroke-width='1.5'
+ )
+ path(d='M.75 23.249l22.5-22.5')
+ path(d='M23.25 23.249L.75.749')
+
+ TrnForm(:show="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories'] && $store.state.trnForm.show")
+
TrnsModalTrnModal
WalletsModalWalletModal
@@ -145,6 +164,54 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.handler
+ z-index 2
+ position absolute
+ top 0
+ left 0
+ display flex
+ align-items center
+ justify-content center
+ width 100%
+ height 16px
+
+ &:after
+ content ''
+ display block
+ width 32px
+ height 4px
+ background var(--c-bg-8)
+ border-radius 4px
+
+ &__close
+ z-index 3
+ cursor pointer
+ position absolute
+ top 4px
+ right 4px
+ display flex
+ align-items center
+ justify-content center
+ width 40px
+ height 40px
+ border-radius 50%
+ anim()
+
+ +media-hover()
+ background var(--c-blue-1)
+
+ svg
+ anim()
+ width 12px
+ height 12px
+ stroke var(--c-font-4)
+
+ +media-hover()
+ svg
+ width 12px
+ height 12px
+ stroke var(--c-font-1)
+
.layoutMobile
flex-grow 1
display grid
diff --git a/components/layout/Pc.vue b/components/layout/Pc.vue
index 101d03da..056691e5 100644
--- a/components/layout/Pc.vue
+++ b/components/layout/Pc.vue
@@ -108,11 +108,6 @@ export default {
LayoutPcTab(:show="activeTab === 'settings'")
Settings
- .layout__item(v-if="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories']")
- TrnForm(
- :isShow="$store.state.trnForm.show"
- )
-
template(v-if="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories']")
.sideOpener(
v-show="!$store.state.trnForm.show"
@@ -120,10 +115,80 @@ export default {
)
.sideOpener__bg
.sideOpener__btn: .mdi.mdi-plus
+
+ BaseBottomSheet(
+ keepAlive
+ :show="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories'] && $store.state.trnForm.show"
+ @closed="$store.dispatch('trnForm/closeTrnForm')"
+ )
+ template(#handler="{ close }")
+ .handler
+
+ .handler__close(@click="close")
+ svg(
+ viewBox='0 0 24 24'
+ fill='none'
+ stroke='#000'
+ stroke-linecap='round'
+ stroke-linejoin='round'
+ stroke-width='1.5'
+ )
+ path(d='M.75 23.249l22.5-22.5')
+ path(d='M23.25 23.249L.75.749')
+
+ TrnForm(:show="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories'] && $store.state.trnForm.show")
</template>
<style lang="stylus">
-@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables'
+
+.handler
+ z-index 2
+ position absolute
+ top 0
+ left 0
+ display flex
+ align-items center
+ justify-content center
+ width 100%
+ height 16px
+
+ &:after
+ content ''
+ display block
+ width 32px
+ height 4px
+ background var(--c-bg-8)
+ border-radius 4px
+
+ &__close
+ z-index 3
+ cursor pointer
+ position absolute
+ top 4px
+ right 4px
+ display flex
+ align-items center
+ justify-content center
+ width 40px
+ height 40px
+ border-radius 50%
+ anim()
+
+ +media-hover()
+ background var(--c-blue-1)
+
+ svg
+ anim()
+ width 12px
+ height 12px
+ stroke var(--c-font-4)
+
+ +media-hover()
+ svg
+ width 12px
+ height 12px
+ stroke var(--c-font-1)
.component__content-main
.walllets.dashboardItems
diff --git a/components/modal/ModalBottom.vue b/components/modal/ModalBottom.vue
index 5237d869..3b3ac309 100644
--- a/components/modal/ModalBottom.vue
+++ b/components/modal/ModalBottom.vue
@@ -175,7 +175,7 @@ $transition-style = cubic-bezier(.17, .04, .03, 1)
@import '~assets/stylus/variables'
.modalBottom
- z-index 100
+ z-index 1000
position fixed
left 0
bottom 0
diff --git a/components/trnForm/TrnForm.vue b/components/trnForm/TrnForm.vue
index b78a0ff7..0b38a62f 100644
--- a/components/trnForm/TrnForm.vue
+++ b/components/trnForm/TrnForm.vue
@@ -2,9 +2,8 @@
import dayjs from 'dayjs'
import Swiper, { Pagination } from 'swiper'
import 'swiper/swiper-bundle.css'
-import { ref, computed, watch, reactive, toRefs, useContext } from '@nuxtjs/composition-api'
+import { ref, computed, watch, onMounted, useContext } from '@nuxtjs/composition-api'
import generateId from '~/utils/id'
-import useTouchClose from '~/components/base/modal/useTouchClose'
import useCalculator from '~/components/trnForm/calculator/useCalculator'
import useTrnFormValidate from '~/components/trnForm/useTrnFormValidate'
@@ -16,31 +15,11 @@ export default {
name: 'TrnForm',
props: {
- isShow: {
- type: Boolean,
- default: false
- }
+ show: { type: Boolean, default: true }
},
- setup (props: any) {
+ setup (props) {
const { store } = useContext()
-
- const { initTouchModal, closeModal } = useTouchClose()
-
- /**
- * Wrappers
- */
- const wrappers = reactive({
- container: ref(null),
- content: ref(null),
- handler: ref(null),
- overflow: ref(null),
- wrap: ref(null),
- config: {
- doNotTouchClassName: 'doNotCloseTrnModal'
- }
- })
-
/**
* Slider
*/
@@ -68,48 +47,42 @@ export default {
function init () {
if (!sliderObj.value) {
- setTimeout(() => {
- sliderObj.value = new Swiper(slider.value, {
- init: false,
- observer: true,
- observeParents: true,
- slidesPerView: 1,
- autoHeight: true,
- initialSlide: 1,
- noSwipingClass: 'trnFormNoSwiping',
- shortSwipes: false,
- longSwipesRatio: 0.1,
- longSwipesMs: 60,
- pagination: {
- el: '.trnForm__pagination',
- clickable: true
- }
- })
- setTrnFormHeight()
- sliderObj.value.init()
- initTouchModal({
- ...toRefs(wrappers),
- onClose: () => store.dispatch('trnForm/closeTrnForm')
- })
- }, 10)
+ // setTimeout(() => {
+ sliderObj.value = new Swiper(slider.value, {
+ init: false,
+ observer: true,
+ observeParents: true,
+ slidesPerView: 1,
+ touchStartPreventDefault: false,
+ initialSlide: 1,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60,
+ pagination: {
+ el: '.trnForm__pagination',
+ clickable: false
+ }
+ })
+ setTrnFormHeight()
+ sliderObj.value.init()
+ // }, 10)
}
}
/**
* isShow
*/
- const { isShow } = toRefs(props)
- watch(isShow, (value) => {
- if (value) {
- init()
- }
- else {
- if (sliderObj.value) {
- sliderObj.value.slideTo(1, 0)
- }
+ onMounted(() => {
+ init()
+ })
+
+ watch(() => props.show, (value) => {
+ if (!value) {
clearExpression()
+ if (sliderObj.value)
+ sliderObj.value.slideTo(1, 0)
}
- }, { immediate: true })
+ })
/**
* Amounts
@@ -217,10 +190,6 @@ export default {
}
return {
- closeModal,
-
- ...toRefs(wrappers),
-
maxHeight,
slider,
sliderObj,
@@ -239,128 +208,129 @@ export default {
</script>
<template lang="pug">
-Portal(to="modal")
- .trnForm(
- v-if="$store.getters['wallets/hasWallets'] && $store.getters['categories/hasCategories']"
- v-show="isShow"
- ref="container"
- )
- //- Overflow
- transition(name="baseModalOveflowAnim" appear)
- .trnForm__overflow(
- ref="overflow"
- v-show="isShow"
- @click="closeModal"
- )
-
- //- wrap
- transition(name="baseModalWrapAnim" appear)
- .trnForm__wrap(
- v-show="isShow"
- :style="{ maxHeight: maxHeight }"
- ref="wrap"
- )
- .trnForm__handler(
- ref="handler"
- @click="closeModal"
+.trnForm
+ .swiper-container(ref="slider")
+ .swiper-wrapper
+ .swiper-slide(:style="{ height: maxHeight }")
+ .scroll.scrollerBlock
+ div(style="paddingBottom: 16px")
+ div(style="padding: 20px 0 20px 0")
+ WalletsList3(
+ :activeItemId="$store.state.trnForm.values.walletId"
+ :limit="4"
+ :showBase="false"
+ ui="widget"
+ @onClick="onClickWallet"
+ )
+
+ div(style="padding: 0 0 20px 0")
+ CategoriesView(
+ :ids="$store.getters['categories/quickSelectorCategoriesIds']"
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ ui="_flat"
+ :noPaddingBottom="true"
+ @onClick="onCategoryClick"
+ )
+
+ div(style="padding: 0 0 10px 0")
+ CategoriesView(
+ :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ ui="_flat"
+ :noPaddingBottom="true"
+ @onClick="onCategoryClick"
+ )
+
+ .swiper-slide.getHeight
+ .modalHeightBase
+ .trnForm__title(v-if="$store.state.trnForm.values.trnId") {{ $t('trnForm.titleEditTrn') }}
+ .trnForm__title(v-if="!$store.state.trnForm.values.trnId") {{ $t('trnForm.titleCreateTrn') }}
+
+ //- Laptop
+ template(v-if="$store.state.ui.pc")
+ TrnFormHeader
+ TrnFormHeaderTransfer(v-if="isTransfer")
+ TrnFormCalendar
+ TrnFormAmountPc
+ TrnFormCalculator(
+ pc
+ @onSubmit="handleSubmitForm"
+ )
+
+ .div(
+ v-if="$store.getters['categories/quickSelectorCategoriesIds'].length"
+ style="paddingBottom: 12px"
+ )
+ //- TrnFormCategories(:show="show")
+ .trnForm__quickCats
+ .formTitle {{ $t('categories.favoriteTitle') }}
+ CategoriesView(
+ :ids="$store.getters['categories/quickSelectorCategoriesIds']"
+ :noPaddingBottom="true"
+ ui="_flat"
+ @onClick="categoryId => $store.commit('trnForm/setTrnFormValues', { categoryId })"
+ )
+
+ //- Mobile
+ template(v-if="$store.state.ui.mobile")
+ TrnFormTypes
+ TrnFormAmount
+ TrnFormCalendar
+ TrnFormCalculator(@onSubmit="handleSubmitForm")
+ TrnFormHeader
+ TrnFormHeaderTransfer(v-show="isTransfer")
+
+ .swiper-slide(:style="{ height: maxHeight }")
+ TrnFormTrns(
+ v-if="sliderObj"
+ :slider="sliderObj"
)
- .trnForm__closure(@click="closeModal")
- svg(
- viewBox='0 0 24 24'
- fill='none'
- stroke='#000'
- stroke-linecap='round'
- stroke-linejoin='round'
- stroke-width='1.5'
- )
- path(d='M.75 23.249l22.5-22.5')
- path(d='M23.25 23.249L.75.749')
-
- //- Content
- .trnForm__scroll(ref="content")
- .trnForm__content
- .swiper-container(ref="slider")
- .swiper-wrapper
- .swiper-slide(:style="{ height: maxHeight }")
- .scroll.waitForScrollSlider
- div(style="paddingBottom: 16px")
- div(style="padding: 20px 0 10px 0")
- WalletsList3(
- :activeItemId="$store.state.trnForm.values.walletId"
- :limit="4"
- :showBase="false"
- ui="widget"
- @onClick="onClickWallet"
- )
-
- div(style="padding: 0 0 10px 0")
- CategoriesView(
- :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
- :activeItemId="$store.state.trnForm.values.categoryId"
- ui="_flat"
- :noPaddingBottom="true"
- @onClick="onCategoryClick"
- )
-
- .swiper-slide.getHeight
- .trnForm__title(v-if="$store.state.trnForm.values.trnId") {{ $t('trnForm.titleEditTrn') }}
- .trnForm__title(v-if="!$store.state.trnForm.values.trnId") {{ $t('trnForm.titleCreateTrn') }}
-
- //- Laptop
- template(v-if="$store.state.ui.pc")
- TrnFormHeader
- TrnFormHeaderTransfer(v-if="isTransfer")
- TrnFormCalendar
- TrnFormAmountPc
- TrnFormCalculator(
- pc
- @onSubmit="handleSubmitForm"
- )
-
- .trnFormNoSwiping2(
- v-if="$store.getters['categories/quickSelectorCategoriesIds'].length"
- style="paddingBottom: 12px"
- )
- //- TrnFormCategories(:show="show")
- .trnForm__quickCats
- .formTitle {{ $t('categories.favoriteTitle') }}
- CategoriesView(
- :ids="$store.getters['categories/quickSelectorCategoriesIds']"
- :noPaddingBottom="true"
- ui="_flat"
- @onClick="categoryId => $store.commit('trnForm/setTrnFormValues', { categoryId })"
- )
-
- //- Mobile
- template(v-if="$store.state.ui.mobile")
- TrnFormTypes
- TrnFormAmount
- TrnFormCalendar
- TrnFormCalculator(@onSubmit="handleSubmitForm")
- TrnFormHeader
- TrnFormHeaderTransfer(v-show="isTransfer")
-
- .swiper-slide(:style="{ height: maxHeight }")
- TrnFormTrns(
- v-if="sliderObj"
- :slider="sliderObj"
- )
- .trnForm__pagination
-
- //- Modals
- TrnFormModalCats
- TrnFormModalCatsChild
- TrnFormModalCalendar
- TrnFormModalDescription
- TrnFormModalWallets
- TrnFormModalTransferFrom
- TrnFormModalTransferTo
- TrnFormModalTrn
+
+ .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")
</template>
<style lang="stylus">
@import '~assets/stylus/variables'
+.formTitle
+ padding $m7
+ fontFamilyNunito()
+ color var(--c-font-4)
+ font-size 18px
+ font-weight 700
+
+.formCategories
+ padding 0
+ padding-bottom $m7
+
+.formWallets
+ padding-bottom $m4
+
+ &__input
+ position relative
+
+ &__value
+ z-index 2
+ position relative
+ width 100%
+ padding $m8 $m9
+ color var(--c-font-2)
+ font-header-1()
+ font-size 36px
+ font-weight 500
+ text-align right
+ background 0
+ border 0
+
.trnForm
&__handler
z-index 2
@@ -421,10 +391,6 @@ Portal(to="modal")
text-align center
fontFamilyNunito()
- @media $media-laptop
- padding-bottom $m7
- border-radius 16px
-
&__pagination
.swiper-pagination-bullet
opacity 1
@@ -444,36 +410,6 @@ Portal(to="modal")
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-$transition-style = cubic-bezier(.17, .04, .03, 1)
-
-.baseModalOveflowAnim
- &-enter-active
- &-leave-active
- opacity 1
- transition all 250ms $transition-style
-
- &-enter
- &-leave-to
- opacity 0
-
-.baseModalWrapAnim
- &-enter-active
- &-leave-active
- opacity 0
- transform translate3d(0, 50px, 0)
- transition opacity 300ms $transition-style, transform 250ms $transition-style
-
- +media-ipad()
- transform translate3d(50px, 0, 0)
-
- &-enter-to
- transform translate3d(0, 0, 0)
-
- &-leave
- &-enter-to
- &-leave-to
- opacity 1
-
.scroll
overflow hidden
overflow-y auto
@@ -481,14 +417,12 @@ $transition-style = cubic-bezier(.17, .04, .03, 1)
scrollbar()
.trnForm
- &__overflow
- @media $media-phone
- position fixed
- top 0
- right 0
- width 100%
- height 100%
- anim()
+ overflow hidden
+ overflow hidden
+ width 100%
+ height auto
+ background var(--color-bg-canvas)
+ border-radius $m8 $m8 0 0
&__quickCats
opacity .8
@@ -507,10 +441,6 @@ $transition-style = cubic-bezier(.17, .04, .03, 1)
&._anim
anim(200ms)
- @media $media-laptop
- border 1px solid var(--c-bg-1)
- border-radius 16px
-
&__scroll
background var(--color-bg-canvas)
diff --git a/components/trnForm/TrnFormAmountPc.vue b/components/trnForm/TrnFormAmountPc.vue
index 2ab9d794..8659ad26 100644
--- a/components/trnForm/TrnFormAmountPc.vue
+++ b/components/trnForm/TrnFormAmountPc.vue
@@ -55,8 +55,6 @@ export default {
.trnFormAmountPc
background var(--c-bg-3)
- border-top 1px solid var(--c-bg-2)
- border-bottom 1px solid var(--c-bg-2)
.trnFormAmount._incomes .trnFormAmountPc__input__value
color var(--c-incomes-1)
diff --git a/components/trnForm/TrnFormCategories.vue b/components/trnForm/TrnFormCategories.vue
index a4791764..27619d1c 100644
--- a/components/trnForm/TrnFormCategories.vue
+++ b/components/trnForm/TrnFormCategories.vue
@@ -5,42 +5,25 @@ import 'swiper/swiper-bundle.css'
export default {
name: 'TrnFormCategories',
- props: {
- show: {
- type: Boolean,
- default: false
- }
- },
-
data () {
return {
slider: null
}
},
- watch: {
- show: {
- handler (isShow) {
- const initialSlide = this.$store.getters['categories/quickSelectorCategoriesIds'] && this.$store.getters['categories/quickSelectorCategoriesIds'].length > 0 ? 1 : 2
- if (isShow && this.$refs.trnFormCategories) {
- if (!this.slider) {
- this.slider = new Swiper(this.$refs.trnFormCategories, {
- observer: true,
- slidesPerView: 1,
- autoHeight: false,
- initialSlide,
- shortSwipes: false,
- longSwipesRatio: 0.1,
- longSwipesMs: 60
- })
- }
- else {
- this.slider.update()
- }
- }
- },
- immediate: true
- }
+ mounted () {
+ const initialSlide = this.$store.getters['categories/quickSelectorCategoriesIds'] && this.$store.getters['categories/quickSelectorCategoriesIds'].length > 0 ? 1 : 2
+
+ this.slider = new Swiper(this.$refs.trnFormCategories, {
+ observer: true,
+ slidesPerView: 1,
+ touchStartPreventDefault: false,
+ autoHeight: false,
+ initialSlide,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60
+ })
},
methods: {
@@ -50,8 +33,7 @@ export default {
this.$store.commit('trnForm/showTrnFormModal', 'categoriesChild')
}
else {
- this.$store.commit('trnForm/closeTrnFormModal', 'categories')
- this.$store.commit('trnForm/closeTrnFormModal', 'categoriesChild')
+ this.$emit('closeModal')
this.$store.commit('trnForm/setTrnFormValues', { categoryId })
}
}
@@ -61,6 +43,44 @@ export default {
<template lang="pug">
.contentWrap
+ .contentWrap__box
+ .swiper-container(ref="trnFormCategories")
+ .swiper-wrapper
+ .swiper-slide
+ .scrollBlock.scrollerBlock(
+ v-if="$store.getters['categories/lastUsedCategoriesIdsByDate'] && $store.getters['categories/lastUsedCategoriesIdsByDate'].length > 0"
+ )
+ .pb_base
+ CategoriesView(
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ ui="_flat"
+ )
+
+ .swiper-slide
+ .scrollBlock.scrollerBlock
+ .pb_base
+ CategoriesView(
+ :ids="$store.getters['categories/categoriesRootIds']"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ )
+
+ .swiper-slide
+ .scrollBlock.scrollerBlock(
+ v-if="$store.getters['categories/quickSelectorCategoriesIds'] && $store.getters['categories/quickSelectorCategoriesIds'].length"
+ )
+ .pb_base
+ CategoriesView(
+ :activeItemId="$store.state.trnForm.values.categoryId"
+ :ids="$store.getters['categories/quickSelectorCategoriesIds']"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ ui="_flat"
+ )
+
.switcherList(v-if="slider")
.menuItem(
:class="{ _active: slider.activeIndex === 0 }"
@@ -74,51 +94,20 @@ export default {
:class="{ _active: slider.activeIndex === 2 }"
@click="slider.slideTo(2)"
) {{ $t('categories.favoriteTitle') }}
-
- .contentWrap__box
- .swiper-container(ref="trnFormCategories")
- .swiper-wrapper
- .swiper-slide
- .scrollBlock.waitForScrollSlider(
- v-if="$store.getters['categories/lastUsedCategoriesIdsByDate'] && $store.getters['categories/lastUsedCategoriesIdsByDate'].length > 0"
- )
- CategoriesView(
- :activeItemId="$store.state.trnForm.values.categoryId"
- :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- ui="_flat"
- )
-
- .swiper-slide
- .scrollBlock.waitForScrollSlider
- CategoriesView(
- :ids="$store.getters['categories/categoriesRootIds']"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- )
-
- .swiper-slide
- .scrollBlock.waitForScrollSlider(
- v-if="$store.getters['categories/quickSelectorCategoriesIds'] && $store.getters['categories/quickSelectorCategoriesIds'].length"
- )
- CategoriesView(
- :activeItemId="$store.state.trnForm.values.categoryId"
- :ids="$store.getters['categories/quickSelectorCategoriesIds']"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- ui="_flat"
- )
</template>
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.pb_base
+ padding-bottom 16px
+
.contentWrap
overflow hidden
position relative
display grid
- grid-template-rows auto 1fr
+ grid-template-rows 1fr auto
+ height 100%
&__box
overflow hidden
@@ -130,13 +119,18 @@ export default {
.scrollBlock
overflow hidden
+ display grid
+ align-items flex-end
overflowScrollY()
+ width 100%
height 100%
- padding-top $m6
- padding-bottom $m8
+
+ +media-laptop()
+ align-items center
.switcherList
display flex
+ align-items center
justify-content center
padding $m6
@@ -149,16 +143,14 @@ export default {
font-weight 500
font-roboto()
text-align center
- border 1px solid transparent
- border-radius 50px
+ anim()
- &:active
+ +media-hover()
color var(--c-font-2)
- background var(--c-blue-1)
+ background var(--c-bg-5)
+ border-radius 50px
&._active
cursor default
- color var(--c-font-3)
- background var(--c-bg-5)
- border 1px solid var(--c-bg-5)
+ color var(--c-blue-1)
</style>
diff --git a/components/trnForm/TrnFormHeader.vue b/components/trnForm/TrnFormHeader.vue
index 1f57c6b9..6313a00f 100644
--- a/components/trnForm/TrnFormHeader.vue
+++ b/components/trnForm/TrnFormHeader.vue
@@ -13,8 +13,16 @@ export default {
</template>
<style lang="stylus">
-@import '~assets/stylus/variables/margins'
-@import '~assets/stylus/variables/animations'
+@import '~assets/stylus/variables'
+
+.trnFormHeader
+ display grid
+ grid-template-columns repeat(2, 1fr)
+ grid-column-gap $m7
+ grid-row-gap $m7
+ padding 0 $m7
+ padding-top 0
+ padding-bottom $m9
.trnFormHeaderItem
cursor pointer
@@ -31,17 +39,3 @@ export default {
color var(--c-font-2)
font-size 16px
</style>
-
-<style lang="stylus">
-@import '~assets/stylus/variables/margins'
-@import '~assets/stylus/variables/media'
-
-.trnFormHeader
- display grid
- grid-template-columns repeat(2, 1fr)
- grid-column-gap $m7
- grid-row-gap $m7
- padding 0 $m7
- padding-top 0
- padding-bottom $m9
-</style>
diff --git a/components/trnForm/TrnFormModals.vue b/components/trnForm/TrnFormModals.vue
new file mode 100644
index 00000000..85b57c20
--- /dev/null
+++ b/components/trnForm/TrnFormModals.vue
@@ -0,0 +1,19 @@
+<script>
+import { defineComponent } from '@nuxtjs/composition-api'
+
+export default defineComponent({
+ name: 'TrnFormModals'
+})
+</script>
+
+<template lang="pug">
+.modals
+ TrnFormModalCats
+ TrnFormModalCatsChild
+ TrnFormModalCalendar
+ TrnFormModalDescription
+ TrnFormModalWallets
+ TrnFormModalTransferFrom
+ TrnFormModalTransferTo
+ TrnFormModalTrn
+</template>
diff --git a/components/trnForm/TrnFormTrns.vue b/components/trnForm/TrnFormTrns.vue
index b2840ac0..5da22a77 100644
--- a/components/trnForm/TrnFormTrns.vue
+++ b/components/trnForm/TrnFormTrns.vue
@@ -77,16 +77,15 @@ export default {
})
// from category
- if (this.categoryId) {
+ if (this.categoryId)
trnsIds = trnsIds.filter(trnId => trns[trnId].categoryId === this.categoryId)
- }
// filter type
- if (this.incomes) { trnsIds = trnsIds.filter(id => trns[id].type === 1) }
- if (this.expenses) { trnsIds = trnsIds.filter(id => trns[id].type === 0) }
+ if (this.incomes) trnsIds = trnsIds.filter(id => trns[id].type === 1)
+ if (this.expenses) trnsIds = trnsIds.filter(id => trns[id].type === 0)
// limit
- if (this.limit > 0) { return trnsIds.slice(0, this.limit) }
+ if (this.limit > 0) return trnsIds.slice(0, this.limit)
return trnsIds
},
@@ -101,12 +100,11 @@ export default {
? dayDate = this.$day(trns[trnId].edited).startOf('day').valueOf()
: dayDate = this.$day(trns[trnId].date).startOf('day').valueOf()
- if (!trnsList[dayDate]) {
+ if (!trnsList[dayDate])
trnsList[dayDate] = [trnId]
- }
- else {
+
+ else
trnsList[dayDate].push(trnId)
- }
}
return trnsList
}
@@ -149,7 +147,7 @@ export default {
.menuItem(@click="changeFilter('walletAndCategory')" :class="{ _active: filterBy === 'walletAndCategory' }") {{ $t('trnForm.filterWalletAndCategory') }}
.menuItem(@click="changeFilter('all')" :class="{ _active: filterBy === 'all' }") {{ $t('trnForm.filterAll') }}
- .contentWrap__box.trnsListScroll.waitForScrollSlider
+ .contentWrap__box.trnsListScroll.scrollerBlock
.container(v-if="trnsIds.length === 0") No transactions
.scrollBlock
diff --git a/components/trnForm/TrnFormTypes.vue b/components/trnForm/TrnFormTypes.vue
index b7667b02..5a499a52 100644
--- a/components/trnForm/TrnFormTypes.vue
+++ b/components/trnForm/TrnFormTypes.vue
@@ -60,15 +60,14 @@ export default {
font-roboto()
text-align center
border 1px solid transparent
- border-radius 50px
+ anim()
- &:active
+ +media-hover()
color var(--c-font-2)
- background var(--c-blue-1)
+ background var(--c-bg-5)
+ border-radius 50px
&._active
cursor default
- color var(--c-font-3)
- background var(--c-bg-5)
- border 1px solid var(--c-bg-5)
+ color var(--c-blue-1)
</style>
diff --git a/components/trnForm/modal/TrnFormModal.vue b/components/trnForm/modal/TrnFormModal.vue
index ca3baa6f..570e7815 100644
--- a/components/trnForm/modal/TrnFormModal.vue
+++ b/components/trnForm/modal/TrnFormModal.vue
@@ -1,280 +1,120 @@
<script lang="ts">
-import { ref, watch, reactive, toRefs } from '@nuxtjs/composition-api'
-import useTouchClose from '~/components/base/modal/useTouchClose'
+import { ref, onMounted, defineComponent } from '@nuxtjs/composition-api'
-export default {
- props: {
- title: {
- type: String,
- default: null
- },
-
- isShow: {
- type: Boolean,
- required: false
- },
-
- position: {
- type: String,
- default: null
- },
-
- doNotTouchClassName: {
- type: String,
- default: null
- },
-
- noPadding: {
- type: Boolean,
- default: false
- }
- },
-
- setup (props: any, { listeners }) {
- const { isShow, doNotTouchClassName } = toRefs(props)
- const { initTouchModal, closeModal } = useTouchClose()
-
- const wrappers = reactive({
- container: ref(null),
- content: ref(null),
- handler: ref(null),
- overflow: ref(null),
- wrap: ref(null),
- config: {
- doNotTouchClassName: doNotTouchClassName.value ? doNotTouchClassName.value : 'doNotCloseTrnModalInside'
- }
+export default defineComponent({
+ setup () {
+ const documentHeight = ref('100%')
+ onMounted(() => {
+ documentHeight.value = `${document.documentElement.clientHeight}px`
})
-
- watch(isShow, (value) => {
- if (value) {
- setTimeout(() => {
- initTouchModal({
- ...toRefs(wrappers),
- onClose: listeners.onClose
- })
- }, 10)
- }
- }, { immediate: true })
-
- return {
- ...toRefs(wrappers),
- closeModal
- }
- },
-
- data () {
return {
- headerHeight: 0
- }
- },
-
- computed: {
- modalStyle (): any {
- if (this.$store.state.trnForm.height < this.$store.state.ui.height) {
- if (this.position === 'bottom') {
- return {
- maxHeight: `${this.$store.state.trnForm.height}px`
- }
- }
- return {
- height: `${this.$store.state.trnForm.height}px`
- }
- }
- else {
- return {
- height: `${this.$store.state.ui.height}px`
- }
- }
- }
- },
-
- methods: {
- afterClose () {
- if (this.$listeners.afterClose) {
- this.$listeners.afterClose()
- }
- },
-
- onClose () {
- if (this.$listeners.onClose) {
- this.$listeners.onClose()
- }
+ documentHeight
}
}
-}
+})
</script>
<template lang="pug">
Portal(to="modal")
- .trnFormModal(
- ref="container"
- v-show="isShow"
+ BaseBottomSheet(
+ :show="true"
+ @closed="$emit('closed')"
)
- transition(name="baseModalOveflowAnim" appear)
- .trnFormModal__overflow(
- v-show="isShow"
- ref="overflow"
- @click="closeModal"
- )
-
- transition(name="baseModalWrapAnim" appear)
- .trnFormModal__wrap(
- v-show="isShow"
- :style="modalStyle"
- ref="wrap"
- )
- .trnForm__handler(
- ref="handler"
- @click="closeModal"
+ template(#handler="{ close }")
+ .handler
+
+ .handler__close(@click="close")
+ svg(
+ viewBox='0 0 24 24'
+ fill='none'
+ stroke='#000'
+ stroke-linecap='round'
+ stroke-linejoin='round'
+ stroke-width='1.5'
)
- .trnForm__closure(@click="closeModal")
- svg(
- viewBox='0 0 24 24'
- fill='none'
- stroke='#000'
- stroke-linecap='round'
- stroke-linejoin='round'
- stroke-width='1.5'
- )
- path(d='M.75 23.249l22.5-22.5')
- path(d='M23.25 23.249L.75.749')
+ path(d='M.75 23.249l22.5-22.5')
+ path(d='M23.25 23.249L.75.749')
- .trnFormModal__scroll(
- :class="{ _noPadding: noPadding }"
- ref="content"
- )
- .trnForm__title(v-if="title") {{ title }}
- slot
+ template(#default="{ close }")
+ .content(:style="{ maxHeight: documentHeight }")
+ .header(@click="close")
+ slot(name="header")
+
+ slot(name="default" :close="close")
</template>
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-.baseModalOveflowAnim
- &-enter-active
- &-leave-active
- transition opacity 350ms ease
-
- &-enter
- &-leave-to
- opacity 0
-
-.baseModalWrapAnim
- &-enter-active
- &-leave-active
- opacity 0
- transform translate3d(0, 50px, 0)
- transition opacity 300ms $transition-style, transform 250ms $transition-style
-
- &-enter-to
- transform translate3d(0, 0, 0)
-
- &-leave
- &-enter-to
- &-leave-to
- opacity 1
-
- &-leave-to
- transform translate3d(0, 200%, 0)
- transition opacity 400ms $transition-style, transform 400ms $transition-style
-
-.trnFormModal
- z-index 100
+.handler
+ z-index 2
position absolute
+ top 0
+ left 0
+ display flex
+ align-items center
+ justify-content center
width 100%
-
- @media $media-laptop
- position absolute
- display grid
- margin $m7
- border-radius 16px
-
- @media $media-phone
- left 0
- bottom 0
-
- @media $media-laptop
- top 0
- right 0
-
- &__overflow
- position fixed
- left 0
- bottom 0
- width 100%
- height 100%
- background var(--c-bg-14)
- anim()
-
- @media $media-laptop
- opacity .1
-
- &__wrap
- overflow hidden
- position relative
- display flex
- flex-grow 1
- flex-flow column nowrap
- background var(--color-bg-canvas)
-
- @media $media-phone
- border-radius $m7 $m7 0 0
-
- @media $media-laptop
- align-self center
- width 400px
- margin 0 auto
- border-radius $m7
-
- &._anim
- anim(200ms)
-
- &__scroll
- overflow hidden
- overflow-y auto
- max-height 100%
- padding-bottom $m7
- scrollbar()
-
- &._noPadding
- overflow hidden
- display grid
- grid-template-rows auto 1fr
- display grid
- flex-grow 1
- padding-bottom 0
-
- &__header
+ height 16px
+
+ &:after
+ content ''
+ display block
+ width 32px
+ height 4px
+ background var(--c-bg-8)
+ border-radius 4px
+
+ &__close
+ z-index 3
cursor pointer
- position relative
+ position absolute
+ top 4px
+ right 4px
display flex
align-items center
- justify-content space-between
- padding $m7
- padding-bottom $m6
- color var(--c-font-3)
- font-size 22px
- font-weight 700
- letter-spacing 1px
- fontFamilyNunito()
-
- /.light-mode &
- color var(--c-font-4)
-
- &:hover
- &:active
- background var(--c-bg-5)
-
- &__title
- flex-grow 1
- text-align center
-
- &__close
- color var(--c-font-4)
- font-size 20px
+ justify-content center
+ width 40px
+ height 40px
+ border-radius 50%
+ anim()
- &__icon
- position absolute
- top -24px
- right $m7
+ +media-hover()
+ background var(--c-blue-1)
+
+ svg
+ anim()
+ width 12px
+ height 12px
+ stroke var(--c-font-4)
+
+ +media-hover()
+ svg
+ width 12px
+ height 12px
+ stroke var(--c-font-1)
+
+.content
+ overflow hidden
+ display grid
+ grid-template-rows minmax(min-content, auto) minmax(50px, min-content)
+ padding-top $m7
+ background var(--color-bg-canvas)
+ border-radius $m8 $m8 0 0
+
+.header
+ position relative
+ display flex
+ align-items center
+ justify-content center
+ padding $m7
+ padding-bottom $m7
+ color var(--c-font-3)
+ font-size 22px
+ font-weight 700
+ letter-spacing 1px
+ fontFamilyNunito()
+
+ /.light-mode &
+ color var(--c-font-4)
</style>
diff --git a/components/trnForm/modal/TrnFormModalCalendar.vue b/components/trnForm/modal/TrnFormModalCalendar.vue
index 2bb706f0..0e00a66f 100644
--- a/components/trnForm/modal/TrnFormModalCalendar.vue
+++ b/components/trnForm/modal/TrnFormModalCalendar.vue
@@ -1,4 +1,5 @@
<script>
+import { ref, computed, useContext } from '@nuxtjs/composition-api'
import Datepicker from 'vuejs-datepicker'
const calendarOptions = {
@@ -13,13 +14,15 @@ export default {
Datepicker
},
- computed: {
- isShow () {
- return this.$store.state.trnForm.modal.calendar
- },
+ setup () {
+ const { store } = useContext()
+
+ const date = computed(() => store.state.trnForm.values.date)
+ const closeModal = ref(null)
- date () {
- return this.$store.state.trnForm.values.date
+ return {
+ date,
+ closeModal
}
},
@@ -28,16 +31,22 @@ export default {
},
methods: {
- handleSelectDate (date) {
+ handleSelectDate (date, close) {
+ console.log(close)
this.$store.commit('trnForm/setTrnFormValues', {
date: this.$day(date).valueOf()
})
- this.$store.commit('trnForm/closeTrnFormModal', 'calendar')
+ close()
},
- handleSelectDateDaysAgo (daysAgo) {
+
+ handleSelectDateDaysAgo (daysAgo, close) {
this.$store.commit('trnForm/setTrnFormValues', {
date: this.$day().subtract(daysAgo, 'day').valueOf()
})
+ close()
+ },
+
+ afterClose () {
this.$store.commit('trnForm/closeTrnFormModal', 'calendar')
}
}
@@ -45,34 +54,114 @@ export default {
</script>
<template lang="pug">
-TrnFormModal.doNotCloseTrnModal(
- :isShow="isShow"
- title="Date"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'calendar')"
-)
- Datepicker(
- :inline="true"
- :value="date"
- :monday-first="true"
- wrapper-class="inlineCalendar"
- calendar-class="inlineCalendar__in"
- :disabledDates="calendarOptions.disabledDates"
- @selected="handleSelectDate"
- )
- .modalLinks
- ModalButton(
- name="2 days ago"
- icon="mdi mdi-calendar-clock"
- @onClick="() => handleSelectDateDaysAgo(2)"
- )
- ModalButton(
- name="Yesterday"
- icon="mdi mdi-weather-night"
- @onClick="() => handleSelectDateDaysAgo(1)"
- )
- ModalButton(
- name="Today"
- icon="mdi mdi-weather-sunset-up"
- @onClick="() => handleSelectDateDaysAgo(0)"
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template {{ $t('common.date') }}
+
+ template(#default="{ close }")
+ Datepicker(
+ :inline="true"
+ :value="date"
+ :monday-first="true"
+ wrapper-class="inlineCalendar"
+ calendar-class="inlineCalendar__in"
+ :disabledDates="calendarOptions.disabledDates"
+ @selected="date => handleSelectDate(date, close)"
)
+ .modalLinks
+ ModalButton(
+ :name="$t('dates.twoDaysAgo')"
+ icon="mdi mdi-calendar-clock"
+ @onClick="() => handleSelectDateDaysAgo(2, close)"
+ )
+ ModalButton(
+ :name="$t('dates.day.yesterday')"
+ icon="mdi mdi-weather-night"
+ @onClick="() => handleSelectDateDaysAgo(1, close)"
+ )
+ ModalButton(
+ :name="$t('dates.day.today')"
+ icon="mdi mdi-weather-sunset-up"
+ @onClick="() => handleSelectDateDaysAgo(0, close)"
+ )
</template>
+
+<style lang="stylus">
+.inlineCalendar
+ padding 0 $m7
+ padding-bottom $m7
+
+ .vdp-datepicker__calendar
+ width auto
+ background none
+ border 0
+
+ header
+ display flex
+ align-items center
+ justify-content space-between
+ padding-bottom $m7
+ line-height 1
+
+ .prev
+ .next
+ margin 0
+ padding $m6 $m9
+ background none
+ border 1px solid var(--c-bg-5)
+ border-radius 3px
+ anim()
+
+ &.disabled
+ opacity 0
+
+ &:hover
+ background none
+
+ .prev:after
+ border-right 10px solid var(--c-bg-9)
+
+ .next:after
+ border-left 10px solid var(--c-bg-9)
+
+ .day__month_btn
+ .month__year_btn.up
+ span
+ margin 0 $m7
+ padding $m6 0
+ border-radius $m3
+ font-header-1()
+
+ &:hover
+ background none !important
+
+ @media $media-laptop
+ background var(--c-bg-6) !important
+
+ .cell
+ height 46px
+
+ .cell.day-header
+ height auto
+ padding-bottom $m5
+ color rgb(117, 117, 117)
+ line-height 1
+
+ .day
+ cursor pointer
+ position relative
+ padding-top $m2
+ text-align center
+ border-radius $m5
+
+ .today
+ color var(--c-font-1)
+ background var(--c-bg-5)
+
+ .disabled
+ color var(--c-font-4)
+
+ .selected
+ color var(--c-font-1)
+ background var(--c-blue-1)
+</style>
diff --git a/components/trnForm/modal/TrnFormModalCats.vue b/components/trnForm/modal/TrnFormModalCats.vue
index e9aba955..1184f871 100644
--- a/components/trnForm/modal/TrnFormModalCats.vue
+++ b/components/trnForm/modal/TrnFormModalCats.vue
@@ -1,26 +1,20 @@
<script>
-import { computed, useContext } from '@nuxtjs/composition-api'
-
export default {
name: 'TrnFormModalCats',
- setup () {
- const { store } = useContext()
- const isShow = computed(() => store.state.trnForm.modal.categories)
-
- return {
- isShow
+ methods: {
+ afterClose () {
+ this.$store.commit('trnForm/closeTrnFormModal', 'categories')
}
}
}
</script>
<template lang="pug">
-TrnFormModal.doNotCloseTrnModal(
- :isShow="isShow"
- :title="$t('categories.name')"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'categories')"
- noPadding
-)
- TrnFormCategories(:show="isShow")
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template {{ $t('categories.title') }}
+
+ template(#default="{ close }")
+ TrnFormCategories(@closeModal="close")
</template>
diff --git a/components/trnForm/modal/TrnFormModalCatsChild.vue b/components/trnForm/modal/TrnFormModalCatsChild.vue
index d1f00de9..b885f3e3 100644
--- a/components/trnForm/modal/TrnFormModalCatsChild.vue
+++ b/components/trnForm/modal/TrnFormModalCatsChild.vue
@@ -1,5 +1,11 @@
<script>
export default {
+ data () {
+ return {
+ childSelected: false
+ }
+ },
+
computed: {
id () {
return this.$store.state.trnForm.showModalCategoryId
@@ -13,34 +19,39 @@ export default {
},
methods: {
- handleCategoryClick (categoryId) {
- this.$store.commit('trnForm/closeTrnFormModal', 'categories')
+ handleCategoryClick (categoryId, close) {
+ this.childSelected = true
this.$store.commit('trnForm/setTrnFormValues', { categoryId })
- this.onClose()
+ close()
},
- onClose () {
+ afterClose () {
+ if (this.childSelected)
+ this.$store.commit('trnForm/closeTrnFormModal', 'categories')
+
this.$store.commit('trnForm/closeTrnFormModal', 'categoriesChild')
- setTimeout(() => {
- this.$store.commit('trnForm/setTrnFormModalCategoryId', null)
- }, 100)
+ this.$store.commit('trnForm/setTrnFormModalCategoryId', null)
}
}
}
</script>
<template lang="pug">
-TrnFormModal.doNotCloseTrnModal(
- :isShow="$store.state.trnForm.modal.categoriesChild"
- :position="$store.state.ui.mobile ? 'bottom' : null"
- :title="id && category && category.name"
- doNotTouchClassName="doNotCloseTrnModalInside"
- @onClose="onClose"
-)
- template(v-if="id && category")
- CategoriesView(
- :ids="childCategoriesIds"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- )
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template {{ $t('categories.title') }}
+
+ template(#default="{ close }")
+ template(v-if="id && category")
+ .pb_base
+ CategoriesView(
+ :ids="childCategoriesIds"
+ :noPaddingBottom="true"
+ @onClick="catId => handleCategoryClick(catId, close)"
+ )
</template>
+
+<style lang="stylus">
+.pb_base
+ padding-bottom 16px
+</style>
diff --git a/components/trnForm/modal/TrnFormModalDescription.vue b/components/trnForm/modal/TrnFormModalDescription.vue
index 4619a625..f4104e78 100644
--- a/components/trnForm/modal/TrnFormModalDescription.vue
+++ b/components/trnForm/modal/TrnFormModalDescription.vue
@@ -1,5 +1,5 @@
<script>
-import { ref, computed, watch, useContext } from '@nuxtjs/composition-api'
+import { ref, computed, onMounted, useContext } from '@nuxtjs/composition-api'
import useCalculator from '~/components/trnForm/calculator/useCalculator'
export default {
@@ -10,31 +10,30 @@ export default {
const { setKeysActive } = useCalculator()
const description = ref('')
- const isShow = computed(() => store.state.trnForm.modal.description)
-
- watch(isShow, (value) => {
- if (value) {
- description.value = store.state.trnForm.values.description
- setKeysActive(false)
- }
- else {
- setKeysActive(true)
- }
+ onMounted(() => {
+ description.value = store.state.trnForm.values.description
+ setKeysActive(false)
})
return {
description,
- isShow
+ setKeysActive
}
},
methods: {
- handleCancel () {
+ handleCancel (close) {
this.description = null
- this.$store.commit('trnForm/closeTrnFormModal', 'description')
+ close()
},
- handleSave () {
+
+ handleSave (close) {
this.$store.commit('trnForm/setTrnFormValues', { description: this.description })
+ close()
+ },
+
+ afterClose () {
+ this.setKeysActive(true)
this.$store.commit('trnForm/closeTrnFormModal', 'description')
}
}
@@ -42,32 +41,31 @@ export default {
</script>
<template lang="pug">
-TrnFormModal(
- :isShow="isShow"
- :position="$store.state.ui.mobile ? 'bottom' : null"
- :title="$t('trnForm.description.title')"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'description')"
-)
- .description
- .description__filed
- textarea.textarea(
- v-model="description"
- :placeholder="$t('trnForm.description.placeholder')"
- )
-
- .description__action
- .description__action-cancel
- SharedButton(
- className="_grey _inline"
- :title="$t('base.cancel')"
- @onClick="handleCancel"
- )
- .description__action-ok
- SharedButton(
- className="_blue _inline"
- :title="$t('base.save')"
- @onClick="handleSave"
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template {{ $t('trnForm.description.title') }}
+
+ template(#default="{ close }")
+ .description
+ .description__filed
+ textarea.textarea(
+ v-model="description"
+ :placeholder="$t('trnForm.description.placeholder')"
)
+
+ .description__action
+ .description__action-cancel
+ SharedButton(
+ className="_grey _inline"
+ :title="$t('base.cancel')"
+ @onClick="handleCancel(close)"
+ )
+ .description__action-ok
+ SharedButton(
+ className="_blue _inline"
+ :title="$t('base.save')"
+ @onClick="handleSave(close)"
+ )
</template>
<style lang="stylus" scoped>
@@ -76,6 +74,7 @@ TrnFormModal(
.description
padding 0 $m7
+ padding-bottom 16px
&__filed
padding-bottom $m9
diff --git a/components/trnForm/modal/TrnFormModalTransferFrom.vue b/components/trnForm/modal/TrnFormModalTransferFrom.vue
index b1b45db7..cb95d87d 100644
--- a/components/trnForm/modal/TrnFormModalTransferFrom.vue
+++ b/components/trnForm/modal/TrnFormModalTransferFrom.vue
@@ -1,36 +1,48 @@
<script>
-import { computed, useContext } from '@nuxtjs/composition-api'
+import { useContext } from '@nuxtjs/composition-api'
export default {
name: 'TrnFormModalTransferFrom',
setup () {
const { store } = useContext()
- const isShow = computed(() => store.state.trnForm.modal.transferFrom)
- function setWalletFromId (walletId) {
- store.commit('trnForm/closeTrnFormModal', 'transferFrom')
+ function onClickWallet (walletId, close) {
store.commit('trnForm/setTrnFormValues', {
walletFromId: walletId,
walletId
})
+ close()
+ }
+
+ function afterClose () {
+ store.commit('trnForm/closeTrnFormModal', 'transferFrom')
}
return {
- isShow,
- setWalletFromId
+ onClickWallet,
+ afterClose
}
}
}
</script>
<template lang="pug">
-LazyTrnFormModal.doNotCloseTrnModal(
- v-if="isShow"
- :isShow="isShow"
- title="Transfer from wallet"
- position="bottom"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'transferFrom')"
-)
- WalletsList3(@onClick="setWalletFromId")
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template Transfer from wallet
+
+ template(#default="{ close }")
+ .trnFormWalletsList.scrollerBlock
+ WalletsList3(@onClick="walletId => onClickWallet(walletId, close)")
</template>
+
+<style lang="stylus">
+@import '~assets/stylus/variables'
+
+.trnFormWalletsList
+ overflow hidden
+ overflow-y auto
+ height 100%
+ padding-bottom 16px
+</style>
diff --git a/components/trnForm/modal/TrnFormModalTransferTo.vue b/components/trnForm/modal/TrnFormModalTransferTo.vue
index f19def66..29f10dd0 100644
--- a/components/trnForm/modal/TrnFormModalTransferTo.vue
+++ b/components/trnForm/modal/TrnFormModalTransferTo.vue
@@ -1,36 +1,48 @@
<script>
-import { computed, useContext } from '@nuxtjs/composition-api'
+import { useContext } from '@nuxtjs/composition-api'
export default {
name: 'TrnFormModalTransferTo',
setup () {
const { store } = useContext()
- const isShow = computed(() => store.state.trnForm.modal.transferTo)
- function setWalletToId (walletId) {
- store.commit('trnForm/closeTrnFormModal', 'transferTo')
+ function onClickWallet (walletId, close) {
store.commit('trnForm/setTrnFormValues', {
walletToId: walletId,
walletId
})
+ close()
+ }
+
+ function afterClose () {
+ store.commit('trnForm/closeTrnFormModal', 'transferTo')
}
return {
- isShow,
- setWalletToId
+ onClickWallet,
+ afterClose
}
}
}
</script>
<template lang="pug">
-LazyTrnFormModal.doNotCloseTrnModal(
- v-if="isShow"
- :isShow="isShow"
- title="Transfer to wallet"
- position="bottom"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'transferTo')"
-)
- WalletsList3(@onClick="setWalletToId")
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template Transfer to wallet
+
+ template(#default="{ close }")
+ .trnFormWalletsList.scrollerBlock
+ WalletsList3(@onClick="walletId => onClickWallet(walletId, close)")
</template>
+
+<style lang="stylus">
+@import '~assets/stylus/variables'
+
+.trnFormWalletsList
+ overflow hidden
+ overflow-y auto
+ height 100%
+ padding-bottom 16px
+</style>
diff --git a/components/trnForm/modal/TrnFormModalTrn.vue b/components/trnForm/modal/TrnFormModalTrn.vue
deleted file mode 100644
index 0da16936..00000000
--- a/components/trnForm/modal/TrnFormModalTrn.vue
+++ /dev/null
@@ -1,117 +0,0 @@
-<script>
-export default {
- name: 'TrnFormModalTrn',
-
- data () {
- return {
- showModalConfirm: false,
- showModalBudgets: false,
- showModalGroups: false
- }
- },
- computed: {
- trnId () {
- return this.$store.state.trnForm.showModalTrnId
- },
- trn () {
- return this.$store.state.trns.items[this.trnId]
- },
- category () {
- return this.$store.state.categories.items[this.$store.state.trns.items[this.trnId].categoryId]
- },
- wallet () {
- return this.$store.state.wallets.items[this.$store.state.trns.items[this.trnId].walletId]
- },
- budgets () {
- return this.$store.getters['budgets/budgets']
- },
- groups () {
- return this.$store.getters['groups/groups']
- }
- },
-
- methods: {
- handleSetFilterCategory (id) {
- this.$store.commit('trns/hideTrnModal')
- this.$store.dispatch('ui/setActiveTab', 'stat')
- this.$store.commit('filter/setFilterDateNow')
- this.$store.dispatch('filter/setFilterCategoryId', this.$store.state.trns.items[this.trnId].categoryId)
- },
- handleSetFilterWallet (id) {
- this.$store.commit('trns/hideTrnModal')
- this.$store.dispatch('ui/setActiveTab', 'stat')
- this.$store.commit('filter/setFilterDateNow')
- this.$store.dispatch('filter/setFilterWalletId', this.$store.state.trns.items[this.trnId].walletId)
- },
- handleDublicateTrn () {
- const trnId = this.trnId
- this.$store.commit('trns/hideTrnModal')
- this.$store.dispatch('trnForm/openTrnForm', { action: 'duplicate', trnId })
- },
- handleEditClick () {
- const trnId = this.trnId
- this.$store.commit('trns/hideTrnModal')
- this.$store.dispatch('trnForm/openTrnForm', { action: 'edit', trnId })
- },
- handleDeleteClick () {
- this.showModalConfirm = true
- },
- handleDeleteConfirm () {
- const trnId = this.trnId
- this.showModalConfirm = false
- this.$store.commit('trns/hideTrnModal')
- this.$store.commit('trns/setTrnModalId', null)
- setTimeout(() => {
- this.$store.dispatch('trns/deleteTrn', trnId)
- }, 100)
- },
- toogleAddToBudget (budgetId) {
- this.$store.dispatch('budgets/toogleAddToBudget', { budgetId, trnId: this.trnId })
- this.showModalBudgets = false
- },
- toogleAddToGroup (groupId) {
- this.$store.dispatch('groups/toogleAddToGroup', { groupId, trnId: this.trnId })
- this.showModalGroups = false
- }
- }
-}
-</script>
-
-<template lang="pug">
-TrnFormModal.doNotCloseTrnModal(
- v-if="trnId"
- :show="$store.state.trnForm.modal.trn"
- :position="$store.state.ui.mobile ? 'bottom' : null"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'trn')"
-)
- .modalLinks
- ModalButton(
- name="Delete"
- icon="mdi mdi-delete"
- @onClick="handleDeleteClick")
-
- ModalButton(
- name="Edit"
- icon="mdi mdi-pencil"
- @onClick="handleEditClick")
-
- ModalButton(
- name="Dublicate"
- icon="mdi mdi-content-copy"
- @onClick="handleDublicateTrn")
-
- //- confirm
- ModalBottomConfirm(
- :show="showModalConfirm"
- @onClose="showModalConfirm = false"
- @onConfirm="handleDeleteConfirm")
-</template>
-
-<style lang="stylus">
-@import "~assets/stylus/variables/margins"
-
-.trnFormWalletsList
- .walletsList__toogle
- border-top 0
- padding-bottom 0
-</style>
diff --git a/components/trnForm/modal/TrnFormModalWallets.vue b/components/trnForm/modal/TrnFormModalWallets.vue
index 3ff6451d..df3a85bd 100644
--- a/components/trnForm/modal/TrnFormModalWallets.vue
+++ b/components/trnForm/modal/TrnFormModalWallets.vue
@@ -1,36 +1,44 @@
<script>
export default {
methods: {
- handleSetWallet (walletId) {
- this.$store.commit('trnForm/closeTrnFormModal', 'wallets')
+ handleSetWallet (walletId, close) {
this.$store.commit('trnForm/setTrnFormValues', { walletId })
+ close()
+ },
+
+ afterClose () {
+ this.$store.commit('trnForm/closeTrnFormModal', 'wallets')
}
}
}
</script>
<template lang="pug">
-TrnFormModal.doNotCloseTrnModal(
- :isShow="$store.state.trnForm.modal.wallets"
- :position="$store.state.ui.mobile ? 'bottom' : null"
- :title="$t('wallets.title')"
- @onClose="$store.commit('trnForm/closeTrnFormModal', 'wallets')"
-)
- .trnFormWalletsList
- WalletsList3(
- :activeItemId="$store.state.trnForm.values.walletId"
- :limit="6"
- :showBase="false"
- showToogle
- ui="widget"
- @onClick="handleSetWallet"
- )
+TrnFormModal(@closed="afterClose")
+ template(#header)
+ template {{ $t('wallets.title') }}
+
+ template(#default="{ close }")
+ .trnFormWalletsList.scrollerBlock
+ WalletsList3(
+ :activeItemId="$store.state.trnForm.values.walletId"
+ :limit="6"
+ :showBase="false"
+ showToogle
+ ui="widget"
+ @onClick="walletId => handleSetWallet(walletId, close)"
+ )
</template>
<style lang="stylus">
-@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables'
.trnFormWalletsList
+ overflow hidden
+ overflow-y auto
+ height 100%
+ padding-bottom 16px
+
.walletsList__toogle
margin 0
padding-bottom 0
diff --git a/components/trnForm/styles/trnForm.styl b/components/trnForm/styles/trnForm.styl
deleted file mode 100644
index 1042c8cd..00000000
--- a/components/trnForm/styles/trnForm.styl
+++ /dev/null
@@ -1,122 +0,0 @@
-.trnForm
- @media (max-width 999px)
- overflow hidden
- z-index 10
- position fixed
- left 0
- bottom 0
- width 100%
- height auto
-
- @media $media-laptop
- display grid
- margin $m7
- border-radius 16px
-
- &__overflow
- position absolute
- left 0
- bottom 0
- width 100%
- height 100%
- background var(--c-bg-14)
-
- @media (max-width 999px)
- position fixed
- right 0
- bottom 0
- width 100%
- height 100%
-
- @media $media-laptop
- opacity .3
-
- &__wrap
- overflow hidden
- overflow-y auto
- position relative
- display flex
- flex-grow 1
- flex-flow column nowrap
- margin 0 auto
- background var(--c-bg-4)
-
- @media (max-width 999px)
- max-width 500px
- max-height calc(100vh - 24px)
- margin 0 auto
-
- @media $media-laptop
- align-self center
- width 400px
- background 0
-
- &__scroll
- overflow hidden
- overflow-y auto
- scrollbar()
- @media $media-laptop
- background var(--c-bg-4)
-
- &__calendar
- padding $m7 0
-
- .categories
- padding-bottom 0
-
-.formTitle
- padding $m7
- fontFamilyNunito()
- color var(--c-font-4)
- font-size 18px
- font-weight 700
-
-.formCategories
- padding 0
- padding-bottom $m7
-
-.formWallets
- padding-bottom $m4
-
- &__input
- position relative
-
- &__value
- z-index 2
- position relative
- width 100%
- padding $m8 $m9
- color var(--c-font-2)
- font-header-1()
- font-size 36px
- font-weight 500
- text-align right
- background 0
- border 0
-
-.trnFormAnimation
- &-enter-active
- opacity 1
- anim()
-
- @media $media-phone
- transform translate(0, 0)
- transition opacity 100ms ease-out, transform 150ms ease-out
-
- @media $media-laptop
- transform translate(0, 0)
-
- &-enter
- opacity 0
- transition opacity 100ms ease-out, transform 150ms ease-out
-
- @media $media-phone
- transform translate(0, 10px)
-
- @media $media-laptop
- transform translate(10px, 0)
-
- &-leave-active
- &-leave-to
- opacity 0
- transition none
diff --git a/components/trnForm/styles/trnFormCalendar.styl b/components/trnForm/styles/trnFormCalendar.styl
deleted file mode 100644
index 45b3237e..00000000
--- a/components/trnForm/styles/trnFormCalendar.styl
+++ /dev/null
@@ -1,80 +0,0 @@
-.trnFormCalendar
- padding 0 $m8
-
-.inlineCalendar
- padding 0 $m7
- padding-bottom $m7
-
- .vdp-datepicker__calendar
- width auto
- background none
- border 0
-
- header
- display flex
- justify-content space-between
- align-items center
- line-height 1
- padding-bottom $m7
-
- .prev
- .next
- margin 0
- padding $m6 $m9
- background none
- border 1px solid var(--c-bg-5)
- border-radius 3px
- anim()
-
- &.disabled
- opacity 0
-
- &:hover
- background none
-
- .prev:after
- border-right 10px solid var(--c-bg-9)
-
- .next:after
- border-left 10px solid var(--c-bg-9)
-
- .day__month_btn
- .month__year_btn.up
- span
- margin 0 $m7
- padding $m6 0
- font-header-1()
- border-radius $m3
-
- &:hover
- background none !important
-
- @media $media-laptop
- background var(--c-bg-6) !important
-
- .cell
- height 46px
-
- .cell.day-header
- height auto
- padding-bottom $m5
- color rgb(117, 117, 117)
- line-height 1
-
- .day
- cursor pointer
- position relative
- padding-top $m2
- text-align center
- border-radius $m5
-
- .today
- color var(--c-font-1)
- background var(--c-bg-5)
-
- .disabled
- color var(--c-font-4)
-
- .selected
- color var(--c-font-1)
- background var(--c-blue-1)
diff --git a/locales/en-US.js b/locales/en-US.js
index f05ff4f0..b05e2419 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -1,4 +1,8 @@
export default {
+ common: {
+ date: 'Date'
+ },
+
analytics: {
title: 'Analytics'
},
@@ -275,6 +279,7 @@ export default {
},
dates: {
+ twoDaysAgo: '2 days ago',
day: {
current: 'Today',
today: 'Today',
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 40c09184..9dbed860 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -1,5 +1,9 @@
export default {
+ common: {
+ date: 'Дата'
+ },
+
analytics: {
title: 'Аналитика'
},
@@ -182,7 +186,7 @@ export default {
new: 'Новая категория',
allTitle: 'Все',
lastUsedTitle: 'Недавние',
- favoriteTitle: 'Любимые категории',
+ favoriteTitle: 'Любимые',
createNewTitle: 'Создание категории',
editTitle: 'Редактирование категории',
form: {
@@ -277,6 +281,7 @@ export default {
},
dates: {
+ twoDaysAgo: '2 дня назад',
day: {
current: 'Сегодня',
today: 'Сегодня',
diff --git a/store/categories/getters.js b/store/categories/getters.js
index cfecbbea..04b76dd5 100644
--- a/store/categories/getters.js
+++ b/store/categories/getters.js
@@ -87,12 +87,14 @@ export default {
if (state.items && rootGetters['trns/hasTrns']) {
for (const trnId of sortedTrnsIds.slice(0, 500)) {
- if (lastCategoriesIds.length < 21) {
+ if (lastCategoriesIds.length < 12) {
const categoryId = trns[trnId].categoryId
const category = state.items[categoryId]
if (category && (category.showInLastUsed || category.showInLastUsed === undefined)) {
if (categoryId !== transferCategoryId) {
- if (!lastCategoriesIds.includes(categoryId)) { lastCategoriesIds.push(categoryId) }
+ if (!lastCategoriesIds.includes(categoryId) && !getters.quickSelectorCategoriesIds.includes(categoryId)) {
+ lastCategoriesIds.push(categoryId)
+ }
}
}
}