From 24f32d79b38aad80a7ceb0e5445044ffea889a3d Mon Sep 17 00:00:00 2001 From: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:07:26 +0530 Subject: [PATCH] refactor: remove badges and subtitle implementation from table and used slots instead --- .../hoppscotch-sh-admin/src/components.d.ts | 2 - .../src/pages/teams/index.vue | 71 +++---- .../src/pages/users/index.vue | 177 ++++++++++-------- .../src/pages/users/invited.vue | 53 +++--- .../src/components/smart/Table.vue | 81 +------- 5 files changed, 177 insertions(+), 207 deletions(-) diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index 3a217ec91..57133841b 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -23,11 +23,9 @@ declare module '@vue/runtime-core' { HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal'] HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture'] HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner'] - HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab'] HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable'] IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default'] IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] - IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default'] IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default'] TeamsAdd: typeof import('./components/teams/Add.vue')['default'] diff --git a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue b/packages/hoppscotch-sh-admin/src/pages/teams/index.vue index 657a01bdb..e79ce868a 100644 --- a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue +++ b/packages/hoppscotch-sh-admin/src/pages/teams/index.vue @@ -27,41 +27,42 @@

- - - +
+ + + +
{{ t('users.load_list_error') }}
- - + + + + + +
{{ t('users.no_users') }}
@@ -181,7 +224,7 @@ const newUsersList = computed(() => { uid: user.uid, name: user.displayName ?? '', email: user.email ?? '', - createdOn: getCreatedDate(user.createdOn), + createdOn: user.createdOn, }; }); }); @@ -194,19 +237,6 @@ const isUserAdmin = ( })[0].isAdmin; }; -// Returns index of all the admin users -const adminUsersIndices = computed(() => { - const indices = []; - for (let index = 0; index < usersList.value.length; index++) - if (usersList.value[index].isAdmin) indices.push(index); - return indices; -}); - -// Returns created time of all the users -const createdTime = computed(() => - usersList.value.map((user) => getCreatedTime(user.createdOn)) -); - // Headers that are used in the table const headings = [ t('users.id'), @@ -216,13 +246,8 @@ const headings = [ '', ]; -// Subtitles that are used in the table -const subtitles = reactive([ - { - colName: 'createdOn', - subtitle: createdTime, - }, -]); +//Names of the columns to be modified by this component +const colNames = ['name', 'createdOn']; // Send Invitation through Email const sendInvitation = useMutation(InviteNewUserDocument); diff --git a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue b/packages/hoppscotch-sh-admin/src/pages/users/invited.vue index ff0b36dc4..19954f535 100644 --- a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue +++ b/packages/hoppscotch-sh-admin/src/pages/users/invited.vue @@ -24,13 +24,33 @@

{{ t('users.no_invite') }}

- +
+ + + +
@@ -38,7 +58,7 @@ diff --git a/packages/hoppscotch-ui/src/components/smart/Table.vue b/packages/hoppscotch-ui/src/components/smart/Table.vue index 158521ee2..9e61fcc6f 100644 --- a/packages/hoppscotch-ui/src/components/smart/Table.vue +++ b/packages/hoppscotch-ui/src/components/smart/Table.vue @@ -1,5 +1,5 @@