Skip to content

Open source personal finance application

feat (ui): update mobile and pc ui

ilkome74f5be72a578
diff --git a/assets/stylus/variables/media.styl b/assets/stylus/variables/media.styl
index 4bce5463..1209e066 100644
--- a/assets/stylus/variables/media.styl
+++ b/assets/stylus/variables/media.styl
@@ -1,8 +1,8 @@
$media-phone = '(max-width: 767px)'
$media-phone-sm = '(max-width: 360px)'
$media-phone-normal = '(min-width: 360px)'
-$media-laptop = '(min-width: 1000px)'
-$media-pc = '(min-width: 1024px)'
+$media-laptop = '(min-width: 1300px)'
+$media-pc = '(min-width: 1300px)'
$media-xl = '(min-width: 1500px)'
$media-xl2 = '(min-width: 1800px)'
diff --git a/components/dashboard/Dashboard.vue b/components/dashboard/Dashboard.vue
index b51d0eb3..da9ac37d 100644
--- a/components/dashboard/Dashboard.vue
+++ b/components/dashboard/Dashboard.vue
@@ -11,9 +11,9 @@ export default {
const statCurrentPeriod = this.$store.getters['stat/statCurrentPeriod']
if (statCurrentPeriod.incomes.categoriesIds.length === 0 &&
statCurrentPeriod.expenses.categoriesIds.length === 0 &&
- this.$store.getters['trns/selectedTrnsIdsWithDate'].length === 0) {
+ this.$store.getters['trns/selectedTrnsIdsWithDate'].length === 0)
return true
- }
+
return false
},
@@ -66,12 +66,6 @@ export default {
.dashboard__tab._trns(v-show="$store.state.dashboard.activeTab === 'history'")
TrnsList(:size="50" :key="$store.state.filter.date")
- //- Dashboard Overview
- transition(name="animation-tab")
- .dashboard__wrap
- .dashboard__tab._trns(v-show="$store.state.dashboard.activeTab === 'overview'")
- DashboardOverview
-
transition(name="animation-tab")
.dashboard__tab(v-if="$store.state.dashboard.activeTab === 'balance'")
StatChartBalance(v-if="$store.getters['trns/hasTrns']")
diff --git a/components/dashboard/DashboardOverview.vue b/components/dashboard/DashboardOverview.vue
deleted file mode 100644
index b3af8183..00000000
--- a/components/dashboard/DashboardOverview.vue
+++ /dev/null
@@ -1,24 +0,0 @@
-<script>
-export default {
- name: 'DashboardOverview',
-
- computed: {
- statCurrentPeriod () {
- return this.$store.getters['stat/statCurrentPeriod']
- }
- }
-}
-</script>
-
-<template lang="pug">
-.overview
- h1 Overview
- pre {{ statCurrentPeriod.total }}
- pre {{ statCurrentPeriod.expenses }}
- pre {{ statCurrentPeriod.incomes }}
-
-</template>
-
-<style lang="stylus" scoped>
-//
-</style>
diff --git a/components/date/MobilePrevNextArrow.vue b/components/date/MobilePrevNextArrow.vue
new file mode 100644
index 00000000..9708635b
--- /dev/null
+++ b/components/date/MobilePrevNextArrow.vue
@@ -0,0 +1,76 @@
+<script>
+export default {
+}
+</script>
+
+<template lang="pug">
+div
+ .tabItem._left(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isLastPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodNext')"
+ )
+ svg(width="24" height="24" fill="currentColor")
+ path(d="M17.171 2.937a1.5 1.5 0 0 0-2.343-1.874l2.343 1.874zM8 12l-1.171-.937a1.5 1.5 0 0 0 0 1.874L8 12zm6.829 10.937a1.5 1.5 0 0 0 2.343-1.874l-2.343 1.874zm0-21.874l-8 10 2.343 1.874 8-10-2.343-1.874zm-8 11.874l8 10 2.343-1.874-8-10-2.343 1.874z")
+
+ .tabItem._right(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isFirstPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodPrev')"
+ )
+ svg(width="24" height="24" fill="currentColor")
+ path(d="M17.171 2.937a1.5 1.5 0 0 0-2.343-1.874l2.343 1.874zM8 12l-1.171-.937a1.5 1.5 0 0 0 0 1.874L8 12zm6.829 10.937a1.5 1.5 0 0 0 2.343-1.874l-2.343 1.874zm0-21.874l-8 10 2.343 1.874 8-10-2.343-1.874zm-8 11.874l8 10 2.343-1.874-8-10-2.343 1.874z")
+
+</template>
+
+<style lang="stylus" scoped>
+@import '~assets/stylus/variables'
+
+.tabItem
+ z-index 10
+ cursor pointer
+ position absolute
+ top 60%
+ display flex
+ align-items center
+ width 35px
+ height 60px
+ color var(--c-font-5)
+ anim()
+
+ &:last-child
+ margin-right 0
+
+ &._active
+ color var(--c-font-2)
+ border-bottom-color var(--c-blue-1)
+
+ +media-hover()
+ &:not(._disable)
+ color var(--c-font-1)
+ background var(--c-blue-1)
+
+ &._disable
+ opacity 0
+
+ &._left
+ left 0px
+ justify-content flex-start
+ border-radius 0 32px 32px 0
+
+ +media(950px)
+ left 16px
+ justify-content center
+ border-radius 32px
+
+ &._right
+ right 0px
+ justify-content flex-end
+ border-radius 32px 0 0 32px
+
+ +media(950px)
+ right 16px
+ justify-content center
+ border-radius 32px
+
+ svg
+ transform rotate(180deg)
+</style>
diff --git a/components/date/MobileSelector.vue b/components/date/MobileSelector.vue
index 8d714715..d1dde3e2 100644
--- a/components/date/MobileSelector.vue
+++ b/components/date/MobileSelector.vue
@@ -16,19 +16,9 @@ export default {
<template lang="pug">
.dateSelector
- .tabItem(
- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isLastPeriodSelected'] }"
- @click="$store.dispatch('filter/setPeriodNext')"
- ): .mdi.mdi-chevron-left
-
.menuDots(@click="showPeriodsNamesModal")
.menuDots__name: SharedDate(:type="2")
.menuDots__dots: .mdi.mdi-dots-vertical
-
- .tabItem(
- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isFirstPeriodSelected'] }"
- @click="$store.dispatch('filter/setPeriodPrev')"
- ): .mdi.mdi-chevron-right
</template>
<style lang="stylus" scoped>
@@ -40,42 +30,10 @@ export default {
top 0
display flex
align-items center
- justify-content space-between
+ justify-content center
padding 0 $m4
background var(--color-bg-canvas)
-.tabItem
- cursor pointer
- display flex
- align-items center
- justify-content center
- width 40px
- height 40px
- margin-right $m7
- color var(--c-font-3)
- font-size 26px
- background var(--c-bg-4)
- border-bottom 1px solid transparent
- border-radius 50%
- anim()
-
- &:last-child
- margin-right 0
-
- &._active
- color var(--c-font-2)
- border-bottom-color var(--c-blue-1)
-
- +media-hover()
- &:not(._disable)
- color var(--c-font-2)
- background var(--c-blue-1)
-
- &._disable
- cursor default
- opacity .3
- color var(--c-font-5)
-
.menuDots
cursor pointer
display flex
diff --git a/components/layout/mobile/StatMenu.vue b/components/layout/mobile/StatMenu.vue
index 5d93cf33..22e46694 100644
--- a/components/layout/mobile/StatMenu.vue
+++ b/components/layout/mobile/StatMenu.vue
@@ -64,22 +64,21 @@ export default {
.menuItem
cursor pointer
flex-grow 1
+ margin 0 $m5
padding $m6 $m8
color var(--c-font-5)
font-size 12px
font-weight 500
font-roboto()
text-align center
- border 1px solid transparent
- border-radius 50px
+ anim()
- &:active
- color var(--c-font-2)
- background var(--c-blue-1)
+ +media-hover()
+ cursor pointer
+ color var(--c-blue-1)
&._active
- cursor default
color var(--c-font-3)
background var(--c-bg-5)
- border 1px solid var(--c-bg-5)
+ border-radius 50px
</style>
diff --git a/components/stat/Mobile.vue b/components/stat/Mobile.vue
index 5aae22a5..41d2ed2a 100644
--- a/components/stat/Mobile.vue
+++ b/components/stat/Mobile.vue
@@ -60,9 +60,8 @@ export default {
// Stat with last periods
const statWithLastPeriods = computed(() => {
- if (!isFirstPeriodSelected.value) {
+ if (!isFirstPeriodSelected.value)
return statCurrentPeriod.value
- }
const cats = computed(() => store.state.categories.items)
let stat = JSON.parse(JSON.stringify(statCurrentPeriod.value))
@@ -71,30 +70,29 @@ export default {
let expensesIDs = []
for (const catId in currentAndLastPeriodStat.value.categories) {
- if (filter.value.categoryId) { break }
+ if (filter.value.categoryId) break
if (!statCurrentPeriod.value.categories[catId]) {
stat.categories[catId] = {
expenses: 0,
incomes: 0,
total: 0
}
- if (currentAndLastPeriodStat.value.expenses.categoriesIds.find(id => id === catId)) {
+ if (currentAndLastPeriodStat.value.expenses.categoriesIds.find(id => id === catId))
expensesIDs.push(catId)
- }
- if (currentAndLastPeriodStat.value.incomes.categoriesIds.find(id => id === catId)) {
+
+ if (currentAndLastPeriodStat.value.incomes.categoriesIds.find(id => id === catId))
incomesIDs.push(catId)
- }
}
}
incomesIDs = incomesIDs.sort((a, b) => {
- if (cats.value[a].name < cats.value[b].name) { return -1 }
- if (cats.value[a].name > cats.value[b].name) { return 1 }
+ if (cats.value[a].name < cats.value[b].name) return -1
+ if (cats.value[a].name > cats.value[b].name) return 1
return 0
})
expensesIDs = expensesIDs.sort((a, b) => {
- if (cats.value[a].name < cats.value[b].name) { return -1 }
- if (cats.value[a].name > cats.value[b].name) { return 1 }
+ if (cats.value[a].name < cats.value[b].name) return -1
+ if (cats.value[a].name > cats.value[b].name) return 1
return 0
})
@@ -132,7 +130,6 @@ export default {
moneyTypes,
statToday,
-
statWithLastPeriods
}
}
@@ -145,6 +142,7 @@ export default {
LazyChartMobileStatLines(v-if="ui.showMainChart && isShowChart")
.baseBox._noBg
+ DateMobilePrevNextArrow
DateMobileSelector
.baseBox._noBg(v-if="isShowFilter")
@@ -171,85 +169,88 @@ export default {
)
//- Loop throw incomes / expenses
- template(
- v-for="item in moneyTypes"
- v-if="activeTabStat === 'details' || (activeTabStat === 'incomes' && item.id === 'incomes') || (activeTabStat === 'expenses' && item.id === 'expenses')"
- )
- template(v-if="(statAverage && statAverage[item.id] !== 0) || $store.state.filter.period === 'all'")
- .baseBox
- .baseBox__title {{ $t(`money.${item.id}`) }}
- .boxSummary2
- .boxSummary2__item
- Amount(
- :currency="$store.state.currencies.base"
+ .statMoneyTypes
+ template(
+ v-for="item in moneyTypes"
+ v-if="activeTabStat === 'details' || (activeTabStat === 'incomes' && item.id === 'incomes') || (activeTabStat === 'expenses' && item.id === 'expenses')"
+ )
+ template(v-if="(statAverage && statAverage[item.id] !== 0) || $store.state.filter.period === 'all'")
+ .baseBox._noBdMedia._mw
+ .baseBox__title {{ $t(`money.${item.id}`) }}
+ .boxSummary2
+ .boxSummary2__item
+ Amount(
+ :currency="$store.state.currencies.base"
+ :type="item.type"
+ :value="statCurrentPeriod[item.id].total"
+ size="xl"
+ vertical="left"
+ )
+ StatSummaryRowItemView(
:type="item.type"
- :value="statCurrentPeriod[item.id].total"
- size="xl"
- vertical="left"
+ :amount="statAverage[item.id]"
+ :title="$t(`money.average.${item.id}`)"
+ )
+ StatSummaryRowItemView(
+ v-if="statToday && statToday[item.id].total !== 0 && $store.state.filter.period !== 'day'"
+ :type="item.type"
+ :amount="statToday[item.id].total"
+ :title="$t('dates.day.today')"
)
- StatSummaryRowItemView(
- :type="item.type"
- :amount="statAverage[item.id]"
- :title="$t(`money.average.${item.id}`)"
- )
- StatSummaryRowItemView(
- v-if="statToday && statToday[item.id].total !== 0 && $store.state.filter.period !== 'day'"
- :type="item.type"
- :amount="statToday[item.id].total"
- :title="$t('dates.day.today')"
- )
- .boxEmpty(v-if="statCurrentPeriod[item.id].categoriesIds.length === 0") {{ $t('stat.empty') }}
+ .boxEmpty(v-if="statCurrentPeriod[item.id].categoriesIds.length === 0") {{ $t('stat.empty') }}
- //- Pie chart
- .statChartPie(v-if="ui.showPieChart")
- LazyStatChartPie(
- v-if="ui.showPieChart && statCurrentPeriod[item.id].categoriesIds.length"
- :amountType="item.id"
- )
-
- //- Cats vertical chart
- StatCatsPeriodCatsChart(
- v-if="ui.showCatsVerticalChart && $store.state.ui.catsChart === 'visible' && statCurrentPeriod[item.id].categoriesIds.length > 1"
- :type="item.id"
- )
+ //- Pie chart
+ .statChartPie(v-if="ui.showPieChart")
+ LazyStatChartPie(
+ v-if="ui.showPieChart && statCurrentPeriod[item.id].categoriesIds.length"
+ :amountType="item.id"
+ )
- //- Round cats list
- .statItemsTiles(v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0")
- LazyStatItemRound(
- v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0"
- v-for="categoryId in statWithLastPeriods[item.id].categoriesIds"
- :biggest="statWithLastPeriods[item.id].biggest"
- :category="$store.state.categories.items[categoryId]"
- :categoryId="categoryId"
- :currency="$store.state.currencies.base"
- :key="categoryId"
- :total="statWithLastPeriods.categories[categoryId][item.id]"
- :type="item.type"
+ //- Cats vertical chart
+ StatCatsPeriodCatsChart(
+ v-if="ui.showCatsVerticalChart && $store.state.ui.catsChart === 'visible' && statCurrentPeriod[item.id].categoriesIds.length > 1"
+ :type="item.id"
)
- //- Cats horizontal list
- .statCategories(v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0")
- LazyStatItemMobile(
- v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0"
- v-for="categoryId in statCurrentPeriod[item.id].categoriesIds"
- :key="categoryId"
- :biggest="statCurrentPeriod[item.id].biggest"
- :category="$store.state.categories.items[categoryId]"
- :categoryId="categoryId"
- :currency="$store.state.currencies.base"
- :total="statCurrentPeriod.categories[categoryId][item.id]"
- :type="item.type"
- )
+ //- Cats horizontal list
+ .statCategories(v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0")
+ LazyStatItemMobile(
+ v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0"
+ v-for="categoryId in statCurrentPeriod[item.id].categoriesIds"
+ :key="categoryId"
+ :biggest="statCurrentPeriod[item.id].biggest"
+ :category="$store.state.categories.items[categoryId]"
+ :categoryId="categoryId"
+ :currency="$store.state.currencies.base"
+ :total="statCurrentPeriod.categories[categoryId][item.id]"
+ :type="item.type"
+ )
- .baseBox(v-if="ui.showHistory && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0")
- .baseBox__title {{ $t('trns.history') }}
- .baseBox__content
- TrnsList3(
- :incomes="activeTabStat === 'incomes'"
- :expenses="activeTabStat === 'expenses'"
- :size="activeTabStat === 'history' ? 30 : 8"
- )
+ //- Round cats list
+ .statItemsTiles(v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0")
+ LazyStatItemRound(
+ v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0"
+ v-for="categoryId in statWithLastPeriods[item.id].categoriesIds"
+ :biggest="statWithLastPeriods[item.id].biggest"
+ :category="$store.state.categories.items[categoryId]"
+ :categoryId="categoryId"
+ :currency="$store.state.currencies.base"
+ :key="categoryId"
+ :total="statWithLastPeriods.categories[categoryId][item.id]"
+ :type="item.type"
+ )
+
+ //- history
+ .statMoneyTypes
+ .baseBox(v-if="ui.showHistory && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0")
+ .baseBox__title {{ $t('trns.history') }}
+ .baseBox__content
+ TrnsList3(
+ :incomes="activeTabStat === 'incomes'"
+ :expenses="activeTabStat === 'expenses'"
+ :size="activeTabStat === 'history' ? 30 : 8"
+ )
//- Analytics
//-----------------------------
@@ -302,6 +303,17 @@ export default {
scrollbar()
height 100%
+// ------------------------------------
+.statMoneyTypes
+ +media(700px)
+ display grid
+ grid-template-columns 1fr 1fr
+ grid-column-gap 96px
+ grid-row-gap 64px
+
+ .baseBox:last-child
+ border none
+
// ------------------------------------
.boxFlew2
&._double
@@ -317,17 +329,21 @@ export default {
.baseBox
overflow hidden
margin $m5 0
- padding $m5 $m4
+ padding $m5 $m7
border-bottom 1px solid var(--c-bg-7)
- &:first-child
- margin-top 0
- padding-top 0
+ +media(700px)
+ padding $m8 $m8
- &:last-child
- border none
+ &._mw
+ max-width 480px
+
+ &._noBdMedia
+ +media(700px)
+ border none
&._noBg
+ padding-bottom 0
background none
border none
@@ -339,6 +355,9 @@ export default {
margin $m3 0
padding $m3 $m4
+ +media(700px)
+ padding $m8 $m5
+
&__title
z-index 9
display flex
@@ -350,6 +369,11 @@ export default {
font-weight 600
text-transform uppercase
+ +media(700px)
+ padding-bottom $m7
+ font-secondary()
+ font-size 18px
+
// ------------------------------------
.boxEmpty
padding 0 $m7
diff --git a/components/stat/StatPc.vue b/components/stat/StatPc.vue
index d11c2dd6..54f52a98 100644
--- a/components/stat/StatPc.vue
+++ b/components/stat/StatPc.vue
@@ -1,38 +1,152 @@
<script>
import { computed, useContext } from '@nuxtjs/composition-api'
+import dayjs from 'dayjs'
import useUIView from '~/components/layout/useUIView'
import useStat from '~/modules/stat/useStat'
+import getStat from '~/modules/stat/getStat'
+import useTrns from '~/modules/trns/useTrns'
export default {
setup () {
- const { store } = useContext()
+ const { store, app: { $day } } = useContext()
const { ui } = useUIView()
// Stat
- const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
const { moneyTypes } = useStat()
+ const { getStatBy } = getStat()
+ const { getTrnsIds } = useTrns()
+
+ const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
+ const statAverage = computed(() => store.getters['stat/statAverage'])
+ const filter = computed(() => store.state.filter)
+ // const filterDate = computed(() => store.state.filter.date)
+ const filterDate = computed(() => store.state.filter.date)
+ const filterPeriod = computed(() => store.state.filter.period)
+
+ // Last selected period
+ const isFirstPeriodSelected = computed(() => store.getters['stat/isFirstPeriodSelected'])
+
+ // Stat today
+ const statToday = computed(() => {
+ if (!isFirstPeriodSelected.value) {
+ return store.getters['stat/getStat']({
+ date: dayjs().valueOf(),
+ periodName: 'day'
+ })
+ }
+ return null
+ })
+
+ // Current and last period
+ const currentAndLastPeriodTrnsIds = computed(() => getTrnsIds({
+ walletId: computed(() => store.state.filter.walletId).value,
+ categoryId: computed(() => store.state.filter.categoryId).value,
+ date: {
+ from: $day(filterDate.value).subtract(2, filterPeriod.value).valueOf(),
+ to: $day(filterDate.value).valueOf()
+ }
+ }))
+ const currentAndLastPeriodStat = computed(() => getStatBy(currentAndLastPeriodTrnsIds.value))
+
+ // Stat with last periods
+ const statWithLastPeriods = computed(() => {
+ if (!isFirstPeriodSelected.value)
+ return statCurrentPeriod.value
+
+ const cats = computed(() => store.state.categories.items)
+ let stat = JSON.parse(JSON.stringify(statCurrentPeriod.value))
+
+ let incomesIDs = []
+ let expensesIDs = []
+
+ for (const catId in currentAndLastPeriodStat.value.categories) {
+ if (filter.value.categoryId) break
+ if (!statCurrentPeriod.value.categories[catId]) {
+ stat.categories[catId] = {
+ expenses: 0,
+ incomes: 0,
+ total: 0
+ }
+ if (currentAndLastPeriodStat.value.expenses.categoriesIds.find(id => id === catId))
+ expensesIDs.push(catId)
+
+ if (currentAndLastPeriodStat.value.incomes.categoriesIds.find(id => id === catId))
+ incomesIDs.push(catId)
+ }
+ }
+
+ incomesIDs = incomesIDs.sort((a, b) => {
+ if (cats.value[a].name < cats.value[b].name) return -1
+ if (cats.value[a].name > cats.value[b].name) return 1
+ return 0
+ })
+ expensesIDs = expensesIDs.sort((a, b) => {
+ if (cats.value[a].name < cats.value[b].name) return -1
+ if (cats.value[a].name > cats.value[b].name) return 1
+ return 0
+ })
+
+ stat = {
+ ...stat,
+ incomes: {
+ ...stat.incomes,
+ categoriesIds: [...stat.incomes.categoriesIds, ...incomesIDs]
+ },
+ expenses: {
+ ...stat.expenses,
+ categoriesIds: [...stat.expenses.categoriesIds, ...expensesIDs]
+ }
+ }
+
+ return stat
+ })
return {
ui,
+ moneyTypes,
+
+ statAverage,
statCurrentPeriod,
- moneyTypes
+ statToday,
+ statWithLastPeriods
}
}
}
</script>
<template lang="pug">
-.stat
- .stat__content
- //- Loop throw incomes / expenses
- .statItemPc(
- v-for="item in moneyTypes"
- :key="item.type"
- )
- .stat__empty(v-if="!statCurrentPeriod[item.id].categoriesIds.length") No data
-
- template(v-if="statCurrentPeriod[item.id].categoriesIds.length")
+//- Loop throw incomes / expenses
+.statMoneyTypes
+ template(
+ v-for="item in moneyTypes"
+ )
+ template(v-if="(statAverage && statAverage[item.id] !== 0) || $store.state.filter.period === 'all'")
+ .baseBox._noBdMedia._mw
+ .baseBox__title {{ $t(`money.${item.id}`) }}
+ .boxSummary2
+ .boxSummary2__item
+ Amount(
+ :currency="$store.state.currencies.base"
+ :type="item.type"
+ :value="statCurrentPeriod[item.id].total"
+ size="xl"
+ vertical="left"
+ )
+ StatSummaryRowItemView(
+ :type="item.type"
+ :amount="statAverage[item.id]"
+ :title="$t(`money.average.${item.id}`)"
+ )
+ StatSummaryRowItemView(
+ v-if="statToday && statToday[item.id].total !== 0 && $store.state.filter.period !== 'day'"
+ :type="item.type"
+ :amount="statToday[item.id].total"
+ :title="$t('dates.day.today')"
+ )
+
+ .boxEmpty(v-if="statCurrentPeriod[item.id].categoriesIds.length === 0") {{ $t('stat.empty') }}
+
//- Pie chart
.statChartPie(v-if="ui.showPieChart")
LazyStatChartPie(
@@ -41,71 +155,104 @@ export default {
)
//- Cats vertical chart
- .statCatsPeriodCatsChart(v-if="ui.showCatsVerticalChart")
- LazyStatCatsPeriodCatsChart(
- v-if="ui.showCatsVerticalChart"
- :type="item.id"
- )
+ StatCatsPeriodCatsChart(
+ v-if="ui.showCatsVerticalChart && $store.state.ui.catsChart === 'visible' && statCurrentPeriod[item.id].categoriesIds.length > 1"
+ :type="item.id"
+ )
//- Round cats list
- .statItemsTiles(v-if="ui.showRoundCats && statCurrentPeriod[item.id].categoriesIds.length > 0")
+ .statItemsTiles(v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0")
LazyStatItemRound(
- v-if="ui.showRoundCats && statCurrentPeriod[item.id].categoriesIds.length > 0"
- v-for="categoryId in statCurrentPeriod[item.id].categoriesIds"
- :biggest="statCurrentPeriod[item.id].biggest"
+ v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0"
+ v-for="categoryId in statWithLastPeriods[item.id].categoriesIds"
+ :biggest="statWithLastPeriods[item.id].biggest"
:category="$store.state.categories.items[categoryId]"
:categoryId="categoryId"
:currency="$store.state.currencies.base"
:key="categoryId"
- :total="statCurrentPeriod.categories[categoryId][item.id]"
+ :total="statWithLastPeriods.categories[categoryId][item.id]"
:type="item.type"
)
//- Cats horizontal list
- .stat__cats(v-if="ui.showCatsHorizontalList")
+ .statCategories(v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0")
StatItem(
+ v-if="ui.showCatsHorizontalList && statCurrentPeriod[item.id].categoriesIds.length > 0"
v-for="categoryId in statCurrentPeriod[item.id].categoriesIds"
+ :key="categoryId"
:biggest="statCurrentPeriod[item.id].biggest"
:category="$store.state.categories.items[categoryId]"
:categoryId="categoryId"
:currency="$store.state.currencies.base"
+ :total="statCurrentPeriod.categories[categoryId][item.id]"
:type="item.type"
- :key="categoryId"
- :total="statCurrentPeriod.categories[categoryId][item.id]")
+ )
+
</template>
<style lang="stylus" scoped>
-@import '~assets/stylus/variables/margins'
-@import '~assets/stylus/variables/media'
-
-.stat
- position relative
- padding 0 60px
- padding-top $m9
+@import '~assets/stylus/variables'
+// ------------------------------------
+.statMoneyTypes
+ padding 0 32px
- &__content
+ +media(700px)
display grid
- grid-template-columns repeat(auto-fill, minmax(280px, 47%))
- grid-column-gap $m10
- grid-row-gap $m10
+ grid-template-columns 1fr 1fr
+ grid-column-gap 96px
+ grid-row-gap 64px
- &__chart
- display flex
- @media $media-laptop
- padding-bottom 12px
+ .baseBox:last-child
+ border none
- &__cats
- max-width 380px
+// ------------------------------------
+.baseBox
+ overflow hidden
+ margin $m5 0
+ padding $m5 $m7
+ border-bottom 1px solid var(--c-bg-7)
+
+ +media(700px)
+ padding $m8 $m8
+
+ &._mw
+ max-width 480px
+
+ &._noBdMedia
+ +media(700px)
+ border none
+
+ &._noBg
+ padding-bottom 0
+ background none
+ border none
- @media $media-laptop
- padding-top $m7
+ &._noBd
+ border none
- &__empty
- padding $m10
- color var(--c-font-4)
+ &._noBg
+ &._noBd
+ margin $m3 0
+ padding $m3 $m4
- @media $media-laptop
- text-align center
+ +media(700px)
+ padding $m8 $m5
+
+ &__title
+ z-index 9
+ display flex
+ align-items center
+ padding $m6 $m6
+ color var(--c-font-3)
+ font-size 10px
+ letter-spacing 1px
+ font-weight 600
+ text-transform uppercase
+
+ +media(700px)
+ padding-bottom $m7
+ font-secondary()
+ font-size 18px
// ------------------------------------
.statItemsTiles
@@ -114,7 +261,19 @@ export default {
grid-column-gap 0
grid-row-gap 0
+.statCategories
+ padding $m7 $m5
+
// ------------------------------------
-.statCatsPeriodCatsChart
- padding-bottom $m7
+.boxSummary2
+ z-index 9
+ display flex
+ align-items center
+ justify-content flex-start
+ margin-bottom $m3
+ padding 0 $m5
+ padding-bottom $m5
+
+ &__item
+ padding-right $m9
</style>
diff --git a/components/stat/StatSummaryPc.vue b/components/stat/StatSummaryPc.vue
index dae453b5..20742309 100644
--- a/components/stat/StatSummaryPc.vue
+++ b/components/stat/StatSummaryPc.vue
@@ -1,169 +1,73 @@
<script>
+import { computed, useContext } from '@nuxtjs/composition-api'
+
export default {
- computed: {
- statCurrentPeriod () {
- return this.$store.getters['stat/statCurrentPeriod']
- },
+ setup () {
+ const { store } = useContext()
- statAverage () {
- return this.$store.getters['stat/statAverage']
- },
+ const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
+ const statAverage = computed(() => store.getters['stat/statAverage'])
- period () {
- return this.$store.state.filter.period
+ return {
+ statCurrentPeriod,
+ statAverage
}
}
}
</script>
<template lang="pug">
-.summary
- .summary__wrap
- //- expenses
- //------------------------------------------------
- .summary__item(:class="{ _expenses: statAverage.expenses > 0 || period === 'all' }")
- template(v-if="statAverage.expenses > 0 || period === 'all'")
- .summary__row
- .summary__title._expenses {{ $t('money.expenses') }}
- .summary__amount
- Amount(
- :big="true"
- :currency="$store.state.currencies.base"
- :value="statCurrentPeriod.expenses.total"
- :type="0")
-
- .summary__row(v-if="period !== 'all' && statAverage.expenses > 0")
- .summary__average
- .summary__average__icon: .mdi.mdi-chart-timeline
- .summary__average__title {{ $t('money.average.base') }}
- .summary__amount._average
- Amount(
- :currency="$store.state.currencies.base"
- :value="statAverage.expenses")
-
- //- total
- //------------------------------------------------
- .summary__item(:class="{ _total: statAverage.total !== 0 || period === 'all' }")
- template(v-if="statAverage.total !== 0 || period === 'all'")
- .summary__row
- .summary__title {{ $t('money.total') }}
- .summary__amount
- Amount(
- :big="true"
- :currency="$store.state.currencies.base"
- :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total")
-
- template(v-if="period !== 'all' && statAverage.total !== 0")
- .summary__row
- .summary__average
- .summary__average__icon: .mdi.mdi-chart-timeline
- .summary__average__title {{ $t('money.average.base') }}
- .summary__amount._average
- Amount(
- :currency="$store.state.currencies.base"
- :value="statAverage.total")
-
- //- incomes
- //------------------------------------------------
- .summary__item(:class="{ _incomes: statAverage.incomes > 0 || period === 'all' }")
- template(v-if="statAverage.incomes > 0 || period === 'all'")
- .summary__row
- .summary__title._incomes {{ $t('money.incomes') }}
- .summary__amount
- Amount(
- :big="true"
- :currency="$store.state.currencies.base"
- :value="statCurrentPeriod.incomes.total"
- :type="1")
-
- template(v-if="period !== 'all' && statAverage.incomes !== 0")
- .summary__row
- .summary__average
- .summary__average__icon: .mdi.mdi-chart-timeline
- .summary__average__title {{ $t('money.average.base') }}
- .summary__amount._average
- Amount(
- :currency="$store.state.currencies.base"
- :value="statAverage.incomes")
+.baseBox(v-if="statAverage.incomes !== 0 && statAverage.expenses !== 0 && $store.state.filter.period !== 'all'")
+ .baseBox__title {{ $t('money.total') }}
+ .boxSummary2
+ .boxSummary2__item
+ Amount(
+ :currency="$store.state.currencies.base"
+ :type="(statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total) > 0 ? 1 : 0"
+ :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total"
+ size="xl"
+ vertical="left"
+ )
+ StatSummaryRowItemView(
+ :type="(statAverage.incomes - statAverage.expenses) > 0 ? 1 : 0"
+ :amount="statAverage.incomes - statAverage.expenses"
+ :title="$t('money.averageTotal')"
+ )
</template>
<style lang="stylus" scoped>
-@import '~assets/stylus/variables/margins'
-@import '~assets/stylus/variables/fonts'
-@import '~assets/stylus/variables/media'
+@import '~assets/stylus/variables'
-.summary
+.baseBox
overflow hidden
+ padding $m5 $m7
background var(--c-bg-3)
border-top 1px solid var(--c-bg-2)
- border-bottom 1px solid var(--c-bg-2)
-
- &__wrap
- display grid
- flex-flow row
- grid-template-columns repeat(auto-fill, minmax(200px, 1fr))
- grid-column-gap $m9
- grid-row-gap $m9
- max-width 1100px
- padding 20px 60px
-
- &__item
- flex-grow 0
- display flex
- flex-flow column
- justify-content center
- margin $m5 $m7
- padding $m3 $m9
- padding-right 0
-
- @media $media-laptop
- padding $m3 $m8
- padding-right 0
- &._expenses
- border-left 2px solid rgba(200, 30, 50, .3)
-
- &._total
- align-self center
- border-left 2px solid var(--c-bg-6)
-
- &._incomes
- align-self end
- border-left 2px solid rgba(44, 173, 34, .5)
-
- &__row
- flex-grow 0
- display flex
- align-items center
- justify-content space-between
- padding-bottom $m6
- &:last-child
- padding-bottom 0
+ +media(700px)
+ padding $m5 54px
&__title
- font-header-4()
- padding-right $m8
- &._incomes
- color var(--c-incomes-1)
- &._expenses
- color var(--c-expenses-1)
-
- &__amount
- &._average
- opacity .7
- .amount
- font-size 15px
-
- &__average
- opacity .7
+ z-index 9
display flex
+ align-items center
+ padding $m6 $m6
+ color var(--c-font-3)
+ font-size 10px
+ letter-spacing 1px
+ font-weight 500
+ text-transform uppercase
+
+// ------------------------------------
+.boxSummary2
+ z-index 9
+ display flex
+ align-items center
+ justify-content flex-start
+ margin-bottom $m3
+ padding 0 $m5
+ padding-bottom $m5
- &__icon
- margin-right $m5
- font-size 15px
-
- &__title
- padding-right $m8
- font-header-4()
- font-size 16px
+ &__item
+ padding-right $m9
</style>
diff --git a/components/trns/item/TrnItem.vue b/components/trns/item/TrnItem.vue
index 4b17fa46..03269a0e 100644
--- a/components/trns/item/TrnItem.vue
+++ b/components/trns/item/TrnItem.vue
@@ -439,7 +439,7 @@ export default {
//
&._active
- &._history
+ // &._history
&._trnForm
margin-right - ($m7)
margin-left - ($m7)
diff --git a/store/ui/actions.js b/store/ui/actions.js
index 63e8a4e7..a5880556 100644
--- a/store/ui/actions.js
+++ b/store/ui/actions.js
@@ -5,9 +5,8 @@ export default {
const uiLocalStore = await localforage.getItem('finapp.stat')
const activeTabViewName = await localforage.getItem('finapp.activeTabViewName')
- if (activeTabViewName) {
+ if (activeTabViewName)
commit('setActiveTabViewName', activeTabViewName)
- }
// ui
if (uiLocalStore) {
@@ -41,7 +40,7 @@ export default {
*
* @param {string} theme - New theme value (light, dark).
*/
- changeTheme (props, theme) {
+ changeTheme (_, theme) {
// eslint-disable-next-line no-undef
const currentTheme = $nuxt.$colorMode.value
let newTheme
@@ -62,7 +61,7 @@ export default {
*/
setAppDimensions ({ commit }, { height, width }) {
let view = 'mobile'
- if (width >= 1000) { view = 'pc' }
+ if (width >= 1300) view = 'pc'
commit('setAppDimensions', {
mobile: view === 'mobile',