-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add year toggle to expenses and income as well
- Loading branch information
Showing
9 changed files
with
80 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<template> | ||
<BudgetPane :title="t('page.expenses.title')" type="expenses" /> | ||
<BudgetPane type="expenses"> | ||
<template #title> | ||
<YearToggle key-path="page.expenses.expensesFor" /> | ||
</template> | ||
</BudgetPane> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useI18n } from 'vue-i18n'; | ||
import YearToggle from '@app/pages/shared/YearToggle.vue'; | ||
import BudgetPane from '../shared/BudgetPane.vue'; | ||
const { t } = useI18n(); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<template> | ||
<BudgetPane :title="t('page.income.title')" type="income" /> | ||
<BudgetPane type="income"> | ||
<template #title> | ||
<YearToggle key-path="page.income.incomeFor" /> | ||
</template> | ||
</BudgetPane> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useI18n } from 'vue-i18n'; | ||
import YearToggle from '@app/pages/shared/YearToggle.vue'; | ||
import BudgetPane from '../shared/BudgetPane.vue'; | ||
const { t } = useI18n(); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<template v-if="state.years.length > 1"> | ||
<Button :icon="RiArrowLeftSLine" rounded @click="rotateYear(-1)" /> | ||
<Button :icon="RiArrowRightSLine" rounded @click="rotateYear(1)" /> | ||
</template> | ||
<i18n-t tag="span" :keypath="keyPath" scope="global"> | ||
<template #year> | ||
<TextWheel :values="allYears" :value="state.activeYear" /> | ||
</template> | ||
</i18n-t> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/vue'; | ||
import { computed } from 'vue'; | ||
import Button from '@components/base/button/Button.vue'; | ||
import TextWheel from '@components/base/text-wheel/TextWheel.vue'; | ||
import { useDataStore } from '@store/state'; | ||
defineProps<{ | ||
keyPath: string; | ||
}>(); | ||
const { state, changeYear } = useDataStore(); | ||
const allYears = computed(() => state.years.map((v) => v.year)); | ||
const rotateYear = (dir: -1 | 1) => { | ||
const possibleYears = allYears.value; | ||
const currentIndex = possibleYears.indexOf(state.activeYear); | ||
const newIndex = (currentIndex + dir + possibleYears.length) % possibleYears.length; | ||
const newYear = possibleYears[newIndex]; | ||
changeYear(newYear); | ||
}; | ||
</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
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