This repository was archived by the owner on Jul 1, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheffectivePathsSyncProgressLabel.ts
More file actions
49 lines (43 loc) · 1.34 KB
/
Copy patheffectivePathsSyncProgressLabel.ts
File metadata and controls
49 lines (43 loc) · 1.34 KB
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
import type { EffectivePathsImportTarget } from './effectivePathsImportDialogSupport'
import type { StringId } from '../i18n'
export type EffectivePathsSyncProgress = {
direction: 'import' | 'export'
completed: number
total: number
currentWorkbookName: string
}
type Translate = (id: StringId) => string
export const EFFECTIVE_PATHS_SYNC_TARGET_DISPLAY_NAMES: Record<
EffectivePathsImportTarget,
string
> = {
labs: 'Laboratory',
workshop: 'Workshop',
uws: 'Ultimate Weapons',
cards: 'Cards',
modules: 'Modules',
bots: 'Bots',
guardians: 'Guardians',
themes: 'Themes & Songs',
relics: 'Relics',
}
export function syncWorkbookNameForTarget(
target: EffectivePathsImportTarget,
linkedName: string | null | undefined,
): string {
return linkedName?.trim() || EFFECTIVE_PATHS_SYNC_TARGET_DISPLAY_NAMES[target]
}
export function effectivePathsSyncProgressLabel(
progress: EffectivePathsSyncProgress,
t: Translate,
): string {
const key: StringId =
progress.direction === 'import'
? 'ep_import_syncing_workbook_named'
: 'ep_export_syncing_workbook_named'
return t(key).replace('{{name}}', progress.currentWorkbookName)
}
export function effectivePathsSyncProgressPercent(progress: EffectivePathsSyncProgress): number {
if (progress.total <= 0) return 0
return (progress.completed / progress.total) * 100
}