From 996e96c26cff5f53142999a603bf7d96afba5beb Mon Sep 17 00:00:00 2001 From: nivedin Date: Fri, 10 May 2024 15:54:07 +0530 Subject: [PATCH] chore: tweak header, selector UI for A/B testing --- .../src/components/app/Header.vue | 48 +++++++++++++------ .../src/components/workspace/Selector.vue | 10 ++-- .../src/helpers/teams/TeamListAdapter.ts | 1 + 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/packages/hoppscotch-common/src/components/app/Header.vue b/packages/hoppscotch-common/src/components/app/Header.vue index aa1a448da..7b895107b 100644 --- a/packages/hoppscotch-common/src/components/app/Header.vue +++ b/packages/hoppscotch-common/src/components/app/Header.vue @@ -43,12 +43,19 @@ @click="invokeAction('modals.support.toggle')" /> -
+
-
- + +
@@ -84,6 +95,7 @@ /> + { // Show the workspace selected team invite modal if the user is an owner of the team else show the default invite modal const handleInvite = () => { + if (!currentUser.value) return invokeAction("modals.login.toggle") + if ( workspace.value.type === "team" && workspace.value.teamID && diff --git a/packages/hoppscotch-common/src/components/workspace/Selector.vue b/packages/hoppscotch-common/src/components/workspace/Selector.vue index c1b4fca50..5ac3d7b65 100644 --- a/packages/hoppscotch-common/src/components/workspace/Selector.vue +++ b/packages/hoppscotch-common/src/components/workspace/Selector.vue @@ -59,7 +59,7 @@ />
@@ -85,7 +85,7 @@ import { useColorMode } from "@composables/theming" import { GetMyTeamsQuery } from "~/helpers/backend/graphql" import IconDone from "~icons/lucide/check" import { useLocalState } from "~/newstore/localstate" -import { defineActionHandler } from "~/helpers/actions" +import { defineActionHandler, invokeAction } from "~/helpers/actions" import { WorkspaceService } from "~/services/workspace.service" import { useService } from "dioc/vue" import { useElementVisibility, useIntervalFn } from "@vueuse/core" @@ -157,8 +157,8 @@ const switchToTeamWorkspace = (team: GetMyTeamsQuery["myTeams"][number]) => { workspaceService.changeWorkspace({ teamID: team.id, teamName: team.name, - role: team.myRole, type: "team", + role: team.myRole, }) } @@ -174,12 +174,16 @@ watch( (user) => { if (!user) { switchToPersonalWorkspace() + teamListadapter.dispose() } } ) const displayModalAdd = (shouldDisplay: boolean) => { + if (!currentUser.value) return invokeAction("modals.login.toggle") + showModalAdd.value = shouldDisplay + teamListadapter.fetchList() } defineActionHandler("modals.team.new", () => { diff --git a/packages/hoppscotch-common/src/helpers/teams/TeamListAdapter.ts b/packages/hoppscotch-common/src/helpers/teams/TeamListAdapter.ts index 271e6e2a1..7f0626aa4 100644 --- a/packages/hoppscotch-common/src/helpers/teams/TeamListAdapter.ts +++ b/packages/hoppscotch-common/src/helpers/teams/TeamListAdapter.ts @@ -50,6 +50,7 @@ export default class TeamListAdapter { } public dispose() { + this.teamList$.next([]) this.isDispose = true clearTimeout(this.timeoutHandle as any) this.timeoutHandle = null