From 7b132f97c1d2c97bbeaee519677524d7ee3dab42 Mon Sep 17 00:00:00 2001 From: McPizza Date: Fri, 19 Jan 2024 17:13:39 +0000 Subject: [PATCH 01/36] fix user redirect link --- apps/web-app/components/layout/navbar.vue | 2 +- apps/web-app/plugins/trpcClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web-app/components/layout/navbar.vue b/apps/web-app/components/layout/navbar.vue index 1011fec0..d67c81ee 100644 --- a/apps/web-app/components/layout/navbar.vue +++ b/apps/web-app/components/layout/navbar.vue @@ -97,7 +97,7 @@ } if (!userOrgSlugs?.includes(orgSlug)) { - navigateTo(`/login`); + navigateTo(`/redirect`); } }); diff --git a/apps/web-app/plugins/trpcClient.ts b/apps/web-app/plugins/trpcClient.ts index 215f0c15..6906a6ca 100644 --- a/apps/web-app/plugins/trpcClient.ts +++ b/apps/web-app/plugins/trpcClient.ts @@ -18,7 +18,7 @@ export const errorHandler: TRPCLink = () => { err.message === 'You are not a member of this organization, redirecting...' ) { - navigateTo('/login'); + navigateTo('/redirect'); return; } From 170a6e5d8945151d1043617e708117a27db2a865 Mon Sep 17 00:00:00 2001 From: McPizza Date: Wed, 24 Jan 2024 21:33:11 +0000 Subject: [PATCH 02/36] update avatar component --- apps/web-app/components/un/ui-avatar.vue | 51 ++++++++++++++++++++--- apps/web-app/components/un/ui-tooltip.vue | 3 ++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/apps/web-app/components/un/ui-avatar.vue b/apps/web-app/components/un/ui-avatar.vue index edbe3461..077ffb2f 100644 --- a/apps/web-app/components/un/ui-avatar.vue +++ b/apps/web-app/components/un/ui-avatar.vue @@ -8,7 +8,11 @@ color?: string; publicId: string; type: 'user' | 'org' | 'group' | 'contact'; + tooltip?: string; avatarUrl?: string | undefined; + tooltipText?: string | undefined; + showIcon?: boolean | undefined; + tooltipIcon?: string | undefined; } : never >({ @@ -32,6 +36,16 @@ // It must be one of these values return ['user', 'org', 'group', 'contact'].includes(value); } + }, + tooltip: { + type: String, + required: false, + default: null + }, + showIcon: { + type: Boolean, + required: false, + default: false } }, setup(props: any) { @@ -44,25 +58,50 @@ useUtils().generateAvatarUrl(props.type, props.publicId, size) : null; }); + const tooltipText = computed(() => { + return props.tooltip ? props.tooltip : props.alt; + }); + const tooltipIcon = computed(() => { + switch (props.type) { + case 'user': + return 'i-ph-user'; + case 'org': + return 'i-ph-buildings'; + case 'group': + return 'i-ph-users-three'; + case 'contact': + return 'i-ph-at'; + default: + return 'i-ph-user'; + } + }); - return { avatarUrl }; + return { avatarUrl, tooltipText, tooltipIcon }; } }); //TODO: Ensure that the color prop is a pre-defined color so tailwindcss correctly generates it for the css diff --git a/apps/web-app/components/un/ui-tooltip.vue b/apps/web-app/components/un/ui-tooltip.vue index 14401a56..ca3e9f21 100644 --- a/apps/web-app/components/un/ui-tooltip.vue +++ b/apps/web-app/components/un/ui-tooltip.vue @@ -14,6 +14,9 @@ From 3f7953b1d70b158cdd153bc3daefbebc188708d6 Mon Sep 17 00:00:00 2001 From: McPizza Date: Wed, 24 Jan 2024 21:33:32 +0000 Subject: [PATCH 03/36] new convo redirect --- apps/web-app/pages/[orgSlug]/convo/new.vue | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/web-app/pages/[orgSlug]/convo/new.vue b/apps/web-app/pages/[orgSlug]/convo/new.vue index fceec464..e72ad1bd 100644 --- a/apps/web-app/pages/[orgSlug]/convo/new.vue +++ b/apps/web-app/pages/[orgSlug]/convo/new.vue @@ -412,7 +412,7 @@ publicId: firstParticipantPublicId }; const createNewConvoTrpc = $trpc.convos.createNewConvo.useMutation(); - await createNewConvoTrpc.mutate({ + const createNewConvo = await createNewConvoTrpc.mutate({ firstMessageType: type, to: convoToValue, participantsOrgMembersPublicIds: convoParticipantsOrgMembersPublicIds, @@ -424,20 +424,27 @@ message: stringify(messageEditorData.value) }); - if (createNewConvoTrpc.error) { + if (createNewConvoTrpc.status.value === 'error') { actionLoading.value = false; - } else { toast.add({ - title: 'Conversation created', - icon: 'i-ph-thumbs-up', + id: 'create_new_convo_fail', + title: 'Conversation creation failed', + description: `Conversation could not be created.`, + color: 'red', + icon: 'i-ph-warning-circle', timeout: 5000 }); - setTimeout(() => { - navigateTo( - `/${orgSlug}/convo/${createNewConvoTrpc.data.value?.publicId}` - ); - }, 1500); + return; } + toast.add({ + title: 'Conversation created', + description: `Redirecting to new conversation...`, + icon: 'i-ph-thumbs-up', + timeout: 5000 + }); + setTimeout(() => { + navigateTo(`/${orgSlug}/convo/${createNewConvo?.publicId}`); + }, 1500); }