-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Current.vue
56 lines (48 loc) · 1.51 KB
/
Current.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div
class="flex items-center overflow-x-auto whitespace-nowrap border-b border-dividerLight px-4 py-2 text-tiny text-secondaryLight"
>
<span class="truncate">
{{ currentWorkspace }}
</span>
<icon-lucide-chevron-right v-if="section" class="mx-2" />
{{ section }}
</div>
</template>
<script setup lang="ts">
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
isOnlyPersonal?: boolean
}>()
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
}
return personalWorkspaceName
})
const teamWorkspaceName = computed(() => {
if (workspace.value.type === "team" && workspace.value.teamName) {
return workspace.value.teamName
}
return `${t("workspace.team")}`
})
</script>