From dec2ec84f1674c94fc87edb9ed9c5ff02532b732 Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Mon, 22 Sep 2025 14:11:29 -0400 Subject: [PATCH] fix(app): refactor and slim i18n files, correct and update pages, rework and refactor verbose code on some components and pages --- quasar.config.ts | 2 +- src/css/app.scss | 10 +-- src/css/quasar.variables.scss | 3 +- src/i18n/en-ca/index.ts | 2 + src/i18n/fr-ca/index.ts | 2 + .../employee/profile-panel-info-employee.vue | 14 ++-- .../employee/profile-panel-info-personal.vue | 14 ++-- .../shared/profile-panel-input-field.vue | 2 +- .../shared/profile-panel-preferences.vue | 8 +-- .../shared/profile-panel-select-field.vue | 2 +- .../pages/employee/profile-employee.vue | 6 +- ...al-employee-details-hours-worked-chart.vue | 65 ++++++++++--------- ...val-employee-details-shift-types-chart.vue | 27 ++++---- ...sheet-approval-employee-expenses-chart.vue | 63 +++++++++--------- ...val-employee-details-shifts-row-header.vue | 4 +- .../timesheet-approval-employee-details.vue | 51 +++++++-------- .../services/services-timesheet-approval.ts | 2 - src/router/index.ts | 1 - src/stores/employee-store.ts | 1 - src/stores/ui-store.ts | 1 + 20 files changed, 141 insertions(+), 139 deletions(-) diff --git a/quasar.config.ts b/quasar.config.ts index 221df0e..4d94787 100644 --- a/quasar.config.ts +++ b/quasar.config.ts @@ -106,7 +106,7 @@ export default defineConfig((ctx) => { color: 'primary', avatar: 'https://cdn.quasar.dev/img/boy-avatar.png', }, - dark: 'auto', + dark: false, }, // iconSet: 'material-icons', // Quasar icon set diff --git a/src/css/app.scss b/src/css/app.scss index ca5b5e6..e3d7a16 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -24,18 +24,12 @@ background: #00ff260c; } -div.q-dark { - color: $grey-2; -} - -div.q-light { - color: $grey-8; -} - body.body--dark { --q-secondary: #0f1114; + color: $grey-2; } .body--light { --q-dark: #FFF; + color: $grey-8; } \ No newline at end of file diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index 0c25c43..2131a9e 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -22,8 +22,7 @@ $elevation-dark-umbra : rgba($dark-shadow-color, 0.4); $elevation-dark-penumbra : rgba($dark-shadow-color, 0); $elevation-dark-ambient : rgba($dark-shadow-color, 0); -$dark-shadow-2 : 0 3px 5px -1px $elevation-dark-umbra, 0 5px 8px $elevation-dark-penumbra, 0 1px 14px $elevation-dark-ambient; - +$dark-shadow-2 : 0 3px 5px -1px $elevation-dark-umbra, 0 5px 8px $elevation-dark-penumbra, 0 1px 14px $elevation-dark-ambient; $layout-shadow-dark : 0 0 10px 5px rgba($dark-shadow-color, 0.5); $dark : #333; diff --git a/src/i18n/en-ca/index.ts b/src/i18n/en-ca/index.ts index f73fe51..1041d09 100644 --- a/src/i18n/en-ca/index.ts +++ b/src/i18n/en-ca/index.ts @@ -90,6 +90,8 @@ export default { from: "from", yes: "yes", no: "no", + in: "in", + out: "out", }, shift_type: { regular: "regular", diff --git a/src/i18n/fr-ca/index.ts b/src/i18n/fr-ca/index.ts index 9508945..c39cff3 100644 --- a/src/i18n/fr-ca/index.ts +++ b/src/i18n/fr-ca/index.ts @@ -90,6 +90,8 @@ export default { from: "de", yes: "oui", no: "non", + in: "entrée", + out: "sortie", }, shift_type: { regular: "régulier", diff --git a/src/modules/profile/components/employee/profile-panel-info-employee.vue b/src/modules/profile/components/employee/profile-panel-info-employee.vue index 26e3556..c5badb0 100644 --- a/src/modules/profile/components/employee/profile-panel-info-employee.vue +++ b/src/modules/profile/components/employee/profile-panel-info-employee.vue @@ -47,13 +47,13 @@ v-model="employee_form_data.job_title" class="col" :is-editing="is_editing" - :label-string="$t('profilePage.employeeInfo.jobTitle')" + :label-string="$t('profile.employee.job_title')" /> @@ -61,7 +61,7 @@ @@ -72,7 +72,7 @@ v-model="employee_form_data.email" class="col" :is-editing="is_editing" - :label-string="$t('profilePage.employeeInfo.workEmail')" + :label-string="$t('profile.employee.email')" /> @@ -94,7 +94,7 @@ type="reset" icon="cancel" class="q-ma-sm" - :label="$t('timesheet.cancel_button')" + :label="$t('shared.label.cancel')" /> diff --git a/src/modules/profile/components/employee/profile-panel-info-personal.vue b/src/modules/profile/components/employee/profile-panel-info-personal.vue index 07e2f92..3167479 100644 --- a/src/modules/profile/components/employee/profile-panel-info-personal.vue +++ b/src/modules/profile/components/employee/profile-panel-info-personal.vue @@ -46,14 +46,14 @@ type="text" class="col" :is-editing="is_editing" - :label-string="$t('profilePage.personalInfo.firstName')" + :label-string="$t('profile.personal.first_name')" /> @@ -63,7 +63,7 @@ class="col" type="text" :is-editing="is_editing" - :label-string="$t('profilePage.personalInfo.phoneNumber')" + :label-string="$t('profile.personal.phone_number')" /> @@ -80,8 +80,8 @@ v-model="personal_form_data.residence" class="col" :is-editing="is_editing" - :label-string="$t('profilePage.personalInfo.address')" - :hint="$t('profilePage.personalInfo.addressPlaceholder')" + :label-string="$t('profile.personal.address')" + :hint="$t('profile.personal.address_hint')" /> @@ -104,7 +104,7 @@ type="submit" :icon="is_editing ? 'save_alt' : 'create'" class="q-ma-sm" - :label="is_editing ? $t('timesheet.saveButton') : $t('shiftsTemplate.updateButton')" + :label="is_editing ? $t('shared.label.save') : $t('shared.label.update')" /> diff --git a/src/modules/profile/components/shared/profile-panel-input-field.vue b/src/modules/profile/components/shared/profile-panel-input-field.vue index 6aca9af..b69e4d6 100644 --- a/src/modules/profile/components/shared/profile-panel-input-field.vue +++ b/src/modules/profile/components/shared/profile-panel-input-field.vue @@ -23,7 +23,7 @@ filled debounce="500" label-color="primary" - class="q-ma-xs" + class="q-ma-xs text-uppercase" input-class="text-weight-medium text-h6" :hide-hint="hint === ''" :hint="isEditing ? hint : ''" diff --git a/src/modules/profile/components/shared/profile-panel-preferences.vue b/src/modules/profile/components/shared/profile-panel-preferences.vue index 8805b86..769879f 100644 --- a/src/modules/profile/components/shared/profile-panel-preferences.vue +++ b/src/modules/profile/components/shared/profile-panel-preferences.vue @@ -14,7 +14,7 @@ diff --git a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue index 728e623..1fe6976 100644 --- a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue +++ b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-hours-worked-chart.vue @@ -3,15 +3,17 @@ import { colors } from 'quasar'; import { Bar } from 'vue-chartjs'; import { useI18n } from 'vue-i18n'; + import { useQuasar } from 'quasar'; import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, type ChartData, type ChartOptions, type Plugin, type ChartDataset } from 'chart.js'; import type { PayPeriodEmployeeDetails } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-employee-details-interface'; const { t } = useI18n(); - + const $q = useQuasar(); ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale); ChartJS.defaults.font.family = '"Roboto", sans-serif'; ChartJS.defaults.maintainAspectRatio = false; + ChartJS.defaults.color = $q.dark.isActive ? '#F5F5F5' : '#616161'; const props = defineProps<{ rawData: PayPeriodEmployeeDetails | undefined; @@ -29,22 +31,22 @@ const datasetConfig = [ { key: 'regular_hours', - label: t('timeSheetValidations.hoursWorkedRegular'), + label: t('shared.shift_type.regular'), color: colors.getPaletteColor('green-5'), }, { key: 'evening_hours', - label: t('timeSheetValidations.hoursWorkedEvening'), + label: t('shared.shift_type.evening'), color: colors.getPaletteColor('green-9'), }, { key: 'emergency_hours', - label: t('timeSheetValidations.hoursWorkedEmergency'), + label: t('shared.shift_type.emergency'), color: getComputedStyle(document.body).getPropertyValue('--q-warning').trim(), }, { key: 'overtime_hours', - label: t('timeSheetValidations.hoursWorkedOvertime'), + label: t('shared.shift_type.overtime'), color: getComputedStyle(document.body).getPropertyValue('--q-negative').trim(), }, ] as const; @@ -67,33 +69,34 @@ \ No newline at end of file diff --git a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-shift-types-chart.vue b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-shift-types-chart.vue index 2e6cad1..7822a4e 100644 --- a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-shift-types-chart.vue +++ b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-details-shift-types-chart.vue @@ -3,15 +3,18 @@ import { ref } from 'vue'; import { colors } from 'quasar'; import { useI18n } from 'vue-i18n'; + import { useQuasar } from 'quasar'; import { Doughnut } from 'vue-chartjs'; - import { Chart as ChartJS, Title, Tooltip, Legend, ArcElement, CategoryScale, LinearScale, type ChartData, type ChartOptions, type Plugin, type ChartDataset } from 'chart.js'; + import { Chart as ChartJS, Title, Tooltip, Legend, ArcElement, CategoryScale, LinearScale, type ChartDataset } from 'chart.js'; import type { PayPeriodOverviewEmployee } from 'src/modules/timesheet-approval/types/timesheet-approval-pay-period-overview-employee-interface'; const { t } = useI18n(); + const $q = useQuasar(); ChartJS.register(Title, Tooltip, Legend, ArcElement, CategoryScale, LinearScale); ChartJS.defaults.font.family = '"Roboto", sans-serif'; ChartJS.defaults.maintainAspectRatio = false; + ChartJS.defaults.color = $q.dark.isActive ? '#F5F5F5' : '#616161'; const props = defineProps<{ rawData: PayPeriodOverviewEmployee | undefined; @@ -52,16 +55,18 @@ \ No newline at end of file diff --git a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-expenses-chart.vue b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-expenses-chart.vue index 7d78a9c..4090ea9 100644 --- a/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-expenses-chart.vue +++ b/src/modules/timesheet-approval/components/graphs/timesheet-approval-employee-expenses-chart.vue @@ -1,17 +1,19 @@ \ No newline at end of file diff --git a/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row-header.vue b/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row-header.vue index 14cce9d..eb36746 100644 --- a/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row-header.vue +++ b/src/modules/timesheet-approval/components/timesheet-approval-employee-details-shifts-row-header.vue @@ -9,7 +9,7 @@ - {{ $t('shiftColumns.labelIn') }} + {{ $t('shared.misc.in') }} @@ -20,7 +20,7 @@ - {{ $t('shiftColumns.labelOut') }} + {{ $t('shared.misc.out') }} diff --git a/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue b/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue index 74b1191..b2352f4 100644 --- a/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue +++ b/src/modules/timesheet-approval/pages/timesheet-approval-employee-details.vue @@ -30,32 +30,32 @@ const shift_type_legend: shiftColor[] = [ { - type: t('timesheet.shift_types.REGULAR'), + type: t('shared.shift_type.regular'), color: 'secondary', - text_color: 'grey-8', + text_color: '', }, { - type: t('timesheet.shift_types.EVENING'), + type: t('shared.shift_type.evening'), color: 'warning', }, { - type: t('timesheet.shift_types.EMERGENCY'), + type: t('shared.shift_type.emergency'), color: 'amber-10', }, { - type: t('timeSheetValidations.hoursWorkedOvertime'), + type: t('shared.shift_type.overtime'), color: 'negative', }, { - type: t('timesheet.shift_types.VACATION'), + type: t('shared.shift_type.vacation'), color: 'purple-10', }, { - type: t('timesheet.shift_types.HOLIDAY'), + type: t('shared.shift_type.holiday'), color: 'purple-8', }, { - type: t('timesheet.shift_types.SICK'), + type: t('shared.shift_type.sick'), color: 'grey-8', }, ] @@ -64,7 +64,7 @@