From 31084be5cedbfe5f2c59157ea5c5fe5cb7a90653 Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Mon, 25 Aug 2025 13:33:28 +0700 Subject: [PATCH] feat(loading-state): add loading indicators and skeleton UI for data tables - Implement loading state management across patient, doctor and satusehat lists - Add skeleton loading UI for data tables during data fetching - Refactor loading state variable naming for consistency - Make search nav optional in header component - Update icon sizing in header for better responsiveness - Implement url search params query state at satusehat --- app/components/flow/doctor/list.vue | 12 +- app/components/flow/patient/list.vue | 6 +- app/components/flow/satusehat/list.vue | 207 ++++++++++++------------- app/components/pub/base/data-table.vue | 25 +-- app/components/pub/nav/header/prep.vue | 13 +- 5 files changed, 139 insertions(+), 124 deletions(-) diff --git a/app/components/flow/doctor/list.vue b/app/components/flow/doctor/list.vue index c6007660..8615a5a1 100644 --- a/app/components/flow/doctor/list.vue +++ b/app/components/flow/doctor/list.vue @@ -15,6 +15,10 @@ const refSearchNav: RefSearchNav = { }, } +const isLoading = reactive({ + dataListLoading: false, +}) + const recId = ref(0) const recAction = ref('') const recItem = ref(null) @@ -28,13 +32,16 @@ const headerPrep: HeaderPrep = { }, } -useAsyncData('getDoctor', () => xfetch('/api/v1/doctor'), { server: false, immediate: true }) async function getDoctorList() { + isLoading.dataListLoading = true + const resp = await xfetch('/api/v1/doctor') if (resp.success) { data.value = (resp.body as Record).data } + + isLoading.dataListLoading = false } onMounted(() => { @@ -44,9 +51,10 @@ onMounted(() => { provide('rec_id', recId) provide('rec_action', recAction) provide('rec_item', recItem) +provide('pull_data', isLoading) diff --git a/app/components/flow/patient/list.vue b/app/components/flow/patient/list.vue index 3131d81d..4eee1912 100644 --- a/app/components/flow/patient/list.vue +++ b/app/components/flow/patient/list.vue @@ -20,8 +20,9 @@ const refSearchNav: RefSearchNav = { // Loading state management const isLoading = reactive({ summary: false, - table: false, + dataListLoading: false, }) + const recId = ref(0) const recAction = ref('') const recItem = ref(null) @@ -82,11 +83,13 @@ async function getPatientSummary() { } async function getPatientList() { + isLoading.dataListLoading = true const resp = await xfetch('/api/v1/patient') console.log('data patient', resp) if (resp.success) { data.value = (resp.body as Record).data } + isLoading.dataListLoading = false } onMounted(() => { @@ -97,6 +100,7 @@ onMounted(() => { provide('rec_id', recId) provide('rec_action', recAction) provide('rec_item', recItem) +provide('pull_data', isLoading)