@antelopejs/dms-lang 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/dist/pages/actions.d.ts +7 -0
- package/dist/pages/actions.js +15 -0
- package/dist/pages/actions.js.map +1 -0
- package/dist/pages/component-action.d.ts +2 -0
- package/dist/pages/component-action.js +10 -0
- package/dist/pages/component-action.js.map +1 -0
- package/dist/pages/header-actions.d.ts +9 -0
- package/dist/pages/header-actions.js +146 -0
- package/dist/pages/header-actions.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +6 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/language.d.ts +10 -0
- package/dist/pages/language.js +89 -0
- package/dist/pages/language.js.map +1 -0
- package/dist/pages/languages-table.d.ts +2 -0
- package/dist/pages/languages-table.js +120 -0
- package/dist/pages/languages-table.js.map +1 -0
- package/dist/pages/module.d.ts +7 -1
- package/dist/pages/module.js +28 -2
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview.d.ts +2 -1
- package/dist/pages/overview.js +83 -8
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/page-actions.d.ts +6 -0
- package/dist/pages/page-actions.js +10 -0
- package/dist/pages/page-actions.js.map +1 -0
- package/dist/pages/quick-actions.d.ts +1 -0
- package/dist/pages/quick-actions.js +56 -0
- package/dist/pages/quick-actions.js.map +1 -0
- package/dist/pages/translations.d.ts +7 -1
- package/dist/pages/translations.js +47 -10
- package/dist/pages/translations.js.map +1 -1
- package/dist/pages/workspace-guard.d.ts +1 -0
- package/dist/pages/workspace-guard.js +35 -0
- package/dist/pages/workspace-guard.js.map +1 -0
- package/dist/pages/workspace.d.ts +18 -0
- package/dist/pages/workspace.js +162 -0
- package/dist/pages/workspace.js.map +1 -0
- package/dist/pages/workspaces.d.ts +14 -0
- package/dist/pages/workspaces.js +88 -0
- package/dist/pages/workspaces.js.map +1 -0
- package/dist/routes/publicLocales.d.ts +3 -2
- package/dist/routes/publicLocales.js +39 -18
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/routes/translations.d.ts +59 -63
- package/dist/routes/translations.js +400 -119
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/announce.d.ts +9 -0
- package/dist/utils/announce.js +29 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/blocks.d.ts +8 -0
- package/dist/utils/blocks.js +213 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/body.d.ts +1 -0
- package/dist/utils/body.js +21 -0
- package/dist/utils/body.js.map +1 -0
- package/dist/utils/cache.d.ts +3 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/catalog.d.ts +7 -0
- package/dist/utils/catalog.js +62 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coverage.d.ts +2 -0
- package/dist/utils/coverage.js +11 -0
- package/dist/utils/coverage.js.map +1 -0
- package/dist/utils/dialogs.d.ts +7 -0
- package/dist/utils/dialogs.js +103 -0
- package/dist/utils/dialogs.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.js +60 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/export.js +129 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/json.d.ts +10 -1
- package/dist/utils/json.js +127 -19
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/key-stores.d.ts +3 -0
- package/dist/utils/key-stores.js +24 -0
- package/dist/utils/key-stores.js.map +1 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +252 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/languages.d.ts +27 -0
- package/dist/utils/languages.js +121 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/locale-codes.d.ts +5 -0
- package/dist/utils/locale-codes.js +56 -0
- package/dist/utils/locale-codes.js.map +1 -0
- package/dist/utils/locale-discovery.d.ts +1 -0
- package/dist/utils/locale-discovery.js +19 -1
- package/dist/utils/locale-discovery.js.map +1 -1
- package/dist/utils/message-check.d.ts +1 -0
- package/dist/utils/message-check.js +93 -0
- package/dist/utils/message-check.js.map +1 -0
- package/dist/utils/message-syntax.d.ts +6 -0
- package/dist/utils/message-syntax.js +38 -0
- package/dist/utils/message-syntax.js.map +1 -0
- package/dist/utils/namespaces.d.ts +12 -0
- package/dist/utils/namespaces.js +52 -0
- package/dist/utils/namespaces.js.map +1 -0
- package/dist/utils/notices.d.ts +4 -0
- package/dist/utils/notices.js +60 -0
- package/dist/utils/notices.js.map +1 -0
- package/dist/utils/own.d.ts +2 -3
- package/dist/utils/own.js +17 -57
- package/dist/utils/own.js.map +1 -1
- package/dist/utils/public-url.d.ts +8 -0
- package/dist/utils/public-url.js +87 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/registry.d.ts +3 -1
- package/dist/utils/registry.js +26 -10
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.d.ts +18 -15
- package/dist/utils/resolve.js +98 -151
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +5 -0
- package/dist/utils/review.js +64 -0
- package/dist/utils/review.js.map +1 -0
- package/dist/utils/snippets.d.ts +7 -0
- package/dist/utils/snippets.js +129 -0
- package/dist/utils/snippets.js.map +1 -0
- package/dist/utils/summary.d.ts +23 -0
- package/dist/utils/summary.js +65 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/utils/tree.d.ts +2 -17
- package/dist/utils/tree.js +21 -126
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +45 -15
- package/dist/utils/workspaces.js +256 -164
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/validation/key.schema.d.ts +71 -0
- package/dist/validation/key.schema.js +67 -0
- package/dist/validation/key.schema.js.map +1 -0
- package/dist/validation/query.schema.d.ts +17 -0
- package/dist/validation/query.schema.js +44 -0
- package/dist/validation/query.schema.js.map +1 -0
- package/dist/validation/validate.d.ts +2 -0
- package/dist/validation/validate.js +24 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/validation/workspace.schema.d.ts +145 -0
- package/dist/validation/workspace.schema.js +83 -0
- package/dist/validation/workspace.schema.js.map +1 -0
- package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
- package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
- package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
- package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
- package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
- package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
- package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
- package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
- package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
- package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
- package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
- package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
- package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
- package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
- package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
- package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
- package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
- package/frontend-vue/app/components/TranslationQueue.vue +212 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
- package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
- package/frontend-vue/app/components/WorkspaceList.vue +454 -0
- package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
- package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
- package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
- package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
- package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
- package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
- package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
- package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
- package/frontend-vue/app/types/lang.ts +130 -0
- package/frontend-vue/app/utils/boundedCache.ts +22 -0
- package/frontend-vue/app/utils/download.ts +16 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
- package/frontend-vue/app/utils/keySaves.ts +108 -0
- package/frontend-vue/app/utils/languages.ts +272 -0
- package/frontend-vue/app/utils/matrixExport.ts +47 -0
- package/frontend-vue/app/utils/queueDrafts.ts +115 -0
- package/frontend-vue/app/utils/queuePass.ts +145 -0
- package/frontend-vue/app/utils/queueView.ts +22 -0
- package/frontend-vue/app/utils/shortcuts.ts +75 -0
- package/frontend-vue/app/utils/translations.ts +756 -0
- package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
- package/frontend-vue/app/utils/workspaces.ts +45 -0
- package/frontend-vue/dms.frontend.build.ts +5 -0
- package/frontend-vue/dms.frontend.ts +9 -20
- package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
- package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
- package/frontend-vue/package.json +10 -5
- package/package.json +10 -8
- package/dist/utils/mutations.d.ts +0 -3
- package/dist/utils/mutations.js +0 -35
- package/dist/utils/mutations.js.map +0 -1
- package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
- package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
- package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
- package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
- package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
- package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
- package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
- package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
- package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
- package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
- package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useLangChanges } from '../composables/translation/useWorkspaceFlat'
|
|
3
|
+
import { useDmsRouter, useDmsState } from '#dms/frontend-module'
|
|
4
|
+
import type { DropdownMenuItem } from '@nuxt/ui'
|
|
5
|
+
import type { WorkspaceSummary } from '../types/lang'
|
|
6
|
+
import LocaleTile from '../build/components/LocaleTile.vue'
|
|
7
|
+
|
|
8
|
+
/** Marks the workspace shown in the menu. */
|
|
9
|
+
const CURRENT_ICON = 'i-ph-check'
|
|
10
|
+
/** From this many workspaces on, the menu gets a filter field. */
|
|
11
|
+
const MENU_FILTER_THRESHOLD = 7
|
|
12
|
+
const MENU_FILTER_FIELDS = ['label', 'description', 'workspaceId', 'summary']
|
|
13
|
+
|
|
14
|
+
const { t } = useI18n()
|
|
15
|
+
const { formatCount } = useLangFormat()
|
|
16
|
+
const { workspaces, editable, isLoaded, selectedWorkspace } =
|
|
17
|
+
useI18nWorkspaces()
|
|
18
|
+
const {
|
|
19
|
+
current,
|
|
20
|
+
isEditable,
|
|
21
|
+
isModules,
|
|
22
|
+
isAdded,
|
|
23
|
+
isUnknown,
|
|
24
|
+
isResolved,
|
|
25
|
+
} = useWorkspaceContext()
|
|
26
|
+
useLangChanges()
|
|
27
|
+
const {
|
|
28
|
+
route,
|
|
29
|
+
switchLink,
|
|
30
|
+
queryWorkspace,
|
|
31
|
+
pageAction,
|
|
32
|
+
clearPageAction,
|
|
33
|
+
currentPage,
|
|
34
|
+
} = useWorkspaceRoute()
|
|
35
|
+
const router = useDmsRouter()
|
|
36
|
+
|
|
37
|
+
/** What the bar says about the workspace shown, from the workspace list. */
|
|
38
|
+
const scope = computed(() => ({
|
|
39
|
+
locales: current.value?.locales ?? [],
|
|
40
|
+
totalKeys: current.value?.totalKeys ?? 0,
|
|
41
|
+
baseMissing: current.value?.baseMissing ?? 0,
|
|
42
|
+
defaultLocale: current.value?.defaultLocale ?? '',
|
|
43
|
+
}))
|
|
44
|
+
const links = useLangLinks()
|
|
45
|
+
const { nativeName } = useLocaleNames()
|
|
46
|
+
const { addLanguage } = useLanguageActions()
|
|
47
|
+
const { typeIcon, typeLabel, kindIcon } = useWorkspaceTypes()
|
|
48
|
+
|
|
49
|
+
function workspaceLabel(workspace: WorkspaceSummary | null): string {
|
|
50
|
+
if (!workspace) return ''
|
|
51
|
+
return t(`dms_lang.workspace_kinds.${workspace.kind}.label`, {
|
|
52
|
+
name: workspace.id,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function trailingIconOf(workspace: WorkspaceSummary): string | undefined {
|
|
57
|
+
if (workspace.id === current.value?.id) return CURRENT_ICON
|
|
58
|
+
return workspace.editable ? undefined : 'i-ph-lock-simple'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** What the workspace serves (its type), else its kind, and its languages. */
|
|
62
|
+
function workspaceDetail(workspace: WorkspaceSummary): string {
|
|
63
|
+
const count = workspace.locales.length
|
|
64
|
+
const kind = workspace.type
|
|
65
|
+
? typeLabel(workspace.type)
|
|
66
|
+
: t(`dms_lang.workspace_kinds.${workspace.kind}.kind`)
|
|
67
|
+
return t('dms_lang.scope.menu_detail', { kind, count }, count)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const switchItems = computed<DropdownMenuItem[]>(() => [
|
|
71
|
+
{ type: 'label', label: t('dms_lang.scope.switch') },
|
|
72
|
+
...workspaces.value.map((workspace) => ({
|
|
73
|
+
label: workspaceLabel(workspace),
|
|
74
|
+
description: workspaceDetail(workspace),
|
|
75
|
+
icon: workspace.type ? typeIcon(workspace.type) : kindIcon(workspace.kind),
|
|
76
|
+
slot: 'workspace' as const,
|
|
77
|
+
trailingIcon: trailingIconOf(workspace),
|
|
78
|
+
to: switchLink(workspace.id),
|
|
79
|
+
workspaceId: workspace.id,
|
|
80
|
+
summary: workspace.description ?? '',
|
|
81
|
+
})),
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
const menuFilter = computed(() =>
|
|
85
|
+
workspaces.value.length >= MENU_FILTER_THRESHOLD
|
|
86
|
+
? { placeholder: t('dms_lang.scope.filter') }
|
|
87
|
+
: false,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
const manageItems = computed<DropdownMenuItem[]>(() => [
|
|
91
|
+
...(current.value && currentPage.value !== 'workspace'
|
|
92
|
+
? [
|
|
93
|
+
{
|
|
94
|
+
label: t('dms_lang.scope.settings', {
|
|
95
|
+
name: workspaceLabel(current.value),
|
|
96
|
+
}),
|
|
97
|
+
icon: 'i-ph-sliders-horizontal',
|
|
98
|
+
to: links.workspaceSettings(),
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
: []),
|
|
102
|
+
{
|
|
103
|
+
label: t('dms_lang.scope.manage'),
|
|
104
|
+
icon: 'i-ph-gear-six',
|
|
105
|
+
to: links.workspaces(),
|
|
106
|
+
},
|
|
107
|
+
...(editable.value
|
|
108
|
+
? [
|
|
109
|
+
{
|
|
110
|
+
label: t('dms_lang.workspaces.new'),
|
|
111
|
+
icon: 'i-ph-plus',
|
|
112
|
+
to: links.workspaces({
|
|
113
|
+
[PAGE_ACTION_QUERY]: PAGE_ACTIONS.newWorkspace,
|
|
114
|
+
}),
|
|
115
|
+
},
|
|
116
|
+
]
|
|
117
|
+
: []),
|
|
118
|
+
])
|
|
119
|
+
|
|
120
|
+
const menuItems = computed(() => [switchItems.value, manageItems.value])
|
|
121
|
+
|
|
122
|
+
const hint = computed(() => {
|
|
123
|
+
if (isAdded.value) {
|
|
124
|
+
return t('dms_lang.scope.hint_added', {
|
|
125
|
+
url: links.publicLocaleUrl(current.value?.id ?? ''),
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return current.value
|
|
129
|
+
? t(`dms_lang.workspace_kinds.${current.value.kind}.hint`)
|
|
130
|
+
: ''
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
const showReadOnlyServer = computed(
|
|
134
|
+
() => isLoaded.value && !editable.value && !isModules.value,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
const baseMissingLink = computed(() => links.translations({ filter: 'issues' }))
|
|
138
|
+
|
|
139
|
+
const addKeyLink = computed(() =>
|
|
140
|
+
links.translations({ [PAGE_ACTION_QUERY]: PAGE_ACTIONS.addKey }),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
const hasNoKey = useFirstRun()
|
|
144
|
+
const isFirstRun = computed(
|
|
145
|
+
() => currentPage.value === 'overview' && hasNoKey.value,
|
|
146
|
+
)
|
|
147
|
+
const firstRunSteps = computed(() => [
|
|
148
|
+
{
|
|
149
|
+
id: 'created',
|
|
150
|
+
label: t('dms_lang.first_run.created', {
|
|
151
|
+
base: nativeName(scope.value.defaultLocale),
|
|
152
|
+
}),
|
|
153
|
+
state: 'ok' as const,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'keys',
|
|
157
|
+
label: t('dms_lang.first_run.keys'),
|
|
158
|
+
state: 'pending' as const,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'languages',
|
|
162
|
+
label: t('dms_lang.first_run.languages'),
|
|
163
|
+
state:
|
|
164
|
+
scope.value.locales.length > 1 ? ('ok' as const) : ('pending' as const),
|
|
165
|
+
},
|
|
166
|
+
])
|
|
167
|
+
const firstRunActions = computed(() => [
|
|
168
|
+
{
|
|
169
|
+
label: t('dms_lang.first_run.add_key'),
|
|
170
|
+
icon: 'i-ph-plus',
|
|
171
|
+
to: addKeyLink.value,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: t('dms_lang.first_run.add_language'),
|
|
175
|
+
color: 'neutral' as const,
|
|
176
|
+
variant: 'outline' as const,
|
|
177
|
+
onClick: () => void addLanguage(),
|
|
178
|
+
},
|
|
179
|
+
])
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The workspace a page opened without `?workspace=` was given: the one
|
|
183
|
+
* remembered, or the project files once that one turns out to be gone.
|
|
184
|
+
*/
|
|
185
|
+
const filledFromMemory = useDmsState<string>(
|
|
186
|
+
'dms-lang-workspace-filled',
|
|
187
|
+
() => '',
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
function fillWorkspace(workspace: string): void {
|
|
191
|
+
void router.replace(linkWithQuery(route.path, { ...route.query, workspace }))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
watch(
|
|
195
|
+
[queryWorkspace, pageAction],
|
|
196
|
+
([workspace, action]) => {
|
|
197
|
+
if (import.meta.env.SSR || workspace || action) return
|
|
198
|
+
const isKnown = workspaces.value.some(
|
|
199
|
+
(entry) => entry.id === selectedWorkspace.value,
|
|
200
|
+
)
|
|
201
|
+
const fallback =
|
|
202
|
+
isKnown || !isLoaded.value ? selectedWorkspace.value : DEFAULT_WORKSPACE
|
|
203
|
+
filledFromMemory.value = fallback
|
|
204
|
+
fillWorkspace(fallback)
|
|
205
|
+
},
|
|
206
|
+
{ immediate: true },
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
watch(
|
|
210
|
+
[isUnknown, queryWorkspace],
|
|
211
|
+
([unknown, workspace]) => {
|
|
212
|
+
if (import.meta.env.SSR || !unknown) return
|
|
213
|
+
if (!workspace || workspace !== filledFromMemory.value) return
|
|
214
|
+
filledFromMemory.value = ''
|
|
215
|
+
fillWorkspace(DEFAULT_WORKSPACE)
|
|
216
|
+
},
|
|
217
|
+
{ immediate: true },
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
watch(
|
|
221
|
+
[pageAction, isResolved],
|
|
222
|
+
async ([action, resolved]) => {
|
|
223
|
+
if (action !== PAGE_ACTIONS.addLanguage || !resolved) return
|
|
224
|
+
await clearPageAction()
|
|
225
|
+
await addLanguage()
|
|
226
|
+
},
|
|
227
|
+
{ immediate: true },
|
|
228
|
+
)
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<template>
|
|
232
|
+
<div v-if="!isUnknown" class="space-y-3">
|
|
233
|
+
<div
|
|
234
|
+
class="dms-card flex flex-wrap items-center gap-x-3.5 gap-y-2.5 py-2 pr-3.5 pl-2"
|
|
235
|
+
>
|
|
236
|
+
<UDropdownMenu
|
|
237
|
+
:items="menuItems"
|
|
238
|
+
:filter="menuFilter"
|
|
239
|
+
:filter-fields="MENU_FILTER_FIELDS"
|
|
240
|
+
:content="{ align: 'start' }"
|
|
241
|
+
:ui="{ content: 'w-80' }"
|
|
242
|
+
>
|
|
243
|
+
<template #workspace-description="{ item }">
|
|
244
|
+
<span
|
|
245
|
+
v-if="item.summary"
|
|
246
|
+
class="text-muted block truncate"
|
|
247
|
+
:title="item.summary"
|
|
248
|
+
>
|
|
249
|
+
{{ item.summary }}
|
|
250
|
+
</span>
|
|
251
|
+
<span class="block truncate">{{ item.description }}</span>
|
|
252
|
+
</template>
|
|
253
|
+
<template #workspace-trailing="{ item }">
|
|
254
|
+
<UIcon
|
|
255
|
+
v-if="item.trailingIcon"
|
|
256
|
+
:name="item.trailingIcon"
|
|
257
|
+
class="size-4 shrink-0"
|
|
258
|
+
:class="
|
|
259
|
+
item.trailingIcon === CURRENT_ICON
|
|
260
|
+
? 'text-primary'
|
|
261
|
+
: 'text-dimmed'
|
|
262
|
+
"
|
|
263
|
+
/>
|
|
264
|
+
</template>
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
class="hover:bg-elevated/60 hover:border-default flex h-11 items-center gap-2.5 rounded-md border border-transparent pr-2.5 pl-1.5 text-left transition-colors"
|
|
268
|
+
:aria-label="$t('dms_lang.scope.switch')"
|
|
269
|
+
>
|
|
270
|
+
<DmsIconWell
|
|
271
|
+
:icon="current ? kindIcon(current.kind) : 'i-ph-stack'"
|
|
272
|
+
:tone="!current ? 'neutral' : isEditable ? 'primary' : 'warning'"
|
|
273
|
+
size="sm"
|
|
274
|
+
/>
|
|
275
|
+
<span class="grid gap-px">
|
|
276
|
+
<DmsEyebrow :label="$t('dms_lang.scope.workspace')" size="xs" />
|
|
277
|
+
<USkeleton v-if="!current" class="h-4 w-24" />
|
|
278
|
+
<span
|
|
279
|
+
v-else
|
|
280
|
+
class="text-highlighted text-sm leading-tight font-semibold"
|
|
281
|
+
>
|
|
282
|
+
{{ workspaceLabel(current) }}
|
|
283
|
+
</span>
|
|
284
|
+
</span>
|
|
285
|
+
<UIcon name="i-ph-caret-up-down" class="text-dimmed ml-1 size-4" />
|
|
286
|
+
</button>
|
|
287
|
+
</UDropdownMenu>
|
|
288
|
+
|
|
289
|
+
<span class="bg-border hidden h-7 w-px sm:block" />
|
|
290
|
+
|
|
291
|
+
<div
|
|
292
|
+
v-if="!isResolved"
|
|
293
|
+
class="flex flex-wrap items-center gap-x-4 gap-y-1"
|
|
294
|
+
aria-busy="true"
|
|
295
|
+
>
|
|
296
|
+
<USkeleton class="h-5 w-20 rounded-full" />
|
|
297
|
+
<USkeleton class="h-4 w-24" />
|
|
298
|
+
<USkeleton class="h-4 w-16" />
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<div v-else class="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm">
|
|
302
|
+
<DmsStatusPill
|
|
303
|
+
dot="none"
|
|
304
|
+
:tone="isEditable ? 'success' : 'warning'"
|
|
305
|
+
:icon="isEditable ? 'i-ph-pencil-simple' : 'i-ph-lock-simple'"
|
|
306
|
+
:label="
|
|
307
|
+
isEditable
|
|
308
|
+
? $t('dms_lang.scope.editable')
|
|
309
|
+
: $t('dms_lang.scope.read_only')
|
|
310
|
+
"
|
|
311
|
+
size="sm"
|
|
312
|
+
/>
|
|
313
|
+
<span class="text-muted">
|
|
314
|
+
<b class="text-highlighted font-mono font-semibold">
|
|
315
|
+
{{ formatCount(scope.locales.length) }}
|
|
316
|
+
</b>
|
|
317
|
+
{{ $t('dms_lang.scope.languages', scope.locales.length) }}
|
|
318
|
+
</span>
|
|
319
|
+
<span class="text-muted">
|
|
320
|
+
<b class="text-highlighted font-mono font-semibold">
|
|
321
|
+
{{ formatCount(scope.totalKeys) }}
|
|
322
|
+
</b>
|
|
323
|
+
{{ $t('dms_lang.scope.keys', scope.totalKeys) }}
|
|
324
|
+
</span>
|
|
325
|
+
<ULink
|
|
326
|
+
v-if="scope.baseMissing"
|
|
327
|
+
:to="baseMissingLink"
|
|
328
|
+
class="text-warning inline-flex items-center gap-1 hover:underline"
|
|
329
|
+
>
|
|
330
|
+
<UIcon name="i-ph-warning" class="size-4" />
|
|
331
|
+
{{
|
|
332
|
+
$t(
|
|
333
|
+
'dms_lang.scope.base_missing',
|
|
334
|
+
{ n: formatCount(scope.baseMissing) },
|
|
335
|
+
scope.baseMissing,
|
|
336
|
+
)
|
|
337
|
+
}}
|
|
338
|
+
</ULink>
|
|
339
|
+
<span
|
|
340
|
+
v-if="scope.defaultLocale"
|
|
341
|
+
class="text-muted inline-flex items-center gap-1.5"
|
|
342
|
+
>
|
|
343
|
+
{{ $t('dms_lang.scope.base') }}
|
|
344
|
+
<LocaleTile :code="scope.defaultLocale" size="sm" />
|
|
345
|
+
<span class="font-mono text-xs">{{ scope.defaultLocale }}</span>
|
|
346
|
+
</span>
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<USkeleton v-if="!current" class="ml-auto h-3 w-40" />
|
|
350
|
+
<p
|
|
351
|
+
v-else
|
|
352
|
+
class="text-dimmed ml-auto min-w-0 truncate font-mono text-xs"
|
|
353
|
+
:title="hint"
|
|
354
|
+
>
|
|
355
|
+
{{ hint }}
|
|
356
|
+
</p>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<DmsBanner
|
|
360
|
+
v-if="showReadOnlyServer"
|
|
361
|
+
tone="warning"
|
|
362
|
+
size="sm"
|
|
363
|
+
icon="i-ph-lock-simple"
|
|
364
|
+
:title="$t('dms_lang.scope.server_read_only_title')"
|
|
365
|
+
:description="$t('dms_lang.scope.server_read_only_description')"
|
|
366
|
+
/>
|
|
367
|
+
|
|
368
|
+
<DmsCard v-if="isFirstRun" :padded="false">
|
|
369
|
+
<DmsEmptyState
|
|
370
|
+
icon="i-ph-rocket-launch"
|
|
371
|
+
tone="primary"
|
|
372
|
+
size="lg"
|
|
373
|
+
:title="$t('dms_lang.first_run.title', { name: current?.id })"
|
|
374
|
+
:description="$t('dms_lang.first_run.description')"
|
|
375
|
+
:actions="firstRunActions"
|
|
376
|
+
>
|
|
377
|
+
<template #content>
|
|
378
|
+
<DmsCheckList size="sm" :items="firstRunSteps" />
|
|
379
|
+
</template>
|
|
380
|
+
</DmsEmptyState>
|
|
381
|
+
</DmsCard>
|
|
382
|
+
</div>
|
|
383
|
+
</template>
|
|
384
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the workspace shown is an added one without any key yet: the
|
|
3
|
+
* overview then shows its first steps instead of figures and a heatmap.
|
|
4
|
+
*/
|
|
5
|
+
export const useFirstRun = () => {
|
|
6
|
+
const { current, isAdded } = useWorkspaceContext()
|
|
7
|
+
return computed(() => isAdded.value && current.value?.totalKeys === 0)
|
|
8
|
+
}
|