0
0
Fork 0

Added extra folder aliases & dynamic language import

This commit is contained in:
joan 2022-12-20 14:01:58 +01:00
parent 930aaa053d
commit 186fe472e3
8 changed files with 8977 additions and 67 deletions

View File

@ -5,6 +5,7 @@
"src/*": ["src/*"], "src/*": ["src/*"],
"app/*": ["*"], "app/*": ["*"],
"components/*": ["src/components/*"], "components/*": ["src/components/*"],
"composables/*": ["src/composables/*"],
"layouts/*": ["src/layouts/*"], "layouts/*": ["src/layouts/*"],
"pages/*": ["src/pages/*"], "pages/*": ["src/pages/*"],
"assets/*": ["src/assets/*"], "assets/*": ["src/assets/*"],

8925
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,24 +11,25 @@
"test": "echo \"No test specified\" && exit 0" "test": "echo \"No test specified\" && exit 0"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1", "@quasar/extras": "^1.15.8",
"vue-i18n": "^9.0.0", "axios": "^1.2.1",
"pinia": "^2.0.11", "pinia": "^2.0.28",
"@quasar/extras": "^1.0.0", "quasar": "^2.11.1",
"quasar": "^2.6.0", "validator": "^13.7.0",
"vue": "^3.0.0", "vue": "^3.2.45",
"vue-router": "^4.0.0" "vue-i18n": "^9.2.2",
"vue-router": "^4.1.6"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.10.0",
"eslint-plugin-vue": "^9.0.0",
"eslint-config-prettier": "^8.1.0",
"prettier": "^2.5.1",
"@intlify/vite-plugin-vue-i18n": "^3.3.1", "@intlify/vite-plugin-vue-i18n": "^3.3.1",
"@quasar/app-vite": "^1.0.0",
"@pinia/testing": "^0.0.14", "@pinia/testing": "^0.0.14",
"@quasar/app-vite": "^1.0.0",
"autoprefixer": "^10.4.2", "autoprefixer": "^10.4.2",
"postcss": "^8.4.14" "eslint": "^8.10.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^9.0.0",
"postcss": "^8.4.14",
"prettier": "^2.5.1"
}, },
"engines": { "engines": {
"node": "^18 || ^16 || ^14.19", "node": "^18 || ^16 || ^14.19",

View File

@ -74,6 +74,11 @@ module.exports = configure(function (/* ctx */) {
// extendViteConf (viteConf) {}, // extendViteConf (viteConf) {},
// viteVuePluginOptions: {}, // viteVuePluginOptions: {},
alias: {
composables: path.join(__dirname, './src/composables'),
filters: path.join(__dirname, './src/filters'),
},
vitePlugins: [ vitePlugins: [
[ [
'@intlify/vite-plugin-vue-i18n', '@intlify/vite-plugin-vue-i18n',

View File

@ -22,9 +22,16 @@ const userLocale = computed({
if (value === 'en') value = 'en-GB'; if (value === 'en') value = 'en-GB';
import(`quasar/lang/${value}`).then((language) => { // FIXME: Dynamic imports from absolute paths are not compatible with vite:
Quasar.lang.set(language.default); // https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
}); try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs')
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then(lang => {
Quasar.lang.set(lang.default)
})
} catch (error) {
}
}, },
}); });
@ -81,33 +88,19 @@ function logout() {
<div class="row no-wrap q-pa-md"> <div class="row no-wrap q-pa-md">
<div class="column panel"> <div class="column panel">
<div class="text-h6 q-mb-md">{{ t('components.userPanel.settings') }}</div> <div class="text-h6 q-mb-md">{{ t('components.userPanel.settings') }}</div>
<q-toggle <q-toggle v-model="userLocale" @update:model-value="saveLanguage"
v-model="userLocale" :label="t(`globals.lang['${userLocale}']`)" icon="public" color="orange" false-value="es"
@update:model-value="saveLanguage" true-value="en" />
:label="t(`globals.lang['${userLocale}']`)" <q-toggle v-model="darkMode" @update:model-value="saveDarkMode" :label="t(`globals.darkMode`)"
icon="public" checked-icon="dark_mode" color="orange" unchecked-icon="light_mode" />
color="orange"
false-value="es"
true-value="en"
/>
<q-toggle
v-model="darkMode"
@update:model-value="saveDarkMode"
:label="t(`globals.darkMode`)"
checked-icon="dark_mode"
color="orange"
unchecked-icon="light_mode"
/>
</div> </div>
<q-separator vertical inset class="q-mx-lg" /> <q-separator vertical inset class="q-mx-lg" />
<div class="column items-center panel"> <div class="column items-center panel">
<q-avatar size="80px"> <q-avatar size="80px">
<q-img <q-img :src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`" spinner-color="white" />
spinner-color="white"
/>
</q-avatar> </q-avatar>
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
@ -115,16 +108,8 @@ function logout() {
</div> </div>
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div> <div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div>
<q-btn <q-btn id="logout" color="orange" flat :label="t('globals.logOut')" size="sm" icon="logout"
id="logout" @click="logout()" v-close-popup />
color="orange"
flat
:label="t('globals.logOut')"
size="sm"
icon="logout"
@click="logout()"
v-close-popup
/>
</div> </div>
</div> </div>
</q-menu> </q-menu>

View File

@ -1,16 +1,6 @@
// app global css in SCSS form // app global css in SCSS form
@import './icons.scss'; @import './icons.scss';
.body--dark {
.q-card--dark {
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 2px 2px rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12);
}
.q-layout__shadow::after {
box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0px 10px rgba(0, 0, 0, 0.24) !important;
}
}
.link { .link {
color: $primary; color: $primary;
cursor: pointer; cursor: pointer;

View File

@ -23,8 +23,12 @@ $negative: #c10015;
$info: #31ccec; $info: #31ccec;
$warning: #f2c037; $warning: #f2c037;
$color-spacer-light: rgba(255, 255, 255, .12); $color-spacer-light: rgba(255, 255, 255, 0.12);
$color-spacer:rgba(255, 255, 255, .3); $color-spacer: rgba(255, 255, 255, 0.3);
$border-thin-light: 1px solid $color-spacer-light; $border-thin-light: 1px solid $color-spacer-light;
$separator-dark-color: rgba(0, 0, 0, 0.12);
$dark-shadow-color: #000;
$layout-shadow-dark: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0px 10px rgba(0, 0, 0, 0.24);
$spacing-md: 16px; $spacing-md: 16px;

View File

@ -228,8 +228,8 @@ export default {
requester: 'Requester', requester: 'Requester',
atender: 'Atender', atender: 'Atender',
request: 'Request', request: 'Request',
goTo: 'Go to' goTo: 'Go to',
} },
}, },
claim: { claim: {
pageTitles: { pageTitles: {
@ -296,11 +296,11 @@ export default {
}, },
invoiceOut: { invoiceOut: {
pageTitles: { pageTitles: {
invoiceOuts: 'InvoiceOuts', invoiceOuts: 'Invoices Out',
list: 'List', list: 'List',
createInvoiceOut: 'Create invoice out', createInvoiceOut: 'Create invoice out',
summary: 'Summary', summary: 'Summary',
basicData: 'Basic Data' basicData: 'Basic Data',
}, },
list: { list: {
ref: 'Reference', ref: 'Reference',
@ -309,7 +309,7 @@ export default {
client: 'Client', client: 'Client',
created: 'Created', created: 'Created',
company: 'Company', company: 'Company',
dued: 'Due date' dued: 'Due date',
}, },
card: { card: {
issued: 'Issued', issued: 'Issued',
@ -317,7 +317,7 @@ export default {
client: 'Client', client: 'Client',
company: 'Company', company: 'Company',
customerCard: 'Customer card', customerCard: 'Customer card',
ticketList: 'Ticket List' ticketList: 'Ticket List',
}, },
summary: { summary: {
issued: 'Issued', issued: 'Issued',
@ -335,8 +335,7 @@ export default {
nickname: 'Alias', nickname: 'Alias',
shipped: 'Shipped', shipped: 'Shipped',
totalWithVat: 'Amount', totalWithVat: 'Amount',
},
}
}, },
components: { components: {
topbar: {}, topbar: {},