Skip to content

Commit

Permalink
- route constant fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cioraneanu committed Sep 21, 2024
1 parent 23e84b9 commit 5736483
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 23 deletions.
2 changes: 1 addition & 1 deletion front/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const theme = computed(() => (profileStore.darkTheme ? 'dark' : 'white'))
onMounted(async () => {
if (!appStore.authToken) {
navigateTo(`${RouteConstants.ROUTE_SETTINGS_APP_CONFIG}`)
navigateTo(`${RouteConstants.ROUTE_SETTINGS_SETUP}`)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
<!-- <div class="flex-1 flex-center text-size-14 font-weight-600">Budgets</div>-->
<!-- </div>-->

<van-grid :column-num="3">
<van-grid v-if="hasBudgets" :column-num="3">
<dashboard-budget-item v-for="budget in budgetList" :value="budget" />
</van-grid>

<div v-else class="text-muted text-size-12 px-3 mb-15" style="margin-top: -10px">
No budgets ^_^
</div>
</van-cell-group>
</template>

Expand All @@ -20,4 +24,5 @@ import DashboardBudgetItem from '~/components/dashboard/dashboard-budgets/dashbo
const dataStore = useDataStore()
const budgetList = dataStore.budgetList
const hasBudgets = computed(() => budgetList.length > 0)
</script>
13 changes: 2 additions & 11 deletions front/constants/RouteConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@ export default {
ROUTE_EXTRAS: '/extras',
ROUTE_DASHBOARD: '/dashboard',

ROUTE_SETTINGS: '/settings',
ROUTE_SETTINGS_APP_CONFIG: '/settings/app-config',
ROUTE_SETTINGS_USER_PREFERENCES_DATE: '/settings/user-preferences-date',
ROUTE_SETTINGS_USER_PREFERENCES_TRANSACTIONS: '/settings/user-preferences-transactions',
ROUTE_SETTINGS_USER_PREFERENCES_QUICK_AMOUNTS: '/settings/user-preferences-quick-transaction-amounts',
ROUTE_SETTINGS_USER_PREFERENCES_TRANSACTION_FIELDS_ORDER: '/settings/user-preferences-transaction-fields-order',
ROUTE_SETTINGS_USER_PREFERENCES_DASHBOARD_CARDS_ORDER: '/settings/user-preferences-dashboard-cards-order',
ROUTE_SETTINGS_NEW_TRANSACTION_DEFAULTS: '/settings/user-preferences-new-transaction-defaults',
ROUTE_SETTINGS_USER_PREFERENCES_UI: '/settings/user-preferences-ui',
ROUTE_SETTINGS_USER_PREFERENCES_DASHBOARD: '/settings/user-preferences-dashboard',


ROUTE_SETTINGS: '/settings',
ROUTE_SETTINGS_SETUP: '/settings/setup',
ROUTE_SETTINGS_UI: '/settings/ui',
ROUTE_SETTINGS_FORMATTING: '/settings/formatting',
ROUTE_SETTINGS_DASHBOARD: '/settings/dashboard',
ROUTE_SETTINGS_DASHBOARD_CARDS_ORDER: '/settings/dashboard/cards',
ROUTE_SETTINGS_TRANSACTION: '/settings/transactions',
ROUTE_SETTINGS_TRANSACTION_FIELDS_ORDER: '/settings/transactions/fields',
ROUTE_SETTINGS_TRANSACTION_DEFAULT_VALUES: '/settings/transactions/defaults',
Expand Down
2 changes: 1 addition & 1 deletion front/pages/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


<app-card-info style="order: 99">
<app-field-link label="Configure cards" :icon="TablerIconConstants.settings" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_USER_PREFERENCES_DASHBOARD_CARDS_ORDER)" />
<app-field-link label="Configure cards" :icon="TablerIconConstants.settings" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_DASHBOARD_CARDS_ORDER)" />
</app-card-info>

</div>
Expand Down
75 changes: 75 additions & 0 deletions front/pages/settings/dashboard/cards.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div class="app-form">
<app-top-toolbar />

<van-form @submit="onSave" class="">
<van-cell-group inset class="p-10">
<div class="van-cell-fake flex-column">
<app-repeater v-model="fieldsList" :is-list-dynamic="false" :empty-item="{ value: '' }">
<template #content="{ element, index }">
<div class="app-field m-5" @click="onClickIsVisible(element)">
<div class="van-field__body flex-center-vertical gap-1 pointer-events-none prevent-select">
<app-icon :icon="element.icon" :size="20" />
<div class="flex-1">{{ element.name }}</div>
<app-icon :icon="getIsVisibleIcon(element)" :size="20" />
</div>
</div>
</template>
</app-repeater>
</div>
</van-cell-group>

<app-button-form-save />
</van-form>
</div>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import { useProfileStore } from '~/stores/profileStore'
import { useDataStore } from '~/stores/dataStore'
import UIUtils from '~/utils/UIUtils'
import { useToolbar } from '~/composables/useToolbar'
import RouteConstants from '~/constants/RouteConstants'
import TablerIconConstants from '~/constants/TablerIconConstants.js'
import { DASHBOARD_SECTIONS_LIST } from '~/constants/DashboardConstants.js'
const profileStore = useProfileStore()
const dataStore = useDataStore()
const fieldsList = ref([])
onMounted(() => {
init()
})
const onSave = async () => {
profileStore.dashboardOrderedCardsList = fieldsList.value
await profileStore.writeProfile()
UIUtils.showToastSuccess('User preferences saved')
init()
}
const getIsVisibleIcon = (element) => {
return element.isVisible ? TablerIconConstants.eyeVisible : TablerIconConstants.eyeHidden
}
const onClickIsVisible = (element) => {
element.isVisible = !element.isVisible
}
const init = () => {
let isListOk = profileStore.dashboardOrderedCardsList.length === DASHBOARD_SECTIONS_LIST.length
fieldsList.value = isListOk ? profileStore.dashboardOrderedCardsList : DASHBOARD_SECTIONS_LIST
}
const toolbar = useToolbar()
toolbar.init({
title: 'Dashboard cards order',
backRoute: RouteConstants.ROUTE_DASHBOARD,
})
onMounted(() => {
animateSettings()
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

<script setup>
import { onMounted, ref } from 'vue'
import { useProfileStore } from '~/stores/profileStore'
import { useDataStore } from '~/stores/dataStore'
import UIUtils from '~/utils/UIUtils'
import { useToolbar } from '~/composables/useToolbar'
import RouteConstants from '~/constants/RouteConstants'
import { useProfileStore } from '~/stores/profileStore.js'
import { useDataStore } from '~/stores/dataStore.js'
import UIUtils from '~/utils/UIUtils.js'
import { useToolbar } from '~/composables/useToolbar.js'
import RouteConstants from '~/constants/RouteConstants.js'
import { saveSettingsToStore, watchSettingsStore } from '~/utils/SettingUtils.js'
const profileStore = useProfileStore()
Expand Down Expand Up @@ -65,7 +65,7 @@ toolbar.init({
backRoute: RouteConstants.ROUTE_SETTINGS,
})
const onGoToDashboardCardsOrder = async () => await navigateTo(RouteConstants.ROUTE_SETTINGS_USER_PREFERENCES_DASHBOARD_CARDS_ORDER)
const onGoToDashboardCardsOrder = async () => await navigateTo(RouteConstants.ROUTE_SETTINGS_DASHBOARD_CARDS_ORDER)
onMounted(() => {
Expand Down
4 changes: 2 additions & 2 deletions front/pages/transactions/[[id]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<template #label>
<div class="flex-center-vertical gap-1">
<div class="flex-1">Source account</div>
<van-button v-if="showSourceAccountSuggestion" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_NEW_TRANSACTION_DEFAULTS)" size="mini" class="suggestion-button"
<van-button v-if="showSourceAccountSuggestion" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_TRANSACTION_DEFAULT_VALUES)" size="mini" class="suggestion-button"
>Set your default
</van-button>
</div>
Expand Down Expand Up @@ -121,7 +121,7 @@


<app-card-info style="order: 99">
<app-field-link label="Configure fields" :icon="TablerIconConstants.settings" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_USER_PREFERENCES_TRANSACTION_FIELDS_ORDER)" />
<app-field-link label="Configure fields" :icon="TablerIconConstants.settings" @click="navigateTo(RouteConstants.ROUTE_SETTINGS_TRANSACTION_FIELDS_ORDER)" />
</app-card-info>

</div>
Expand Down
1 change: 0 additions & 1 deletion front/plugins/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ axios.interceptors.request.use(
if (!appStore.hasAuthToken) {
const router = useRouter()
UIUtils.showToastError('No personal access token...')
// router.push(RouteConstants.ROUTE_SETTINGS_APP_CONFIG).then(r => {})
controller.abort()
}

Expand Down

0 comments on commit 5736483

Please sign in to comment.