diff --git a/packages/hoppscotch-common/src/components/app/Header.vue b/packages/hoppscotch-common/src/components/app/Header.vue index aa1a448da..e43782267 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 @@ /> + !!platform.platformFeatureFlags.workspaceSwitcherLogin?.value +) + /** * Once the PWA code is initialized, this holds a method * that can be called to show the user the installation @@ -380,6 +399,8 @@ const inviteTeam = (team: { name: string }, teamID: string) => { // 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 diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.ts index 9caf20e89..088cc2509 100644 --- a/packages/hoppscotch-common/src/platform/index.ts +++ b/packages/hoppscotch-common/src/platform/index.ts @@ -11,6 +11,7 @@ import { InspectorsPlatformDef } from "./inspectors" import { ServiceClassInstance } from "dioc" import { IOPlatformDef } from "./io" import { SpotlightPlatformDef } from "./spotlight" +import { Ref } from "vue" export type PlatformDef = { ui?: UIPlatformDef @@ -45,6 +46,11 @@ export type PlatformDef = { * If a value is not given, then the value is assumed to be true */ promptAsUsingCookies?: boolean + + /** + * Whether to show the A/B testing workspace switcher click login flow or not + */ + workspaceSwitcherLogin?: Ref } }