Skip to content

Commit c9dfef6

Browse files
committed
feat: add loading skeleton to TwoPan component for improved UX
- Implemented a loading skeleton in the TwoPan component to enhance user experience during data fetching. - Added a computed property to determine the number of skeleton rows based on pagination settings. - Updated drawer component to use 'to' instead of 'href' for navigation links, aligning with Vue Router best practices.
1 parent 12afc38 commit c9dfef6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

apps/web/src/components/core/twopan.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ q-splitter.fit.q-custom-splitter.absolute.q-pa-sm(
3434
:selected-rows-label="(numberOfRows) => `${numberOfRows} entrée(s) sélectionnée(s)`"
3535
dense flat binary-state-sort
3636
)
37+
template(v-slot:loading)
38+
q-inner-loading(showing color='primary')
39+
.full-width.q-px-md
40+
q-skeleton(
41+
v-for='index in loadingSkeletonRows'
42+
:key='`twopan-loading-row-${index}`'
43+
type='text'
44+
height='18px'
45+
class='q-my-sm'
46+
)
3747
template(v-slot:top="props")
3848
slot(name="before-top" v-bind="{ ...props, selected, clearSelection }")
3949
slot(name="before-top-left" v-bind="{ ...props, selected, clearSelection }")
@@ -234,6 +244,11 @@ export default defineNuxtComponent({
234244
},
235245
},
236246
computed: {
247+
loadingSkeletonRows(): number {
248+
const rowsPerPage = Number(this.pagination?.rowsPerPage) || 12
249+
250+
return Math.min(Math.max(rowsPerPage, 6), 20)
251+
},
237252
visibleColumnsSelected(): QTableProps['visibleColumns'] {
238253
if (!this.visibleColumns || this.visibleColumns.length === 0) {
239254
return (this.columns || []).map((column) => column.name)

apps/web/src/components/layouts/default/drawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ q-drawer.flex(v-model="drawer" side="left" :mini="true" :breakpoint="0" bordered
1212
q-item(
1313
clickable
1414
v-ripple
15-
:href="encodePath(menu.path)" :active="encodePath(menu.path) === $route.fullPath"
15+
:to="encodePath(menu.path)" :active="encodePath(menu.path) === $route.fullPath"
1616
active-class="q-item--active"
1717
)
1818
q-separator(v-if='encodePath(menu.path) === $route.fullPath' vertical color='primary' size="5px" style='position: absolute; left: 0; height: 100%; margin-top: -8px;')

0 commit comments

Comments
 (0)