Open source personal finance application
Update Dashboard
ilkomef08fa42711c5
diff --git a/src/components/dashboard/Dashboard.vue b/src/components/dashboard/Dashboard.vueindex c1f6b808..a0066e46 100644--- a/src/components/dashboard/Dashboard.vue+++ b/src/components/dashboard/Dashboard.vue@@ -1,9 +1,7 @@<script>-import ContextMenu from '@/components/shared/contextMenu/ContextMenu'-import ContextMenuItem from '@/components/shared/contextMenu/ContextMenuItem'-import Dropdown from '@/components/shared/dropdown/Dropdown'import DashboardFilter from '@/components/dashboard/DashboardFilter'import DashboardNav from '@/components/dashboard/DashboardNav'+import DashboardStatControl from '@/components/dashboard/DashboardStatControl'import EmptyData from '@/components/shared/emptyData/EmptyData'import StatChartsLine from '@/components/stat/StatChartsLine'import StatSummaryPc from '@/components/stat/StatSummaryPc'@@ -12,12 +10,10 @@ import TrnsList from '@/components/trns/list/TrnsList'export default {components: {- ContextMenu,- ContextMenuItem,EmptyData,- Dropdown,DashboardFilter,DashboardNav,+ DashboardStatControl,StatChartsLine,StatPc,StatSummaryPc,@@ -28,53 +24,20 @@ export default {return {visiblePeriodMenu: false}- },-- computed: {- activeTab () {- return this.$store.state.ui.activeTab- }}}</script><template lang="pug">-.statMain(v-show="activeTab === 'stat'")+.dashboard(v-show="$store.state.ui.activeTab === 'stat'")StatChartsLine+ DashboardNav+ StatSummaryPc+ DashboardFilter+ DashboardStatControl- .statMain__info- DashboardNav- DashboardFilter- .statMain__info__wrap- .statMain__info__in- StatSummaryPc-- .statMain__box- .statMain__header- .statMain__header__group- .statMain__header__item._tabName(- @click="$store.commit('toogleDashboardTrnsHistory')"- :class="{ _active: !$store.state.dashboard.showTrnsHistory }") Stat- .statMain__header__item._tabName(- @click="$store.commit('toogleDashboardTrnsHistory')"- :class="{ _active: $store.state.dashboard.showTrnsHistory }") History-- .statMain__header__group- .statMain__header__item._monthNav(- @click="$store.dispatch('setPeriodPrev')"- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isFirstPeriodSelected }")- .mdi.mdi-chevron-double-left- | Next {{ $store.state.filter.period }}-- .statMain__header__item._monthNav(- @click="$store.dispatch('setPeriodNext')"- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isLastPeriodSelected }")- | Prev {{ $store.state.filter.period }} - .mdi.mdi-chevron-double-right-- .statMain__header__group-- .statMain__content+ .dashboard__content+ .dashboard__wrap//- empty//------------------------------------------------template(v-if="$store.getters.stat.incomes.categoriesIds.length === 0 && $store.getters.stat.expenses.categoriesIds.length === 0 && $store.getters.selectedTrnsIdsWithDate.length === 0")@@ -83,105 +46,34 @@ export default {//- stat & historytemplate(v-else)transition(name="animation-tab")- .statMain__tab(v-show="!$store.state.dashboard.showTrnsHistory")+ .dashboard__tab(v-show="!$store.state.dashboard.showTrnsHistory")StatPctransition(name="animation-tab")- .statMain__tab._trns(v-show="$store.state.dashboard.showTrnsHistory")+ .dashboard__tab._trns(v-show="$store.state.dashboard.showTrnsHistory")TrnsList</template><style lang="stylus" scoped>@import "~@/stylus/variables/margins"@import "~@/stylus/variables/media"-@import "~@/stylus/variables/flex"-@import "~@/stylus/variables/fonts"@import "~@/stylus/variables/scrollbar"-._minWidth- min-width 120px-.trnsListdisplay gridgrid-template-columns repeat(3, 1fr)grid-column-gap $m7grid-row-gap $m7-.statMain- scrollbar()+.dashboardoverflow hiddenoverflow-y scroll+ scrollbar()- &__info- border-bottom 1px solid var(--c-bg-1)- background var(--c-bg-3)-- &__wrap- border-top 1px solid var(--c-bg-2)-- &__in- position relative- max-width 1100px- padding $m9 $mb2-- @media $media-laptop- padding $m9 $m9-- @media $media-pc- padding $m9 $mb2-- &__box+ &__wrap+ position relativemax-width 1100px-- &__header- display grid- grid-template-columns repeat(3, 1fr)- padding $m9 $mb2- grid-column-gap $m9- padding-bottom 0-- &__group- display-flex()- flex 1 1 450px-- &__item- display flex- align-items center- margin-right $m9- padding $m3 $m6- &._tabName- font-header-4()- color var(--c-font-5)- &:last-child- margin-right 0- &._active- color var(--c-font-3)- border-bottom 2px solid var(--c-font-3)- &._monthNav- color var(--c-font-5)- white-space nowrap- padding 5px 12px- margin -5px 5px- border-radius $m3- font-size 16px- background transparent- border-color transparent- box-shadow none- color var(--c-font-4)- background transparent- border 1px solid transparent- border-radius 3px-- &:hover:not(._disable)- @media $media-laptop- color var(--c-font-3)- background var(--c-bg-1)- border-color var(--c-bg-8)-- &._disable- opacity .5- &:hover:not(._active):not(._disable):not(._spacer)- background var(--c-bg-1)+ padding 0px 60px&__contentposition relative@@ -191,9 +83,9 @@ export default {left 0top 0width 100%- padding-bottom $m10+ padding-bottom 60px&._trns- padding $m9 $mb2- padding-bottom $m10+ padding 60px 60px+ padding-top 30px</style>diff --git a/src/components/dashboard/DashboardNav.vue b/src/components/dashboard/DashboardNav.vueindex d47f673b..70c21302 100644--- a/src/components/dashboard/DashboardNav.vue+++ b/src/components/dashboard/DashboardNav.vue@@ -103,16 +103,18 @@ export default {:showCheckbox="true":checkboxValue="$store.state.ui.statItems === 'visible'"v-on:onClick="$store.dispatch('toogleVisibilityStatItems')")+.context-menu-sep++ ContextMenuItem(+ icon="mdi mdi-palette"+ title="Change theme"+ v-on:onClick="$store.dispatch('changeTheme')")ContextMenuItem(icon="mdi mdi-currency-usd"title="Change base currency"v-on:onClick="$store.commit('showBaseCurrenciesModal')"v-on:onClose="visibleContextMenu = !visibleContextMenu")- ContextMenuItem(- icon="mdi mdi-palette"- title="Change theme"- v-on:onClick="$store.dispatch('changeTheme')")</template><style lang="stylus" scoped>diff --git a/src/components/dashboard/DashboardStatControl.vue b/src/components/dashboard/DashboardStatControl.vuenew file mode 100644index 00000000..3c939eda--- /dev/null+++ b/src/components/dashboard/DashboardStatControl.vue@@ -0,0 +1,65 @@+<script>+export default {+}+</script>++<template lang="pug">+.component+ .component__wrap+ .tabs+ .tabItem(+ @click="$store.dispatch('setPeriodPrev')"+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isFirstPeriodSelected }") Next {{ this.$store.state.filter.period }}+ .tabItem(+ @click="$store.dispatch('setPeriodNext')"+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isLastPeriodSelected }") Last {{ this.$store.state.filter.period }}+ .tabs(@click="$store.commit('toogleDashboardTrnsHistory')")+ .tabItem(:class="{ _active: !$store.state.dashboard.showTrnsHistory }") Stat+ .tabItem(:class="{ _active: $store.state.dashboard.showTrnsHistory }") History+</template>++<style lang="stylus" scoped>+@import "~@/stylus/variables/animations"++$background = var(--c-bg-3)+$border = var(--c-bg-1)+$text = var(--c-font-4)+$text-active = var(--c-font-1)+$text-active_light = var(--c-font-2)+$text-disable = var(--c-font-5)++.component+ background $background++ &__wrap+ display grid+ grid-template-columns repeat(2, 1fr)+ max-width 1100px+ padding 15px 60px++.tabs+ display flex+ cursor pointer+ &:last-child+ justify-self end++.tabItem+ display flex+ align-items center+ color $text+ font-size 16px+ margin-right 30px+ anim()++ &:last-child+ margin-right 0++ &._active+ &:hover+ color $text-active+ /.theme-light &+ color $text-active_light++ &._disable+ color $text-disable+</style>diff --git a/src/components/stat/StatChartsLine.vue b/src/components/stat/StatChartsLine.vueindex fff731d1..92462144 100644--- a/src/components/stat/StatChartsLine.vue+++ b/src/components/stat/StatChartsLine.vue@@ -213,8 +213,7 @@ export default {:key="period.date":maxAmountValue="maxAmountValue":period="period"- parentClassName=".charts__items"- )+ parentClassName=".charts__items")//- popuptemplate(v-if="$store.state.ui.pc && $store.state.chart.hoveredPeriod.values")@@ -229,13 +228,13 @@ export default {@import "~@/stylus/variables/scrollbar".charts+ z-index 3position relativebackground var(--c-bg-2)border-bottom 1px solid var(--c-bg-1)@media $media-laptop- z-index 3- min-height 163px+ min-height 120pxopacity .7anim-all()@@ -260,13 +259,13 @@ export default {margin-bottom -1px@media $media-laptop- padding 0 $mb2+ padding 0 60px&._groupedpadding 0 $m7@media $media-laptop- padding 0 $mb2+ padding 0 60px&__navz-index 2diff --git a/src/components/stat/StatPc.vue b/src/components/stat/StatPc.vueindex f09188e9..9ed7ed84 100644--- a/src/components/stat/StatPc.vue+++ b/src/components/stat/StatPc.vue@@ -75,7 +75,7 @@ export default {&__itemflex 1max-width 400px- padding-top $m9+ padding-top 20px&:first-childalign-self start&:last-childdiff --git a/src/components/stat/StatSummaryPc.vue b/src/components/stat/StatSummaryPc.vueindex 8d814819..b704e0bd 100644--- a/src/components/stat/StatSummaryPc.vue+++ b/src/components/stat/StatSummaryPc.vue@@ -22,72 +22,73 @@ export default {<template lang="pug">.summary- //- expenses- //------------------------------------------------- .summary__item(:class="{ _expenses: statAverage.expenses > 0 || period === 'all' }")- template(v-if="statAverage.expenses > 0 || period === 'all'")- .summary__row- .summary__title._expenses {{ $lang.money.expenses }}- .summary__amount- Amount(- :big="true"- :currency="$store.state.currencies.base"- :value="stat.expenses.total.expenses"- :type="0")-- .summary__row(v-if="period !== 'all' && statAverage.expenses > 0")- .summary__average- .summary__average__icon: .mdi.mdi-chart-timeline- .summary__average__title {{ $lang.money.average }}- .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 {{ $lang.money.total }}- .summary__amount- Amount(- :big="true"- :currency="$store.state.currencies.base"- :value="stat.incomes.total.incomes - stat.expenses.total.expenses")-- template(v-if="period !== 'all' && statAverage.total !== 0")+ .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 {{ $lang.money.expenses }}+ .summary__amount+ Amount(+ :big="true"+ :currency="$store.state.currencies.base"+ :value="stat.expenses.total.expenses"+ :type="0")++ .summary__row(v-if="period !== 'all' && statAverage.expenses > 0").summary__average.summary__average__icon: .mdi.mdi-chart-timeline.summary__average__title {{ $lang.money.average }}.summary__amount._averageAmount(: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 {{ $lang.money.incomes }}- .summary__amount- Amount(- :big="true"- :currency="$store.state.currencies.base"- :value="stat.incomes.total.incomes"- :type="1")-- template(v-if="period !== 'all' && statAverage.incomes !== 0")+ :value="statAverage.expenses")++ //- total+ //------------------------------------------------+ .summary__item(:class="{ _total: statAverage.total !== 0 || period === 'all' }")+ template(v-if="statAverage.total !== 0 || period === 'all'").summary__row- .summary__average- .summary__average__icon: .mdi.mdi-chart-timeline- .summary__average__title {{ $lang.money.average }}- .summary__amount._average+ .summary__title {{ $lang.money.total }}+ .summary__amount+ Amount(+ :big="true"+ :currency="$store.state.currencies.base"+ :value="stat.incomes.total.incomes - stat.expenses.total.expenses")++ template(v-if="period !== 'all' && statAverage.total !== 0")+ .summary__row+ .summary__average+ .summary__average__icon: .mdi.mdi-chart-timeline+ .summary__average__title {{ $lang.money.average }}+ .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 {{ $lang.money.incomes }}+ .summary__amountAmount(+ :big="true":currency="$store.state.currencies.base"- :value="statAverage.incomes")+ :value="stat.incomes.total.incomes"+ :type="1")++ template(v-if="period !== 'all' && statAverage.incomes !== 0")+ .summary__row+ .summary__average+ .summary__average__icon: .mdi.mdi-chart-timeline+ .summary__average__title {{ $lang.money.average }}+ .summary__amount._average+ Amount(+ :currency="$store.state.currencies.base"+ :value="statAverage.incomes")</template><style lang="stylus" scoped>@@ -97,12 +98,16 @@ export default {.summaryoverflow hidden- display flex- flex-flow row- justify-content space-between+ background var(--c-bg-3)+ border-top 1px solid var(--c-bg-1)+ border-bottom 1px solid var(--c-bg-1)- @media $media-laptop+ &__wrapdisplay flex+ flex-flow row+ justify-content space-between+ max-width 1100px+ padding 20px 60px&__itemflex-grow 0diff --git a/src/components/stat/chart/ChartItem.vue b/src/components/stat/chart/ChartItem.vueindex 300d97ad..04daad72 100644--- a/src/components/stat/chart/ChartItem.vue+++ b/src/components/stat/chart/ChartItem.vue@@ -29,10 +29,13 @@ export default {const filterDate = this.$store.state.filter.dateconst filterPeriod = this.$store.state.filter.periodconst currentPeriodDate = this.period.date+ const hasTrns = this.period.expenses > 0 || this.period.incomes > 0+return {_active: moment(parseInt(currentPeriodDate)).isSame(filterDate, filterPeriod),[`_${filterPeriod}`]: true,- _grouped: this.$store.state.chart.periods[filterPeriod].grouped+ _grouped: this.$store.state.chart.periods[filterPeriod].grouped,+ _empty: !hasTrns && this.$store.state.chart.periods[filterPeriod].hideEmpty}},formatedPeriodName () {@@ -104,8 +107,7 @@ export default {:class="className"@click="handlePerioSelect"@mouseenter="onMouseEnterChartItem"- @mouseleave="$store.commit('clearHoveredPeriodValues')"-)+ @mouseleave="$store.commit('clearHoveredPeriodValues')").chart-item__graph.chart-item__graph-box(v-if="period.expenses <= 0 && period.incomes <= 0").chart-item__graph-line._empty@@ -196,7 +198,7 @@ export default {height 90px@media $media-laptop- height 121px+ height 90px^[0]._grouped &height calc(62px + 28px)diff --git a/src/components/trns/list/TrnsList.vue b/src/components/trns/list/TrnsList.vueindex 5bacac90..bfac8d7a 100644--- a/src/components/trns/list/TrnsList.vue+++ b/src/components/trns/list/TrnsList.vue@@ -3,8 +3,6 @@ import moment from 'moment'import TrnItem from '@/components/trns/item/TrnItem'import TrnsListDate from '@/components/trns/list/TrnsListDate'-// import { generateDateId } from '@/utils/id'-// import { db } from '@/firebase'export default {components: {