-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- moved dashboard buttons for changing currency and hidding values to…
… the sticky controls panel
- Loading branch information
1 parent
ce8ab72
commit 16d41ee
Showing
7 changed files
with
143 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
front/components/dashboard/dashboard-controls/dashboard-control-buttons.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div class="text-size-14 flex-center-vertical gap-1"> | ||
<div class="app-button-small" v-if="hasMultipleCurrencies" @click="onToggleTotalCurrency"> | ||
<app-icon :icon="TablerIconConstants.transaction" :size="14" /> | ||
{{ dataStore.dashboardCurrency }} | ||
</div> | ||
|
||
<div class="app-button-small" @click="onToggleShowDashboardAccountValues"> | ||
<app-icon :icon="profileStore.dashboard.showAccountAmounts ? TablerIconConstants.eyeHidden : TablerIconConstants.eyeVisible" :size="20" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { addMonths } from 'date-fns' | ||
import TablerIconConstants from '~/constants/TablerIconConstants.js' | ||
import { useWindowScroll } from '@vueuse/core' | ||
import { animateOnNext, animateOnPrevious } from '~/utils/AnimationUtils.js' | ||
const dataStore = useDataStore() | ||
const profileStore = useProfileStore() | ||
const hasMultipleCurrencies = computed(() => dataStore.dashboardAccountsCurrencyList.length > 1) | ||
const onToggleTotalCurrency = () => { | ||
if (dataStore.dashboardAccountsCurrencyList.length === 0) { | ||
return | ||
} | ||
let index = dataStore.dashboardAccountsCurrencyList.indexOf(dataStore.dashboardCurrency) | ||
let newIndex = (index + 1) % dataStore.dashboardAccountsCurrencyList.length | ||
dataStore.dashboardCurrency = dataStore.dashboardAccountsCurrencyList[newIndex] | ||
} | ||
const onToggleShowDashboardAccountValues = async () => { | ||
profileStore.dashboard.showAccountAmounts = !profileStore.dashboard.showAccountAmounts | ||
} | ||
</script> |
52 changes: 0 additions & 52 deletions
52
front/components/dashboard/dashboard-controls/dashboard-control-date.vue
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
front/components/dashboard/dashboard-controls/dashboard-control.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<van-cell-group inset class="dashboard-control-date" :style="style" @click="onChooseMonth"> | ||
<div class="flex-center-vertical gap-2"> | ||
<app-icon :icon="TablerIconConstants.leftArrow" @click.stop="onPreviousMonth" :size="24" class="m-10" /> | ||
<div class="flex-1 flex-center flex-column my-2"> | ||
<div class="text-size-14 font-weight-600">{{ rangeTitle }}</div> | ||
<dashboard-control-buttons /> | ||
</div> | ||
|
||
<app-icon :icon="TablerIconConstants.rightArrow" @click.stop="onNextMonth" :size="24" class="m-10" /> | ||
</div> | ||
</van-cell-group> | ||
|
||
<app-month-year v-model="dataStore.dashboard.month" v-model:showDropdown="showDropdown" /> | ||
</template> | ||
|
||
<script setup> | ||
import { addMonths } from 'date-fns' | ||
import TablerIconConstants from '~/constants/TablerIconConstants.js' | ||
import { useWindowScroll } from '@vueuse/core' | ||
import { animateOnNext, animateOnPrevious } from '~/utils/AnimationUtils.js' | ||
import DashboardControls from '~/components/dashboard/dashboard-controls/dashboard-control-buttons.vue' | ||
import DashboardControlButtons from '~/components/dashboard/dashboard-controls/dashboard-control-buttons.vue' | ||
const dataStore = useDataStore() | ||
const profileStore = useProfileStore() | ||
const dashboardControlDate = ref(null) | ||
const rangeTitle = computed(() => { | ||
let date1 = DateUtils.dateToUI(dataStore.dashboardDateStart) | ||
let date2 = DateUtils.dateToUI(dataStore.dashboardDateEnd) | ||
return `${date1} - ${date2}` | ||
}) | ||
const onNextMonth = () => { | ||
dataStore.dashboard.month = addMonths(dataStore.dashboard.month, 1) | ||
animateOnNext(dashboardControlDate.value) | ||
} | ||
const onPreviousMonth = () => { | ||
dataStore.dashboard.month = addMonths(dataStore.dashboard.month, -1) | ||
animateOnPrevious(dashboardControlDate.value) | ||
} | ||
const { y } = useWindowScroll() | ||
const style = computed(() => { | ||
return y.value > 20 ? `box-shadow: rgba(60, 64, 67, 0.1) 0px 1px 2px 0px, rgba(60, 64, 67, 0.05) 0px 1px 3px 1px;` : `` | ||
}) | ||
const showDropdown = ref(false) | ||
const onChooseMonth = () => { | ||
// showDropdown.value = true | ||
} | ||
watch( | ||
() => dataStore.dashboard.month, | ||
(newValue) => { | ||
dataStore.fetchDashboardTransactionsForInterval() | ||
}, | ||
) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters