From e6945ac07681d2c094bd2c0f0592d65181a06b75 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 12 May 2025 17:46:23 +0530 Subject: [PATCH] fix: all empty states now come from a common component --- frontend/components.d.ts | 1 + frontend/package.json | 3 +- frontend/postcss.config.js | 2 +- .../src/components/Controls/MultiSelect.vue | 16 +- frontend/src/components/EmptyState.vue | 24 + frontend/src/pages/Assignments.vue | 62 +- frontend/src/pages/BatchForm.vue | 9 +- frontend/src/pages/Batches.vue | 19 +- frontend/src/pages/CertifiedParticipants.vue | 20 +- frontend/src/pages/CourseForm.vue | 23 +- frontend/src/pages/Courses.vue | 18 +- frontend/src/pages/Jobs.vue | 25 +- frontend/src/pages/Programs.vue | 20 +- frontend/src/pages/QuizSubmissionList.vue | 15 +- frontend/src/pages/Quizzes.vue | 36 +- frontend/tailwind.config.js | 6 +- frontend/vite.config.js | 2 +- frontend/yarn.lock | 748 +-- package.json | 1 + yarn.lock | 5553 ----------------- 20 files changed, 512 insertions(+), 6091 deletions(-) create mode 100644 frontend/src/components/EmptyState.vue delete mode 100644 yarn.lock diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 7b544e12..7bdb98c6 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -47,6 +47,7 @@ declare module 'vue' { Discussions: typeof import('./src/components/Discussions.vue')['default'] EditCoverImage: typeof import('./src/components/Modals/EditCoverImage.vue')['default'] EditProfile: typeof import('./src/components/Modals/EditProfile.vue')['default'] + EmptyState: typeof import('./src/components/EmptyState.vue')['default'] EvaluationModal: typeof import('./src/components/Modals/EvaluationModal.vue')['default'] Evaluators: typeof import('./src/components/Evaluators.vue')['default'] Event: typeof import('./src/components/Modals/Event.vue')['default'] diff --git a/frontend/package.json b/frontend/package.json index e5f71227..50f57d68 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,6 +2,7 @@ "name": "frappe-ui-frontend", "private": true, "version": "0.0.0", + "type": "module", "scripts": { "dev": "vite", "serve": "vite preview", @@ -26,7 +27,7 @@ "codemirror-editor-vue3": "^2.8.0", "dayjs": "^1.11.6", "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.134", + "frappe-ui": "^0.1.141", "highlight.js": "^11.11.1", "lucide-vue-next": "^0.383.0", "markdown-it": "^14.0.0", diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js index 1b69d43b..1a526247 100644 --- a/frontend/postcss.config.js +++ b/frontend/postcss.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { plugins: { tailwindcss: {}, autoprefixer: {}, diff --git a/frontend/src/components/Controls/MultiSelect.vue b/frontend/src/components/Controls/MultiSelect.vue index a0b712e1..33369010 100644 --- a/frontend/src/components/Controls/MultiSelect.vue +++ b/frontend/src/components/Controls/MultiSelect.vue @@ -55,7 +55,10 @@ -
+
-
+
{{ value }} - +
-
diff --git a/frontend/src/components/EmptyState.vue b/frontend/src/components/EmptyState.vue new file mode 100644 index 00000000..8ca99cbd --- /dev/null +++ b/frontend/src/components/EmptyState.vue @@ -0,0 +1,24 @@ + + diff --git a/frontend/src/pages/Assignments.vue b/frontend/src/pages/Assignments.vue index 2f86283e..bf10174d 100644 --- a/frontend/src/pages/Assignments.vue +++ b/frontend/src/pages/Assignments.vue @@ -21,14 +21,28 @@
-
- - +
+
+ {{ __('{0} Assignments').format(assignmentCount) }} +
+
+ + +
-
- -
- {{ __('No assignments found') }} -
-
- {{ - __( - 'You have not created any assignments yet. To create a new assignment, click on the "New" button above.' - ) - }} -
-
+
{ if (!user.data?.is_moderator && !user.data?.is_instructor) { router.push({ name: 'Courses' }) } - + getAssignmentCount() titleFilter.value = router.currentRoute.value.query.title typeFilter.value = router.currentRoute.value.query.type }) @@ -179,6 +181,14 @@ const assignmentColumns = computed(() => { ] }) +const getAssignmentCount = () => { + call('frappe.client.get_count', { + doctype: 'LMS Assignment', + }).then((data) => { + assignmentCount.value = data + }) +} + const assignmentTypes = computed(() => { let types = ['', 'Document', 'Image', 'PDF', 'URL', 'Text'] return types.map((type) => { diff --git a/frontend/src/pages/BatchForm.vue b/frontend/src/pages/BatchForm.vue index 7e3e56b4..5c9b6ce2 100644 --- a/frontend/src/pages/BatchForm.vue +++ b/frontend/src/pages/BatchForm.vue @@ -56,7 +56,6 @@
-
{{ __('Settings') }} @@ -80,7 +79,6 @@
-
{{ __('Date and Time') }} @@ -137,7 +135,6 @@
-
{{ __('Configurations') }} @@ -205,9 +202,7 @@
{{ - __( - 'Appears when the batch URL is shared on socials' - ) + __('Appears when the batch URL is shared on socials') }}
@@ -239,7 +234,6 @@
-
{{ __('Payment') }} @@ -263,7 +257,6 @@ />
-
diff --git a/frontend/src/pages/Batches.vue b/frontend/src/pages/Batches.vue index 08214868..d5f6ba19 100644 --- a/frontend/src/pages/Batches.vue +++ b/frontend/src/pages/Batches.vue @@ -70,22 +70,8 @@ -
- -
- {{ __('No batches found') }} -
-
- {{ - __( - 'There are no batches matching the criteria. Keep an eye out, fresh learning experiences are on the way soon!' - ) - }} -
-
+ +
-
- -
- {{ __('No certified members') }} -
-
- {{ - __( - 'No certified members found. Please check again later or get certified yourself.' - ) - }} -
-
+