Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: personal workspace nomenclature update #3893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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