Skip to content

Open source personal finance application

Change dashboard nav view: move next, prev period nav

Ilya Komichevfe66a55897f7
diff --git a/src/components/dashboard/Dashboard.vue b/src/components/dashboard/Dashboard.vue
index d6a8a46d..6d441e94 100644
--- a/src/components/dashboard/Dashboard.vue
+++ b/src/components/dashboard/Dashboard.vue
@@ -57,57 +57,19 @@ export default {
:class="{ _active: $store.state.dashboard.showTrnsHistory }") History
.statMain__header__group._center
- .statMain__header__item
- .d-button-cirle._nav(
- @click="$store.dispatch('setPeriodPrev')"
- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isFirstPeriodSelected }"
- ): .mdi.mdi-chevron-left
-
- .statMain__header__item
- ContextMenu._dark(
- :position="{ right: true, top: true }"
- :visible="visiblePeriodMenu"
- v-on:onClickOpener="visiblePeriodMenu = !visiblePeriodMenu")
- template(slot="opener")
- Dropdown._minWidth(
- :active="visiblePeriodMenu"
- :title="$store.state.filter.period")
- template(slot="content")
- ContextMenuItem(
- icon="mdi mdi-weather-sunset-up"
- title="Day"
- :selected="$store.state.filter.period === 'day'"
- v-on:onClick="$store.dispatch('setPeriod', 'day')"
- v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
- ContextMenuItem(
- icon="mdi mdi-calendar-week"
- title="Week"
- :selected="$store.state.filter.period === 'week'"
- v-on:onClick="$store.dispatch('setPeriod', 'week')"
- v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
- ContextMenuItem(
- icon="mdi mdi-calendar"
- title="Month"
- :selected="$store.state.filter.period === 'month'"
- v-on:onClick="$store.dispatch('setPeriod', 'month')"
- v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
- ContextMenuItem(
- icon="mdi mdi-calendar-star"
- title="Year"
- :selected="$store.state.filter.period === 'year'"
- v-on:onClick="$store.dispatch('setPeriod', 'year')"
- v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
- ContextMenuItem(
- icon="mdi mdi-database"
- title="Show all"
- :selected="$store.state.filter.period === 'all'"
- v-on:onClick="$store.dispatch('setPeriod', 'all')"
- v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
- .statMain__header__item
- .d-button-cirle._nav(
- @click="$store.dispatch('setPeriodNext')"
- :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isLastPeriodSelected }"
- ): .mdi.mdi-chevron-right
+ .statMain__header__item._monthNav(
+ @click="$store.dispatch('setPeriodPrev')"
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters.isFirstPeriodSelected }")
+ .mdi.mdi-chevron-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-right
+
+ .statMain__header__group
.statMain__content
//- empty
@@ -128,6 +90,7 @@ export default {
<style lang="stylus" scoped>
@import "~@/stylus/variables/margins"
+@import "~@/stylus/variables/media"
@import "~@/stylus/variables/flex"
@import "~@/stylus/variables/fonts"
@import "~@/stylus/variables/scrollbar"
@@ -161,17 +124,21 @@ export default {
&__header
display grid
grid-template-columns repeat(3, 1fr)
- align-items center
padding $m9 $mb2
+ grid-column-gap $m9
padding-bottom 0
&__group
display-flex()
+ flex 1 1 450px
&._center
- justify-content center
+ justify-self center
&__item
+ display flex
+ align-items center
margin-right $m9
+ padding $m3 $m6
&._tabName
font-header-4()
color var(--c-font-5)
@@ -179,6 +146,15 @@ export default {
margin-right 0
&._active
color var(--c-font-3)
+ border-bottom 2px solid var(--c-font-3)
+ &._monthNav
+ font-header-1()
+ color var(--c-font-5)
+ white-space nowrap
+ &._disable
+ opacity .5
+ &:hover:not(._active):not(._disable):not(._spacer)
+ background var(--c-bg-1)
&__content
position relative
diff --git a/src/components/dashboard/DashboardNav.vue b/src/components/dashboard/DashboardNav.vue
index 286c3594..d3c035bd 100644
--- a/src/components/dashboard/DashboardNav.vue
+++ b/src/components/dashboard/DashboardNav.vue
@@ -14,7 +14,8 @@ export default {
data () {
return {
- visibleContextMenu: false
+ visibleContextMenu: false,
+ visiblePeriodMenu: false
}
}
}
@@ -23,8 +24,46 @@ export default {
<template lang="pug">
.period-nav
.period-nav__group
- .period-nav__item(@click="$store.dispatch('setPeriod', $store.state.filter.period)")
- .date: Date
+ .period-nav__item
+ ContextMenu._dark(
+ :position="{ left: true, top: true }"
+ :visible="visiblePeriodMenu"
+ v-on:onClickOpener="visiblePeriodMenu = !visiblePeriodMenu")
+ template(slot="opener")
+ .dateSelecror
+ .dateSelecror__date: Date
+ .dateSelecror__arrow: .mdi.mdi-chevron-down
+ template(slot="content")
+ ContextMenuItem(
+ icon="mdi mdi-weather-sunset-up"
+ title="Day"
+ :selected="$store.state.filter.period === 'day'"
+ v-on:onClick="$store.dispatch('setPeriod', 'day')"
+ v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
+ ContextMenuItem(
+ icon="mdi mdi-calendar-week"
+ title="Week"
+ :selected="$store.state.filter.period === 'week'"
+ v-on:onClick="$store.dispatch('setPeriod', 'week')"
+ v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
+ ContextMenuItem(
+ icon="mdi mdi-calendar"
+ title="Month"
+ :selected="$store.state.filter.period === 'month'"
+ v-on:onClick="$store.dispatch('setPeriod', 'month')"
+ v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
+ ContextMenuItem(
+ icon="mdi mdi-calendar-star"
+ title="Year"
+ :selected="$store.state.filter.period === 'year'"
+ v-on:onClick="$store.dispatch('setPeriod', 'year')"
+ v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
+ ContextMenuItem(
+ icon="mdi mdi-database"
+ title="Show all"
+ :selected="$store.state.filter.period === 'all'"
+ v-on:onClick="$store.dispatch('setPeriod', 'all')"
+ v-on:onClose="visiblePeriodMenu = !visiblePeriodMenu")
.period-nav__group
._align-right
@@ -82,14 +121,23 @@ export default {
&:last-child
margin-right 0
-.date
- flex-grow 0
+.dateSelecror
display flex
- justify-content center
align-items center
- font-header-1()
- color var(--c-font-4)
- font-size 28px
+
+ &__date
+ flex-grow 0
+ display flex
+ justify-content center
+ align-items center
+ font-header-1()
+ color var(--c-font-4)
+ font-size 28px
+
+ &__arrow
+ margin-left $m5
+ color var(--c-font-5)
+ font-size 32px
.d-button
display inline-flex
diff --git a/src/components/layout/LayoutPc.vue b/src/components/layout/LayoutPc.vue
index e6867a37..a8dd1657 100644
--- a/src/components/layout/LayoutPc.vue
+++ b/src/components/layout/LayoutPc.vue
@@ -72,6 +72,8 @@ export default {
.layout__item
Dashboard
+ //- categories
+ //------------------------------------------------
LayoutPcTab(:show="activeTab === 'categories'")
.dashboard__title Categories
CategoriesList.dashboardItems(v-on:onClick="(id) => handleShowCategoryModal(id)")
@@ -81,9 +83,11 @@ export default {
title="New category"
v-on:onClick="$store.dispatch('setActiveTab', 'createCategory')")
+ //- wallets
+ //------------------------------------------------
LayoutPcTab(:show="activeTab === 'wallets'")
.dashboard__title Wallets
- WalletsList(
+ WalletsList.dashboardItems(
ui="tile"
v-on:onClick="(id) => handleShowWalletModal(id)")
Button(
@@ -92,16 +96,30 @@ export default {
title="New wallet"
v-on:onClick="$store.dispatch('setActiveTab', 'createWallet')")
+ //- add category
+ //------------------------------------------------
LayoutPcTab(:show="activeTab === 'createCategory'")
CategoryForm(v-if="activeTab === 'createCategory'")
+ //- add wallet
+ //------------------------------------------------
LayoutPcTab(:show="activeTab === 'createWallet'")
WalletForm(v-if="activeTab === 'createWallet'")
+ //- settings
+ //------------------------------------------------
LayoutPcTab(:show="activeTab === 'settings'")
Settings
</template>
+<style lang="stylus">
+@import "~@/stylus/variables/margins"
+
+.dashboardItems .categoryItem
+.dashboardItems .walletItemTile
+ padding $m8
+</style>
+
<style lang="stylus" scoped>
@import "~@/stylus/variables/fonts"
@import "~@/stylus/variables/margins"
@@ -131,7 +149,7 @@ export default {
position relative
overflow hidden
height 100%
- max-width 1500px
+ max-width 1527px
&__wrap
overflow hidden
@@ -140,7 +158,6 @@ export default {
height 100%
display grid
grid-template-columns minMax(280px, 320px) 1fr
- max-width 1500px
min-width 600px
background var(--c-bg-2)
diff --git a/src/components/layout/LayoutPcSidebar.vue b/src/components/layout/LayoutPcSidebar.vue
index 152f2f5a..2fd62bad 100644
--- a/src/components/layout/LayoutPcSidebar.vue
+++ b/src/components/layout/LayoutPcSidebar.vue
@@ -1,12 +1,23 @@
<script>
+import ContextMenu from '@/components/shared/contextMenu/ContextMenu'
+import ContextMenuItem from '@/components/shared/contextMenu/ContextMenuItem'
import WalletsList from '@/components/wallets/list/WalletsList'
import WalletsTotal from '@/components/wallets/total/WalletsTotal'
export default {
components: {
+ ContextMenu,
+ ContextMenuItem,
WalletsList,
WalletsTotal
},
+
+ data () {
+ return {
+ visibleSettingsMenu: false
+ }
+ },
+
computed: {
activeTab () {
return this.$store.state.ui.activeTab
@@ -26,10 +37,29 @@ export default {
.sidebar
.sidebar__top
.sidebar__menu
- .sidebar__menu__item(
- :class="{ _active: activeTab === 'settings'}"
- @click="$store.dispatch('setActiveTab', 'settings')"
- ): .mdi.mdi-settings-outline
+ ContextMenu(
+ :position="{ left: true, top: true }"
+ :visible="visibleSettingsMenu"
+ v-on:onClickOpener="visibleSettingsMenu = !visibleSettingsMenu")
+ template(slot="opener")
+ .link(:class="{ _active: visibleSettingsMenu }"): .mdi.mdi-settings-outline
+
+ template(slot="content")
+ ContextMenuItem(
+ icon="mdi mdi-palette"
+ title="Change theme"
+ v-on:onClick="$store.dispatch('changeTheme')")
+ ContextMenuItem(
+ icon="mdi mdi-settings"
+ title="Go to settings"
+ v-on:onClick="$store.dispatch('setActiveTab', 'settings')"
+ v-on:onClose="visibleSettingsMenu = !visibleSettingsMenu")
+ .context-menu-sep
+ ContextMenuItem(
+ icon="mdi mdi-logout"
+ title="Sign Out"
+ v-on:onClick="$store.dispatch('signOut')"
+ v-on:onClose="visibleSettingsMenu = !visibleSettingsMenu")
.sidebar__menu__item(
:class="{ _active: activeTab === 'wallets'}"
@@ -52,8 +82,7 @@ export default {
WalletsList(
:showToogle="true"
:limit="6"
- v-on:onClick="(id) => handleShowWalletModal(id)"
- )
+ v-on:onClick="(id) => handleShowWalletModal(id)")
</template>
<style lang="stylus" scoped>
@@ -75,12 +104,13 @@ export default {
padding 0 $m7
&__item
+ position relative
display inline-flex
align-items center
justify-content center
padding $m7 $m8
font-header-1()
- font-size 18px
+ font-size 22px
color var(--c-font-4)
&:hover
@@ -94,4 +124,15 @@ export default {
overflow-y auto
padding $m5 0
scrollbar()
+
+.link
+ z-index 1
+ padding $m7 $m8
+ font-header-1()
+ font-size 22px
+ color var(--c-font-4)
+
+ &:hover:not(._active)
+ @media $media-laptop
+ background var(--c-bg-6)
</style>
diff --git a/src/stylus/variables/colors-light.styl b/src/stylus/variables/colors-light.styl
index 6d7d32ad..b754facd 100644
--- a/src/stylus/variables/colors-light.styl
+++ b/src/stylus/variables/colors-light.styl
@@ -24,6 +24,7 @@
--c-bg-10 rgba(230, 230, 230, 1)
--c-bg-11 rgba(0, 0, 0, 0.04)
--c-bg-12 rgba(100, 100, 100, 1)
+ --c-bg-13 rgba(120, 120, 120, 1)
--c-bg-overflow rgba(0, 0, 0, .6)
// fonts