Skip to content

Commit

Permalink
refactor: personal workspace nomenclature update (#3893)
Browse files Browse the repository at this point in the history
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
  • Loading branch information
nivedin and jamesgeorge007 committed Mar 13, 2024
1 parent bf98009 commit 8fdba76
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 33 deletions.
1 change: 0 additions & 1 deletion packages/hoppscotch-common/locales/en.json
Expand Up @@ -988,7 +988,6 @@
"workspace": {
"change": "Change workspace",
"personal": "Personal Workspace",
"personal_workspace": "{name}'s Workspace",
"other_workspaces": "My Workspaces",
"team": "Workspace",
"title": "Workspaces"
Expand Down
11 changes: 3 additions & 8 deletions packages/hoppscotch-common/src/components/app/Header.vue
Expand Up @@ -331,14 +331,9 @@ const myTeams = useReadonlyStream(teamListAdapter.teamList$, null)
const workspace = workspaceService.currentWorkspace
const workspaceName = computed(() => {
if (workspace.value.type === "personal") {
return currentUser.value?.displayName
? t("workspace.personal_workspace", {
name: currentUser.value.displayName,
})
: t("workspace.personal")
}
return workspace.value.teamName
return workspace.value.type === "personal"
? t("workspace.personal")
: workspace.value.teamName
})
const refetchTeams = () => {
Expand Down
20 changes: 3 additions & 17 deletions packages/hoppscotch-common/src/components/workspace/Current.vue
Expand Up @@ -15,8 +15,6 @@ import { computed } from "vue"
import { useI18n } from "~/composables/i18n"
import { useService } from "dioc/vue"
import { WorkspaceService } from "~/services/workspace.service"
import { useReadonlyStream } from "~/composables/stream"
import { platform } from "~/platform"
const props = defineProps<{
section?: string
Expand All @@ -28,23 +26,11 @@ const t = useI18n()
const workspaceService = useService(WorkspaceService)
const workspace = workspaceService.currentWorkspace
const currentUser = useReadonlyStream(
platform.auth.getProbableUserStream(),
platform.auth.getProbableUser()
)
const currentWorkspace = computed(() => {
const personalWorkspaceName = currentUser.value?.displayName
? t("workspace.personal_workspace", { name: currentUser.value.displayName })
: t("workspace.personal")
if (props.isOnlyPersonal) {
return personalWorkspaceName
}
if (workspace.value.type === "team") {
return teamWorkspaceName.value
if (props.isOnlyPersonal || workspace.value.type === "personal") {
return t("workspace.personal")
}
return personalWorkspaceName
return teamWorkspaceName.value
})
const teamWorkspaceName = computed(() => {
Expand Down
Expand Up @@ -3,7 +3,7 @@
<div class="flex flex-col">
<div class="flex flex-col">
<HoppSmartItem
:label="personalWorkspaceName"
:label="t('workspace.personal')"
:icon="IconUser"
:info-icon="workspace.type === 'personal' ? IconDone : undefined"
:active-info-icon="workspace.type === 'personal'"
Expand Down Expand Up @@ -96,12 +96,6 @@ const currentUser = useReadonlyStream(
platform.auth.getProbableUser()
)
const personalWorkspaceName = computed(() =>
currentUser.value?.displayName
? t("workspace.personal_workspace", { name: currentUser.value.displayName })
: t("workspace.personal")
)
const workspaceService = useService(WorkspaceService)
const teamListadapter = workspaceService.acquireTeamListAdapter(null)
const myTeams = useReadonlyStream(teamListadapter.teamList$, [])
Expand Down

0 comments on commit 8fdba76

Please sign in to comment.