Skip to content

Open source personal finance application

update 3.6.0

ilkome6247e29b7a38
diff --git a/assets/js/isTouchDevice.js b/assets/js/isTouchDevice.js
new file mode 100644
index 00000000..ddc6bd5e
--- /dev/null
+++ b/assets/js/isTouchDevice.js
@@ -0,0 +1,8 @@
+export default function isTouchDevice () {
+ if (
+ ('ontouchstart' in window) ||
+ (window.DocumentTouch && document instanceof DocumentTouch)) {
+ return true
+ }
+ return false
+}
diff --git a/components/Metrica.vue b/components/Metrica.vue
index 283f7955..784dbfc4 100644
--- a/components/Metrica.vue
+++ b/components/Metrica.vue
@@ -32,8 +32,6 @@ export default {
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/49428823" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
-
- <!-- Hotjar Tracking Code for https://finapp.ilko.me -->
</client-only>
</div>
</template>
diff --git a/components/dashboard/Dashboard.vue b/components/dashboard/Dashboard.vue
index d20bf752..9b40f53d 100644
--- a/components/dashboard/Dashboard.vue
+++ b/components/dashboard/Dashboard.vue
@@ -9,6 +9,7 @@ export default {
computed: {
isEmptyData () {
const statCurrentPeriod = this.$store.getters['stat/statCurrentPeriod']
+ console.log(statCurrentPeriod)
if (statCurrentPeriod.incomes.categoriesIds.length === 0 &&
statCurrentPeriod.expenses.categoriesIds.length === 0 &&
this.$store.getters['trns/selectedTrnsIdsWithDate'].length === 0) {
@@ -18,6 +19,7 @@ export default {
},
periods () {
+ console.log(this.$store.state.chart.periods)
return this.$store.state.chart.periods
},
diff --git a/components/dashboard/DashboardNav.vue b/components/dashboard/DashboardNav.vue
index 9fc41225..53bf744b 100644
--- a/components/dashboard/DashboardNav.vue
+++ b/components/dashboard/DashboardNav.vue
@@ -96,8 +96,8 @@ export default {
template(slot="content")
ContextMenuItem(
:title="$t('stat.customize.showPeriodsChart')"
- :showCheckbox="true"
:checkboxValue="$store.state.ui.statGraphsVisibility === 'visible'"
+ showCheckbox
icon="mdi mdi-chart-bar-stacked"
@onClick="toogleShowStatGraphs"
)
@@ -105,19 +105,27 @@ export default {
ContextMenuItem(
icon="mdi mdi-folder-star"
:title="$t('stat.customize.showCategorisChart')"
- :showCheckbox="true"
:checkboxValue="$store.state.ui.catsChart === 'visible'"
+ showCheckbox
@onClick="toogleVisibleCatsChart"
)
ContextMenuItem(
:title="$t('stat.customize.showCategorisList')"
- :showCheckbox="true"
:checkboxValue="$store.state.ui.statItems === 'visible'"
+ showCheckbox
icon="mdi mdi-chart-gantt"
@onClick="toogleVisibilityStatItems"
)
+ ContextMenuItem(
+ :checkboxValue="$store.state.ui.catsChartPie === 'visible'"
+ :title="$t('stat.customize.showcatsChartPie')"
+ showCheckbox
+ icon="mdi mdi-chart-pie"
+ @onClick="$store.dispatch('ui/toogleVisibleCatsChartPie')"
+ )
+
.context-menu-sep
ContextMenuItem(
diff --git a/components/dashboard/DashboardStatControl.vue b/components/dashboard/DashboardStatControl.vue
index af682dc4..570244bb 100644
--- a/components/dashboard/DashboardStatControl.vue
+++ b/components/dashboard/DashboardStatControl.vue
@@ -43,20 +43,14 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-$background = var(--c-bg-3)
-$border = var(--c-bg-1)
-$text = var(--c-font-4)
-$text-active = var(--c-font-1)
-$text-disable = var(--c-font-5)
-
.component
- background $background
+ background var(--c-bg-3)
&__wrap
display grid
grid-template-columns repeat(2, 1fr)
max-width 1100px
- padding 16px 60px
+ padding 0 60px
.tabs
display flex
@@ -67,18 +61,25 @@ $text-disable = var(--c-font-5)
cursor pointer
display flex
align-items center
- margin-right 30px
- color $text
+ margin-right $m7
+ padding $m6
+ color var(--c-font-4)
font-size 16px
+ border-bottom 1px solid transparent
anim()
&:last-child
margin-right 0
+ &._active
+ border-bottom-color var(--c-blue-1)
+
&._active
&:hover
- color $text-active
+ color var(--c-font-2)
&._disable
- color $text-disable
+ cursor default
+ opacity .3
+ color var(--c-font-5)
</style>
diff --git a/components/layout/LayoutMobile.vue b/components/layout/LayoutMobile.vue
index 68264cff..c52db1e2 100644
--- a/components/layout/LayoutMobile.vue
+++ b/components/layout/LayoutMobile.vue
@@ -192,7 +192,7 @@ export default {
//- Categories
//---------------------------------------------------------------------------
- template(v-if="activeTabViewName === 'wallets'")
+ template(v-if="activeTabViewName === 'categories'")
ComponentWrap(:contentPadding="false")
template(slot="headerLeft") {{ $t('categories.name') }}
@@ -242,7 +242,9 @@ export default {
//- Chart Nav
//-----------------------------
- .box._periods
+ .box._periods(
+ v-if="activeTabViewName === 'chart' || activeTabViewName === 'incomes' || activeTabViewName === 'expenses'"
+ )
.periods
.periodItem(
v-if="filterPeriod !== 'all'"
@@ -276,11 +278,25 @@ export default {
:isShowIncomes="activeTabViewName === 'incomes' || activeTabViewName === 'chart'"
:isShowExpenses="activeTabViewName === 'expenses' || activeTabViewName === 'chart'"
)
- //- ChartMenu2
//- History
//-----------------------------
template(v-if="activeTabViewName === 'history'")
+ .box__nav
+ .tabItem(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isLastPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodNext')"
+ ): .mdi.mdi-chevron-left
+
+ .menuDots(@click="isShowPeriodsNames = true")
+ .menuDots__name: Date(: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
+
.box
TrnsList3
@@ -292,7 +308,6 @@ export default {
v-if="filterPeriod !== 'all'"
v-show="activeTabViewName !== 'history'"
)
- //- ChartMenu2
StatChartLines(
v-if="filterPeriod !== 'all'"
:isShowIncomes="activeTabViewName === 'incomes' || activeTabViewName === 'chart'"
@@ -301,17 +316,27 @@ export default {
.boxFlew2
.boxFlew2Item
- PeriodCatsChart2(type="incomes")
+ PeriodCatsChartMobile(type="incomes")
.boxFlew2Item
- PeriodCatsChart2(type="expenses")
+ PeriodCatsChartMobile(type="expenses")
//- Period Selector
//---------------------------
.box__nav
+ .tabItem(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isLastPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodNext')"
+ ): .mdi.mdi-chevron-left
+
.menuDots(@click="isShowPeriodsNames = true")
.menuDots__name: Date(: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
+
//- Filter
//---------------------------
.page__filter(v-if="isShowFilter")
@@ -341,10 +366,15 @@ export default {
//- Cats incomes
//---------------------------
- .box._stat(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 0")
+ .box._stat(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
.box__content
PeriodCatsChart(type="incomes")
+ //- Pie chart
+ .box._stat(v-if="$store.state.ui.catsChartPie === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
+ .box__content
+ StatChartPie(amountType="incomes")
+
//- Stat incomes
//---------------------------
.box._stat(v-if="$store.state.ui.statItems === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 0")
@@ -383,10 +413,15 @@ export default {
.boxEmpty(v-if="statCurrentPeriod.expenses.categoriesIds.length === 0") {{ $t('stat.empty') }}
//---------------------------
- .box._stat(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.expenses.categoriesIds.length > 0")
+ .box._stat(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.expenses.categoriesIds.length > 1")
.box__content
PeriodCatsChart(type="expenses")
+ //- Pie chart
+ .box._stat(v-if="$store.state.ui.catsChartPie === 'visible' && statCurrentPeriod.expenses.categoriesIds.length > 1")
+ .box__content
+ StatChartPie(amountType="expenses")
+
//---------------------------
.box._stat(v-if="$store.state.ui.statItems === 'visible' && statCurrentPeriod.expenses.categoriesIds.length > 0")
.box__content
@@ -406,19 +441,6 @@ export default {
.box.boxStatTrns(style="paddingTop: 0")
TrnsList3(:size="10")
- //- Customize
- //---------------------------
- .box._periods
- .periods
- .periodItem(
- @click="$store.dispatch('ui/toogleVisibleCatsChart')"
- :class="{ _active: $store.state.ui.catsChart === 'visible' }"
- ) {{ $t('stat.customize.showCategorisChart') }}
- .periodItem(
- :class="{ _active: $store.state.ui.statItems === 'visible' }"
- @click="$store.dispatch('ui/toogleVisibilityStatItems')"
- ) {{ $t('stat.customize.showCategorisList') }}
-
//- Stat
//-----------------------------------------------------------------------
template(v-if="activeTabViewName === 'incomes' || activeTabViewName === 'expenses'")
@@ -428,7 +450,7 @@ export default {
.statLine(
v-if="statCurrentPeriod[activeTabStat].categoriesIds.length > 1 && !this.$store.state.filter.categoryId"
)
- PeriodCatsChart2(:type="activeTabStat")
+ PeriodCatsChartMobile(:type="activeTabStat")
//- Period Selector
//---------------------------
@@ -461,10 +483,15 @@ export default {
.boxEmpty(v-if="statCurrentPeriod[activeTabStat].categoriesIds.length === 0") {{ $t('stat.empty') }}
- .box(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod[activeTabStat].categoriesIds.length > 0")
+ .box(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod[activeTabStat].categoriesIds.length > 1")
.box__content
PeriodCatsChart(:type="activeTabStat")
+ //- Pie chart
+ .box._stat(v-if="$store.state.ui.catsChartPie === 'visible' && statCurrentPeriod[activeTabStat].categoriesIds.length > 1")
+ .box__content
+ StatChartPie(:amountType="activeTabStat")
+
.box(v-if="$store.state.ui.statItems === 'visible' && statCurrentPeriod[activeTabStat].categoriesIds.length > 0")
.box__content
StatItemMobile(
@@ -478,7 +505,7 @@ export default {
:type="activeTabStat === 'incomes' ? 1 : 0"
)
- template(v-if="$store.getters['trns/selectedTrnsIdsWithDate'].length > 0")
+ template(v-if="statCurrentPeriod[activeTabStat].categoriesIds.length > 0")
.boxTitle {{ $t('trns.history') }}
.box.boxStatTrns(style="paddingTop: 0")
TrnsList3(
@@ -487,17 +514,6 @@ export default {
:size="10"
)
- .box._periods
- .periods
- .periodItem(
- @click="$store.dispatch('ui/toogleVisibleCatsChart')"
- :class="{ _active: $store.state.ui.catsChart === 'visible' }"
- ) {{ $t('stat.customize.showCategorisChart') }}
- .periodItem(
- :class="{ _active: $store.state.ui.statItems === 'visible' }"
- @click="$store.dispatch('ui/toogleVisibilityStatItems')"
- ) {{ $t('stat.customize.showCategorisList') }}
-
.layoutMobile__menu.pageScrollerJsMenu
LayoutMobileMenu
@@ -514,6 +530,8 @@ export default {
@onClose="isShowPeriodsNames = false"
)
+ //- Base Menu
+ //-----------------------------------
Portal(
v-if="activeTab === 'menu'"
to="modal"
@@ -522,10 +540,30 @@ export default {
key="menu"
@onClose="$store.dispatch('ui/setActiveTab', 'stat')"
)
- Menu
-
+ BaseMenu
.context-menu-sep
+ template(v-if="activeTabViewName === 'chart' || activeTabViewName === 'incomes' || activeTabViewName === 'expenses'")
+ ContextMenuItem(
+ :checkboxValue="$store.state.ui.catsChart === 'visible'"
+ :title="$t('stat.customize.showCategorisChart')"
+ showCheckbox
+ @onClick="$store.dispatch('ui/toogleVisibleCatsChart')"
+ )
+ ContextMenuItem(
+ :checkboxValue="$store.state.ui.statItems === 'visible'"
+ :title="$t('stat.customize.showCategorisList')"
+ showCheckbox
+ @onClick="$store.dispatch('ui/toogleVisibilityStatItems')"
+ )
+ ContextMenuItem(
+ :checkboxValue="$store.state.ui.catsChartPie === 'visible'"
+ :title="$t('stat.customize.showcatsChartPie')"
+ showCheckbox
+ @onClick="$store.dispatch('ui/toogleVisibleCatsChartPie')"
+ )
+ .context-menu-sep
+
ContextMenuItem(
:title="$t('theme.change')"
icon="mdi mdi-palette"
@@ -616,6 +654,9 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.context-menu-sep
+ background var(--c-bg-1)
+
.menuDots
cursor pointer
display flex
@@ -701,13 +742,6 @@ export default {
max-width 640px
margin 0 auto
- .switcher2
- .switcher2__item
- +media-tablet()
- padding $m7 $m6
- font-size 14px
- font-weight 400
-
$border = 1px
.periods
@@ -862,9 +896,6 @@ $border = 1px
padding-bottom $m9
background var(--c-bg-4)
- +media-tablet()
- border-bottom 0
-
&._stat
padding-top $m6
@@ -919,10 +950,12 @@ $border = 1px
position sticky
top 0
display flex
- justify-content center
+ align-items center
+ justify-content space-between
height 38px
margin-top $m4
margin-bottom $m4
+ padding 0 $m7
background var(--c-bg-4)
&._noMargin
@@ -957,14 +990,6 @@ $border = 1px
scrollbar()
height 100%
- &__grid
- +media-tablet()
- display grid
- grid-template-columns repeat(auto-fill, minmax(300px, 1fr))
- grid-column-gap 40px
- grid-row-gap 40px
- padding 40px
-
&__block
z-index 10
opacity .99
@@ -1007,11 +1032,6 @@ $border = 1px
padding-bottom $m5
background var(--c-bg-3)
- +media-tablet()
- max-width 500px
- margin 0 auto
- padding $m8 0
-
&__nav
border-top 1px solid var(--c-bg-6)
border-bottom 1px solid var(--c-bg-6)
@@ -1051,4 +1071,33 @@ $border = 1px
color var(--c-font-3)
background none
border-bottom $border solid var(--c-blue-1)
+
+.tabItem
+ cursor pointer
+ display flex
+ align-items center
+ margin-right $m7
+ padding $m6
+ color var(--c-font-4)
+ font-size 16px
+ border-bottom 1px solid transparent
+ border-radius $m5
+ 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-bg-6)
+
+ &._disable
+ cursor default
+ opacity .3
+ color var(--c-font-5)
</style>
diff --git a/components/layout/LayoutPcSidebar.vue b/components/layout/LayoutPcSidebar.vue
deleted file mode 100644
index 53df8dda..00000000
--- a/components/layout/LayoutPcSidebar.vue
+++ /dev/null
@@ -1,134 +0,0 @@
-<script>
-export default {
- data () {
- return {
- visibleSettingsMenu: false
- }
- },
-
- computed: {
- activeTab () {
- return this.$store.state.ui.activeTab
- }
- },
-
- methods: {
- handleShowWalletModal (id) {
- this.$store.commit('wallets/showWalletModal')
- this.$store.commit('wallets/setWalletModalId', id)
- }
- }
-}
-</script>
-
-<template lang="pug" scoped>
-.sidebar
- .sidebar__top
- .sidebar__menu
- ContextMenu(
- :position="{ left: true, top: true }"
- :visible="visibleSettingsMenu"
- @onClickOpener="visibleSettingsMenu = !visibleSettingsMenu")
- template(slot="opener")
- .link(:class="{ _active: visibleSettingsMenu }"): .mdi.mdi-tune
-
- template(slot="content")
- ContextMenuItem(
- :title="$t('theme.change')"
- icon="mdi mdi-palette"
- @onClick="$store.dispatch('ui/changeTheme')"
- )
- ContextMenuItem(
- icon="mdi mdi-cog-outline"
- :title="$t('settings.open')"
- @onClick="$store.dispatch('ui/setActiveTab', 'settings')"
- @onClose="visibleSettingsMenu = !visibleSettingsMenu")
- .context-menu-sep
- ContextMenuItem(
- :title="$t('userLogout')"
- icon="mdi mdi-logout"
- @onClick="$store.dispatch('user/signOut')"
- @onClose="visibleSettingsMenu = !visibleSettingsMenu"
- )
-
- .sidebar__menu__item(
- :class="{ _active: activeTab === 'wallets'}"
- @click="$store.dispatch('ui/setActiveTab', 'wallets')"
- ): .mdi.mdi-credit-card-multiple
-
- .sidebar__menu__item(
- :class="{ _active: activeTab === 'categories'}"
- @click="$store.dispatch('ui/setActiveTab', 'categories')"
- ): .mdi.mdi-folder-star
-
- .sidebar__menu__item(
- :class="{ _active: activeTab === 'stat'}"
- @click="$store.dispatch('ui/setActiveTab', 'stat')"
- ): .mdi.mdi-poll
-
- Menu
-
- .sidebar__content
- WalletsTotal
-
- WalletsList(
- :showToogle="true"
- :limit="6"
- @onClick="(id) => handleShowWalletModal(id)")
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables"
-
-.sidebar
- display grid
- grid-template-columns 1fr
- grid-template-rows minmax(auto, auto) minmax(auto, auto) 1fr
- height 100vh
- background var(--c-bg-4)
- border-right 1px solid var(--c-bg-2)
-
- &__menu
- display flex
- justify-content space-between
- padding 0 $m7
- background var(--c-bg-3)
- border-bottom 1px solid var(--c-bg-2)
-
- &__item
- position relative
- display inline-flex
- align-items center
- justify-content center
- padding $m7 $m8
- font-header-1()
- color var(--c-font-4)
- font-size 18px
-
- +media-laptop()
- padding 10px 20px
-
- &:hover
- @media $media-laptop
- background var(--c-bg-6)
-
- &._active
- color var(--c-font-2)
-
- &__content
- scrollbar()
- overflow hidden
- overflow-y auto
- height 100%
-
-.link
- z-index 1
- padding $m7 $m8
- font-header-1()
- color var(--c-font-4)
- font-size 18px
-
- &:hover:not(._active)
- @media $media-laptop
- background var(--c-bg-6)
-</style>
diff --git a/components/layout/sidebar/Menu.vue b/components/layout/sidebar/BaseMenu.vue
similarity index 97%
rename from components/layout/sidebar/Menu.vue
rename to components/layout/sidebar/BaseMenu.vue
index e655937b..6078db8c 100644
--- a/components/layout/sidebar/Menu.vue
+++ b/components/layout/sidebar/BaseMenu.vue
@@ -1,5 +1,7 @@
<script>
export default {
+ name: 'BaseMenu',
+
computed: {
activeTab () {
return this.$store.state.ui.activeTab
@@ -110,11 +112,6 @@ item-bg-active()
background var(--c-bg-6)
.menu
- border-bottom 1px solid var(--c-bg-2)
-
- &:last-child
- border-bottom 0
-
&__wallets
padding-top $m8
diff --git a/components/layout/sidebar/LayoutPcSidebar.vue b/components/layout/sidebar/LayoutPcSidebar.vue
new file mode 100644
index 00000000..4ed18e04
--- /dev/null
+++ b/components/layout/sidebar/LayoutPcSidebar.vue
@@ -0,0 +1,55 @@
+<script>
+export default {
+ name: 'LayoutPcSidebar',
+
+ data () {
+ return {
+ visibleSettingsMenu: false
+ }
+ },
+
+ computed: {
+ activeTab () {
+ return this.$store.state.ui.activeTab
+ }
+ },
+
+ methods: {
+ handleShowWalletModal (id) {
+ this.$store.commit('wallets/showWalletModal')
+ this.$store.commit('wallets/setWalletModalId', id)
+ }
+ }
+}
+</script>
+
+<template lang="pug" scoped>
+.sidebar
+ BaseMenu
+
+ .sidebar__content
+ WalletsTotal
+
+ WalletsList(
+ :showToogle="true"
+ :limit="6"
+ @onClick="(id) => handleShowWalletModal(id)")
+</template>
+
+<style lang="stylus" scoped>
+@import '~assets/stylus/variables'
+
+.sidebar
+ display grid
+ grid-template-columns 1fr
+ grid-template-rows minmax(auto, auto) minmax(auto, auto) 1fr
+ height 100vh
+ background var(--c-bg-4)
+ border-right 1px solid var(--c-bg-2)
+
+ &__content
+ scrollbar()
+ overflow hidden
+ overflow-y auto
+ height 100%
+</style>
diff --git a/components/shared/button/Button.vue b/components/shared/button/Button.vue
index 41ef518f..b12da61a 100644
--- a/components/shared/button/Button.vue
+++ b/components/shared/button/Button.vue
@@ -61,8 +61,8 @@ export default {
</template>
<style lang="stylus">
-@import "~assets/stylus/variables/animations"
-@import "~assets/stylus/variables/media"
+@import '~assets/stylus/variables/animations'
+@import '~assets/stylus/variables/media'
.d-button-cirle
display flex
@@ -93,10 +93,10 @@ export default {
</style>
<style lang="stylus" scoped>
-@import "~assets/stylus/variables/animations"
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/media"
-@import "~assets/stylus/variables/fonts"
+@import '~assets/stylus/variables/animations'
+@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables/media'
+@import '~assets/stylus/variables/fonts'
.d-button
cursor pointer
@@ -155,9 +155,9 @@ export default {
border 1px solid var(--c-bg-5)
&:hover
@media $media-laptop
- background var(--c-bg-5)
+ background var(--c-bg-4)
&:active
- background var(--c-bg-5)
+ background var(--c-bg-4)
&._inline
display flex
diff --git a/components/shared/contextMenu/ContextMenu.vue b/components/shared/contextMenu/ContextMenu.vue
index 78c4fa18..c8b4d2c9 100644
--- a/components/shared/contextMenu/ContextMenu.vue
+++ b/components/shared/contextMenu/ContextMenu.vue
@@ -77,6 +77,9 @@ export default {
.context-menu-sep
height 1px
background var(--c-bg-4)
+
+ /.light-mode &
+ background var(--c-bg-6)
</style>
<style lang="stylus" scoped>
@@ -109,6 +112,10 @@ export default {
border-radius $m6
box-shadow 0 10px 20px -5px var(--c-bg-1)
+ /.light-mode &
+ background var(--c-bg-3)
+ border 1px solid var(--c-bg-5)
+
&._right
right 0
diff --git a/components/shared/contextMenu/ContextMenuItem.vue b/components/shared/contextMenu/ContextMenuItem.vue
index 79fb1d3b..8226b07f 100644
--- a/components/shared/contextMenu/ContextMenuItem.vue
+++ b/components/shared/contextMenu/ContextMenuItem.vue
@@ -9,10 +9,6 @@ export default {
type: String,
required: true
},
- checkValue: {
- type: Boolean,
- default: false
- },
selected: {
type: Boolean,
default: false
@@ -42,14 +38,13 @@ export default {
:class="{ _selected: selected }")
.item__icon(v-if="icon"): div(:class="icon")
.item__title {{ title }}
- .item__check(v-if="checkValue"): .mdi.mdi-check-circle-outline
.item__check(v-if="showCheckbox" @click.prevent="")
Checkbox._small(v-model="checkboxValue")
</template>
<style lang="stylus" scoped>
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/media"
+@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables/media'
.item
cursor pointer
diff --git a/components/shared/dropdown/Dropdown.vue b/components/shared/dropdown/Dropdown.vue
index ea8f188e..5e007e58 100644
--- a/components/shared/dropdown/Dropdown.vue
+++ b/components/shared/dropdown/Dropdown.vue
@@ -27,8 +27,8 @@ export default {
</template>
<style lang="stylus" scoped>
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/media"
+@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables/media'
.dropdown
.dropdown.d-button-cirle
@@ -36,17 +36,28 @@ export default {
display flex
align-items stretch
width auto
- padding 0 12px
margin-left auto
- border-radius $m3
- font-size 16px
+ padding 0 12px
+ color var(--c-font-4)
+ font-size 13px
+ background transparent
+ border 1px solid var(--c-bg-5)
+ border-radius $m5
+
+ &:active:not(._disable)
+ color var(--c-font-3)
+
+ +media-laptop()
+ &:hover
+ background var(--c-bg-4)
&._noBd
- padding 0 12px
margin 0 -12px
+ padding 0 12px
+ font-size 16px
background transparent
- border-color transparent
box-shadow none
+ border-color transparent
&:hover:not(._disable)
@media $media-laptop
@@ -62,26 +73,26 @@ export default {
align-items center
&__icon
+ opacity .6
display flex
align-items center
justify-content center
- font-size 18px
margin-right 6px
- opacity .6
+ font-size 18px
&__title
- flex-grow 1
- white-space nowrap
justify-content flex-start
padding-right 12px
+ flex-grow 1
+ white-space nowrap
&__toogle
opacity .8
justify-content center
width 2px
- flex-grow 0
font-size 15px
transform translateY(1px)
+ flex-grow 0
div
anim-all()
diff --git a/components/stat/DateSelectorModal.vue b/components/stat/DateSelectorModal.vue
index a329b35b..e8a5db2b 100644
--- a/components/stat/DateSelectorModal.vue
+++ b/components/stat/DateSelectorModal.vue
@@ -72,6 +72,8 @@ Portal(
</template>
<style lang="stylus" scoped>
+@import '~assets/stylus/variables'
+
.ta_center
display flex
align-items center
@@ -80,7 +82,7 @@ Portal(
.grid
display grid
- grid-template-columns repeat(auto-fit, minmax(75px, 1fr))
- grid-column-gap 0
+ grid-template-columns repeat(auto-fit, minmax(100px, 1fr))
+ grid-column-gap $m7
grid-row-gap $m7
</style>
diff --git a/components/stat/StatChartBalance.vue b/components/stat/StatChartBalance.vue
index bba45655..a7b39109 100644
--- a/components/stat/StatChartBalance.vue
+++ b/components/stat/StatChartBalance.vue
@@ -87,7 +87,7 @@ export default {
// diff periods from oldest trn and today
const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)
let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1
- periodsToShow = periodsToShow > 24 ? 24 : periodsToShow
+ periodsToShow = periodsToShow > 12 ? 12 : periodsToShow
// get balance for first period
const dateStart = this.$day().endOf(periodName).subtract(periodsToShow, periodName).valueOf()
diff --git a/components/stat/StatChartLines.vue b/components/stat/StatChartLines.vue
index da81e0aa..3d2474aa 100644
--- a/components/stat/StatChartLines.vue
+++ b/components/stat/StatChartLines.vue
@@ -38,6 +38,11 @@ export default {
amountType: {
type: String,
default: null
+ },
+
+ isShowDataLabels: {
+ type: Boolean,
+ default: true
}
},
@@ -195,6 +200,10 @@ export default {
...chartOptions.plotOptions,
series: {
...chartOptions.plotOptions.series,
+ dataLabels: {
+ ...chartOptions.plotOptions.series.dataLabels,
+ enabled: this.isShowDataLabels
+ },
cursor: 'pointer',
point: {
events: {
@@ -219,11 +228,6 @@ export default {
</template>
<style lang="stylus" scoped>
-@import '~assets/stylus/variables/animations'
-@import '~assets/stylus/variables/margins'
-@import '~assets/stylus/variables/fonts'
-@import '~assets/stylus/variables/media'
-
.chart
z-index 3
position relative
diff --git a/components/stat/StatChartPie.vue b/components/stat/StatChartPie.vue
new file mode 100644
index 00000000..ea8b5e7e
--- /dev/null
+++ b/components/stat/StatChartPie.vue
@@ -0,0 +1,95 @@
+<script>
+import { Chart } from 'highcharts-vue'
+import chartOptions from '~/components/stat/chartOptions'
+
+export default {
+ name: 'StatChartPie',
+
+ components: {
+ Chart
+ },
+
+ props: {
+ chartType: {
+ type: String,
+ default: 'pie'
+ },
+
+ amountType: {
+ type: String,
+ default: null
+ }
+ },
+
+ computed: {
+ chartData () {
+ const statCurrentPeriodCategories = this.$store.getters['stat/statCurrentPeriod'].categories
+ const statCurrentPeriod = this.$store.getters['stat/statCurrentPeriod']
+ const data = []
+
+ for (const categoryId of statCurrentPeriod[this.amountType].categoriesIds) {
+ const categoryAmountValues = statCurrentPeriodCategories[categoryId]
+ const category = this.$store.state.categories.items[categoryId]
+ if (categoryAmountValues[this.amountType] !== 0) {
+ data.push({
+ categoryId,
+ color: category.color,
+ name: category.name,
+ y: categoryAmountValues[this.amountType]
+ })
+ }
+ }
+
+ const series = [{
+ data,
+ type: this.chartType
+ }]
+
+ return {
+ ...chartOptions,
+ series,
+
+ chart: {
+ ...chartOptions.chart,
+ height: '300',
+
+ events: {
+ click (e) {
+ // console.log(e)
+ // const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true)
+ // vm.$store.dispatch('filter/setDate', parseInt(value.date))
+ }
+ }
+ },
+
+ plotOptions: {
+ ...chartOptions.plotOptions,
+ series: {
+ ...chartOptions.plotOptions.series,
+ cursor: 'pointer',
+ point: {
+ events: {
+ click (e) {
+ // console.log(e)
+ // vm.$store.dispatch('filter/setDate', parseInt(this.date))
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.chart
+ Chart(:options="chartData")
+</template>
+
+<style lang="stylus" scoped>
+.chart
+ z-index 3
+ position relative
+</style>
diff --git a/components/stat/StatChartsLine.vue b/components/stat/StatChartsLine.vue
index 5a49edf7..26e1be33 100644
--- a/components/stat/StatChartsLine.vue
+++ b/components/stat/StatChartsLine.vue
@@ -199,10 +199,6 @@ export default {
:maxAmountValue="maxAmountValue"
:period="period"
parentClassName=".charts__items")
-
- //- popup
- template(v-if="$store.state.ui.pc && $store.state.chart.hoveredPeriod.values")
- ChartPopup
</template>
<style lang="stylus" scoped>
diff --git a/components/stat/StatItem.vue b/components/stat/StatItem.vue
index d3167ddc..2eb9550f 100644
--- a/components/stat/StatItem.vue
+++ b/components/stat/StatItem.vue
@@ -102,6 +102,7 @@ export default {
:incomes="type === 1"
:expenses="type === 0"
:categoryId="categoryId"
+ ui="stat"
)
</template>
diff --git a/components/stat/StatPc.vue b/components/stat/StatPc.vue
index d9f0383e..8c7e5887 100644
--- a/components/stat/StatPc.vue
+++ b/components/stat/StatPc.vue
@@ -16,9 +16,12 @@ export default {
//------------------------------------------------
.stat__item
template(v-if="statCurrentPeriod.expenses.categoriesIds.length")
- .stat__chart(v-if="$store.state.ui.catsChart === 'visible'")
+ .stat__chart(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
PeriodCatsChart(type="expenses")
+ .stat__pie(v-if="$store.state.ui.catsChartPie === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
+ StatChartPie(amountType="expenses")
+
.stat__cats(v-if="$store.state.ui.statItems === 'visible'")
StatItem(
v-for="categoryId in statCurrentPeriod.expenses.categoriesIds"
@@ -36,9 +39,12 @@ export default {
//------------------------------------------------
.stat__item
template(v-if="statCurrentPeriod.incomes.categoriesIds.length")
- .stat__chart(v-if="$store.state.ui.catsChart === 'visible'")
+ .stat__chart(v-if="$store.state.ui.catsChart === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
PeriodCatsChart(type="incomes")
+ .stat__pie(v-if="$store.state.ui.catsChartPie === 'visible' && statCurrentPeriod.incomes.categoriesIds.length > 1")
+ StatChartPie(amountType="incomes")
+
.stat__cats(v-if="$store.state.ui.statItems === 'visible'")
StatItem(
v-for="categoryId in statCurrentPeriod.incomes.categoriesIds"
diff --git a/components/stat/StatSummaryPc.vue b/components/stat/StatSummaryPc.vue
index e15ceb61..83f6e99a 100644
--- a/components/stat/StatSummaryPc.vue
+++ b/components/stat/StatSummaryPc.vue
@@ -114,31 +114,25 @@ export default {
padding $m3 $m9
padding-right 0
- @media $media-phone
- border-bottom 1px solid var(--c-bg-5)
-
@media $media-laptop
flex 0 1 250px
margin 0
padding 0
@media $media-pc
- padding $m3 $m9
+ padding $m3 $m8
padding-right 0
&._expenses
- @media $media-pc
- border-left 2px solid rgba(200, 30, 50, .3)
+ border-left 2px solid rgba(200, 30, 50, .3)
&._total
align-self center
- @media $media-pc
- border-left 2px solid var(--c-bg-6)
+ border-left 2px solid var(--c-bg-6)
&._incomes
align-self end
- @media $media-pc
- border-left 2px solid rgba(44, 173, 34, .5)
+ border-left 2px solid rgba(44, 173, 34, .5)
&__row
flex-grow 0
diff --git a/components/stat/cats/PeriodCatsChartItem.vue b/components/stat/cats/PeriodCatsChartItem.vue
index 59cdb367..32fcca9b 100644
--- a/components/stat/cats/PeriodCatsChartItem.vue
+++ b/components/stat/cats/PeriodCatsChartItem.vue
@@ -85,7 +85,7 @@ export default {
margin-top 12px
margin-right 10px
background var(--c-bg-5)
- border-radius 3px
+ border-radius $m3
&:hover
@media $media-laptop
@@ -94,6 +94,9 @@ export default {
padding 32px 10px 20px 10px
background var(--c-bg-6)
+ /.light-mode &
+ background var(--c-bg-1)
+
&__graph
position relative
width 28px
diff --git a/components/stat/cats/PeriodCatsChart2.vue b/components/stat/cats/PeriodCatsChartMobile.vue
similarity index 97%
rename from components/stat/cats/PeriodCatsChart2.vue
rename to components/stat/cats/PeriodCatsChartMobile.vue
index 152708be..9f65fbce 100644
--- a/components/stat/cats/PeriodCatsChart2.vue
+++ b/components/stat/cats/PeriodCatsChartMobile.vue
@@ -1,6 +1,6 @@
<script>
export default {
- name: 'PeriodCatsChart2',
+ name: 'PeriodCatsChartMobile',
props: {
type: {
diff --git a/components/stat/cats/PeriodCatsChartPopup.vue b/components/stat/cats/PeriodCatsChartPopup.vue
index 3e9e85ae..0de246c9 100644
--- a/components/stat/cats/PeriodCatsChartPopup.vue
+++ b/components/stat/cats/PeriodCatsChartPopup.vue
@@ -48,31 +48,38 @@ export default {
</template>
<style lang="stylus" scoped>
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/fonts"
-@import "~assets/stylus/variables/media"
-@import "~assets/stylus/variables/scroll"
+@import '~assets/stylus/variables/margins'
+@import '~assets/stylus/variables/fonts'
+@import '~assets/stylus/variables/media'
+@import '~assets/stylus/variables/scroll'
.chart-popup
z-index 2
- display block
position absolute
bottom 0px
+ display block
padding $m6 $m8
- white-space nowrap
background var(--c-bg-6)
border-radius $m4
transform translate(-50%, calc(100% + 40px))
+ white-space nowrap
+
+ /.light-mode &
+ background var(--c-bg-1)
+ border 1px solid var(--c-bg-5)
&:after
position absolute
- left 50%
top -8px
- content ""
+ left 50%
+ transform translateX(-50%)
+ content ''
border-left 8px solid transparent
border-right 8px solid transparent
border-bottom 8px solid var(--c-bg-6)
- transform translateX(-50%)
+
+ /.light-mode &
+ border-bottom-color var(--c-bg-5)
&__name
padding-bottom $m5
diff --git a/components/stat/chart/ChartMenu2.vue b/components/stat/chart/ChartMenu2.vue
deleted file mode 100644
index 9b8ca06b..00000000
--- a/components/stat/chart/ChartMenu2.vue
+++ /dev/null
@@ -1,166 +0,0 @@
-<script>
-import localforage from 'localforage'
-
-export default {
- name: 'ChartMenu2',
-
- props: {
- showDropdown: {
- type: Boolean,
- default: false
- }
- },
-
- data () {
- return {
- visibleContextMenu: false
- }
- },
-
- computed: {
- filterPeriod () {
- return this.$store.state.filter.period
- },
- periods () {
- return this.$store.state.chart.periods
- },
- periodName () {
- return this.$store.state.filter.period
- }
- },
-
- methods: {
- toogleView () {
- if (this.periodName !== 'year') {
- this.$store.commit('chart/toogleChartPeriodView', { periodName: this.periodName })
- }
- },
-
- addPeriodOrGroup () {
- if (this.periods[this.filterPeriod].grouped) {
- this.$store.commit('chart/toogleChartPeriodView', { periodName: this.filterPeriod })
- }
-
- this.periods[this.filterPeriod].grouped
- ? this.$store.commit('chart/addElementsToChart', { periodName: this.filterPeriod, periodType: 'showedGroups' })
- : this.$store.commit('chart/addElementsToChart', { periodName: this.filterPeriod, periodType: 'showedPeriods' })
- this.saveChartsPeriodsToLocalStorage()
- },
-
- removePeriodOrGroup () {
- if (this.periods[this.filterPeriod].grouped) {
- this.$store.commit('chart/toogleChartPeriodView', { periodName: this.filterPeriod })
- }
-
- this.periods[this.filterPeriod].grouped
- ? this.$store.commit('chart/removeElementsFromChart', { periodName: this.filterPeriod, periodType: 'showedGroups' })
- : this.$store.commit('chart/removeElementsFromChart', { periodName: this.filterPeriod, periodType: 'showedPeriods' })
- this.saveChartsPeriodsToLocalStorage()
- },
-
- toogleChartsView () {
- this.visibleContextMenu = !this.visibleContextMenu
- this.$store.commit('chart/toogleChartPeriodView', { periodName: this.filterPeriod })
- this.saveChartsPeriodsToLocalStorage()
- },
-
- saveChartsPeriodsToLocalStorage () {
- localforage.setItem('finapp.chart.periods', this.$store.state.chart.periods)
- this.$store.dispatch('ui/saveUiView')
- }
- }
-}
-</script>
-
-<template lang="pug">
-.chartMenu
- //- .chartMenu__name(
- //- v-if="filterPeriod !== 'all'"
- //- @click="toogleView"
- //- )
- //- ) {{ $store.state.chart.periods[filterPeriod].showedPeriods }} {{ $t(`dates.${periodName}.simple`) }}
-
- .chartMenu__content
- ContextMenu(
- :position="{ right: '0px', top: '38px' }"
- :visible="visibleContextMenu"
- @onClickOpener="visibleContextMenu = !visibleContextMenu"
- )
- template(slot="opener")
- Dropdown._noBd.date(:active="visibleContextMenu")
- template(slot="title")
- //- Date
- //- .activrPeriodName {{ $t(`dates.${$store.state.filter.period}.simple`) }}
- template(
- slot="desc"
- v-if="filterPeriod !== 'all'"
- ) {{ $store.state.chart.periods[filterPeriod].showedPeriods }} {{ $t(`dates.${periodName}.simple`) }}
-
- template(slot="content")
- ContextMenuItem(
- :title="$t('chart.view.remove')"
- icon="mdi mdi-minus"
- @onClick="removePeriodOrGroup"
- )
- ContextMenuItem(
- :title="$t('chart.view.add')"
- icon="mdi mdi-plus"
- @onClick="addPeriodOrGroup"
- )
-</template>
-
-<style lang="stylus" scoped>
-@import '~assets/stylus/variables'
-
-.chartMenu
- z-index 8
- position absolute
- right 0
- bottom 8px
- display flex
- align-items center
- justify-content space-between
- margin 0
- padding 0 $m7
-
- &__name
- flex-grow 1
- color var(--c-font-5)
- font-size 8px
- text-transform uppercase
-
- &__content
- display flex
- align-items stretch
- justify-content stretch
- width 32px
-
- &._active
- border-left 1px solid var(--c-bg-4)
-
- &._grow
- flex-grow 1
- justify-content space-between
-
- &__item
- opacity .6
- display flex
- align-items center
- justify-content center
- padding 0 $m6
- font-size 12px
- text-align center
-
- .mdi
- font-size 16px
-
- &._grow
- flex-grow 1
-
- +media-hover()
- background var(--c-bg-3)
-
- &._active
- opacity 1
- background var(--c-bg-8)
-</style>
diff --git a/components/stat/chart/ChartPopup.vue b/components/stat/chart/ChartPopup.vue
deleted file mode 100644
index bf05931d..00000000
--- a/components/stat/chart/ChartPopup.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-<script>
-export default {
- name: 'ChartPopup'
-}
-</script>
-
-<template lang="pug">
-.chart-popup(:style="{ left: $store.state.chart.hoveredPeriod.offset }")
- SummaryRow(
- :incomesAmount="$store.state.chart.hoveredPeriod.values.incomes"
- :expensesAmount="$store.state.chart.hoveredPeriod.values.expenses"
- )
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/fonts"
-@import "~assets/stylus/variables/media"
-@import "~assets/stylus/variables/scroll"
-
-.chart-popup
- display block
- position absolute
- bottom 0px
- background var(--c-bg-2)
- padding $m7 $m7
- border-radius $m4
- transform translate(-50%, calc(100% + 16px))
-
- &:after
- position absolute
- left 50%
- top -8px
- content ""
- border-left 8px solid transparent
- border-right 8px solid transparent
- border-bottom 8px solid var(--c-bg-2)
- transform translateX(-50%)
-
- &__item
- &:not(:last-child)
- margin-bottom $m4
-</style>
diff --git a/components/stat/chartOptions.js b/components/stat/chartOptions.js
index 016b63fb..d6a441ec 100644
--- a/components/stat/chartOptions.js
+++ b/components/stat/chartOptions.js
@@ -50,9 +50,23 @@ export default {
}
},
+ pie: {
+ dataLabels: {
+ enabled: true,
+ distance: -30,
+ format: '<b>{point.name}</b><br>{point.y}',
+ filter: {
+ property: 'percentage',
+ operator: '>',
+ value: 4
+ }
+ },
+ startAngle: 270
+ },
+
series: {
marker: {
- radius: 3,
+ radius: 2,
fillColor: 'var(--c-bg-4)',
lineWidth: 2,
lineColor: 'var(--c-incomes-1)',
diff --git a/layouts/default.vue b/layouts/default.vue
index 7dfa3a62..b8f0119e 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -1,9 +1,16 @@
<script>
import debounce from '~/utils/debounce'
+import isTouchDevice from '~/assets/js/isTouchDevice'
export default {
name: 'DefaultLayout',
+ data () {
+ return {
+ isTouchDevice: false
+ }
+ },
+
computed: {
layoutStyles () {
return { height: `${this.$store.state.ui.height}px` }
@@ -15,6 +22,8 @@ export default {
},
async mounted () {
+ this.isTouchDevice = isTouchDevice()
+
this.getPageDimensions()
window.addEventListener('resize', debounce(this.getPageDimensions, 600))
@@ -45,7 +54,10 @@ export default {
</script>
<template lang="pug">
-.finapp(:style="layoutStyles")
+.finapp(
+ :class="{ isNotTouchDevice: !isTouchDevice }"
+ :style="layoutStyles"
+)
//- Loading
template(v-if="!$store.state.app.status.ready")
Loader
diff --git a/locales/en-US.js b/locales/en-US.js
index 7127792e..756b4db0 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -212,10 +212,10 @@ export default {
balanceTitle: 'Balance',
empty: 'No stat for this period',
customize: {
- showPeriodsChart: 'Show periods chart',
showCategorisChart: 'Show categories chart',
- averageStatVisibility: 'Show average statistics',
- showCategorisList: 'Show categories list'
+ showCategorisList: 'Show categories list',
+ showcatsChartPie: 'Show categories pie chart',
+ showPeriodsChart: 'Show periods chart'
}
},
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 37bfa0f5..5110e2b8 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -214,10 +214,10 @@ export default {
periods: 'Общее',
empty: 'Статистики по выбранным параметрам нет :)',
customize: {
- showPeriodsChart: 'Показывать график периодов',
- averageStatVisibility: 'Показывать средниюю статистику',
showCategorisChart: 'Показывать график категорий',
- showCategorisList: 'Показывать список категорий'
+ showCategorisList: 'Показывать список категорий',
+ showcatsChartPie: 'Показывать статистику "пирог"',
+ showPeriodsChart: 'Показывать график периодов'
}
},
diff --git a/package.json b/package.json
index e48e21d8..119d4269 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "finapp",
- "version": "3.5.0",
+ "version": "3.6.0",
"scripts": {
"dev": "cross-env NUXT_HOST=0.0.0.0 nuxt",
"build": "nuxt build",
diff --git a/store/chart/index.js b/store/chart/index.js
index f001beb6..694f8aa5 100644
--- a/store/chart/index.js
+++ b/store/chart/index.js
@@ -1,7 +1,4 @@
-import actions from './actions'
-import mutations from './mutations'
-
-const state = () => ({
+export const state = () => ({
hoveredPeriod: {
values: null,
position: null
@@ -34,9 +31,3 @@ const state = () => ({
}
}
})
-
-export default {
- state,
- actions,
- mutations
-}
diff --git a/store/stat/getters.js b/store/stat/getters.js
index 76226641..d4193a85 100644
--- a/store/stat/getters.js
+++ b/store/stat/getters.js
@@ -58,7 +58,10 @@ export default {
const periodName = rootState.filter.period
if (periodName === 'all') { return }
- const oldestTrnDate = dayjs(trns[rootGetters['trns/firstCreatedTrnId']].date).endOf(periodName)
+ const oldestTrn = trns[rootGetters['trns/firstCreatedTrnId']]
+ if (!oldestTrn) { return }
+
+ const oldestTrnDate = dayjs(oldestTrn.date).endOf(periodName)
let periodsToShow = dayjs().endOf(periodName).diff(oldestTrnDate, periodName) + 1
periodsToShow = rootState.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : rootState.chart.periods[periodName].showedPeriods
diff --git a/store/trns/actions.js b/store/trns/actions.js
index 647f67dd..c5b43f02 100644
--- a/store/trns/actions.js
+++ b/store/trns/actions.js
@@ -132,12 +132,9 @@ export default {
* and add them to database
*/
uploadOfflineTrns ({ dispatch, rootState }) {
- console.log('uploadOfflineTrns')
db.ref('.info/connected').on('value', async (snap) => {
- // const isConnected = snap.val()
- const isConnected = true
+ const isConnected = snap.val()
if (isConnected) {
- console.log('isConnected')
const trnsArrayForDelete = await localforage.getItem('finapp.trns.offline.delete') || []
const trnsItemsForUpdate = await localforage.getItem('finapp.trns.offline.update') || {}
diff --git a/store/ui/actions.js b/store/ui/actions.js
index 25293510..abc30e16 100644
--- a/store/ui/actions.js
+++ b/store/ui/actions.js
@@ -117,15 +117,15 @@ export default {
},
/**
- * toogleAverageStatVisibility
+ * Toggle cats chart pie
*/
- toogleAverageStatVisibility ({ commit, dispatch, state }) {
+ toogleVisibleCatsChartPie ({ commit, dispatch, state }) {
let nextStatus
- state.stat.averageStatVisibility === 'visible'
+ state.catsChartPie === 'visible'
? nextStatus = 'hidden'
: nextStatus = 'visible'
- commit('setAverageStatVisibility', nextStatus)
+ commit('setVisibleCatsChartPie', nextStatus)
dispatch('ui/saveUiView', null, { root: true })
},
@@ -170,11 +170,9 @@ export default {
catsChart: rootState.ui.catsChart,
period: rootState.filter.period,
statGraphsVisibility: rootState.ui.statGraphsVisibility,
+ catsChartPie: rootState.ui.catsChartPie,
statItems: rootState.ui.statItems,
- totalChartPeriods: rootState.chart.periods,
- stat: {
- averageStatVisibility: rootState.ui.stat.averageStatVisibility
- }
+ totalChartPeriods: rootState.chart.periods
}
})
@@ -207,23 +205,15 @@ export default {
? commit('setVisibleCatsChart', 'visible')
: commit('setVisibleCatsChart', 'hidden')
+ // cats chart pie
+ localFilterUiItem.catsChartPie === 'visible'
+ ? commit('setVisibleCatsChartPie', 'visible')
+ : commit('setVisibleCatsChartPie', 'hidden')
+
// cats items
localFilterUiItem.statItems === 'visible'
? commit('setVisibilityStatItems', 'visible')
: commit('setVisibilityStatItems', 'hidden')
-
- // Average statistics
- localFilterUiItem.stat.averageStatVisibility === 'visible'
- ? commit('setAverageStatVisibility', 'visible')
- : commit('setAverageStatVisibility', 'hidden')
-
- // periods in total chart
- const currentPeriodName = rootState.filter.period
- const localPeriodValues = localFilterUiItem.totalChartPeriods[currentPeriodName]
- commit('chart/setPeriodValues', {
- periodName: currentPeriodName,
- values: localPeriodValues
- }, { root: true })
}
}
}
diff --git a/store/ui/index.js b/store/ui/index.js
index 6350bf68..4fc4ed67 100644
--- a/store/ui/index.js
+++ b/store/ui/index.js
@@ -8,14 +8,13 @@ const state = () => ({
mobile: false,
pc: false,
catsChart: 'visible',
+ catsChartPie: 'visible',
statGraphsVisibility: 'visible',
statItems: 'visible',
stat: {
- activeTab: 'incomes',
- averageStatVisibility: 'visible'
+ activeTab: 'incomes'
},
- // Active tab for stat v2
activeTabViewName: 'incomes'
})
diff --git a/store/ui/mutations.js b/store/ui/mutations.js
index 030c8fab..29e003a4 100644
--- a/store/ui/mutations.js
+++ b/store/ui/mutations.js
@@ -31,8 +31,8 @@ export default {
state.catsChart = status
},
- setAverageStatVisibility (state, status) {
- state.stat.averageStatVisibility = status
+ setVisibleCatsChartPie (state, status) {
+ state.catsChartPie = status
},
setVisibilityStatItems (state, status) {