@antelopejs/dms-lang 0.4.1 → 0.5.1

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.
Files changed (91) hide show
  1. package/README.md +30 -25
  2. package/dist/pages/workspace.js +1 -4
  3. package/dist/pages/workspace.js.map +1 -1
  4. package/dist/routes/publicLocales.d.ts +1 -1
  5. package/dist/routes/publicLocales.js +1 -1
  6. package/dist/routes/publicLocales.js.map +1 -1
  7. package/dist/routes/translations.d.ts +1 -1
  8. package/dist/utils/announce.js +2 -1
  9. package/dist/utils/announce.js.map +1 -1
  10. package/dist/utils/body.js +5 -1
  11. package/dist/utils/body.js.map +1 -1
  12. package/dist/utils/cache.d.ts +1 -1
  13. package/dist/utils/cache.js +11 -9
  14. package/dist/utils/cache.js.map +1 -1
  15. package/dist/utils/catalog.d.ts +2 -1
  16. package/dist/utils/catalog.js +6 -2
  17. package/dist/utils/catalog.js.map +1 -1
  18. package/dist/utils/errors.d.ts +7 -4
  19. package/dist/utils/errors.js +3 -1
  20. package/dist/utils/errors.js.map +1 -1
  21. package/dist/utils/export.d.ts +2 -1
  22. package/dist/utils/export.js +10 -11
  23. package/dist/utils/export.js.map +1 -1
  24. package/dist/utils/guards.d.ts +3 -0
  25. package/dist/utils/guards.js +15 -0
  26. package/dist/utils/guards.js.map +1 -0
  27. package/dist/utils/json.d.ts +16 -10
  28. package/dist/utils/json.js +60 -27
  29. package/dist/utils/json.js.map +1 -1
  30. package/dist/utils/keys.d.ts +3 -2
  31. package/dist/utils/keys.js +6 -4
  32. package/dist/utils/keys.js.map +1 -1
  33. package/dist/utils/message-check.d.ts +2 -1
  34. package/dist/utils/message-check.js +11 -9
  35. package/dist/utils/message-check.js.map +1 -1
  36. package/dist/utils/message-syntax.d.ts +2 -2
  37. package/dist/utils/public-url.d.ts +1 -0
  38. package/dist/utils/public-url.js +8 -8
  39. package/dist/utils/public-url.js.map +1 -1
  40. package/dist/utils/registry.js +2 -1
  41. package/dist/utils/registry.js.map +1 -1
  42. package/dist/utils/resolve.js +12 -4
  43. package/dist/utils/resolve.js.map +1 -1
  44. package/dist/utils/review.js +2 -1
  45. package/dist/utils/review.js.map +1 -1
  46. package/dist/utils/snippets.js +2 -2
  47. package/dist/utils/snippets.js.map +1 -1
  48. package/dist/utils/tree.d.ts +7 -6
  49. package/dist/utils/tree.js +13 -7
  50. package/dist/utils/tree.js.map +1 -1
  51. package/dist/utils/workspaces.d.ts +2 -1
  52. package/dist/utils/workspaces.js +35 -9
  53. package/dist/utils/workspaces.js.map +1 -1
  54. package/dist/utils/write-target.d.ts +2 -1
  55. package/dist/utils/write-target.js +2 -2
  56. package/dist/utils/write-target.js.map +1 -1
  57. package/dist/utils/zod-json.d.ts +3 -0
  58. package/dist/utils/zod-json.js +21 -0
  59. package/dist/utils/zod-json.js.map +1 -0
  60. package/dist/validation/validate.js +3 -4
  61. package/dist/validation/validate.js.map +1 -1
  62. package/dist/validation/workspace.schema.d.ts +8 -7
  63. package/dist/validation/workspace.schema.js +5 -1
  64. package/dist/validation/workspace.schema.js.map +1 -1
  65. package/frontend-vue/app/build/components/KeyEditorDrawer.vue +28 -264
  66. package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +1 -4
  67. package/frontend-vue/app/build/composables/useCellSaves.ts +12 -16
  68. package/frontend-vue/app/build/composables/useMatrixExport.ts +97 -0
  69. package/frontend-vue/app/build/composables/useQueueSave.ts +8 -3
  70. package/frontend-vue/app/build/composables/useQueueToasts.ts +7 -4
  71. package/frontend-vue/app/build/drawer/KeyLanguageField.vue +308 -0
  72. package/frontend-vue/app/build/drawer/fieldStatus.ts +11 -0
  73. package/frontend-vue/app/build/matrix/MatrixDoneBanner.vue +36 -0
  74. package/frontend-vue/app/build/matrix/MatrixFooter.vue +61 -0
  75. package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +52 -0
  76. package/frontend-vue/app/build/matrix/MatrixNoRows.vue +68 -0
  77. package/frontend-vue/app/components/LanguageNamespaces.vue +1 -1
  78. package/frontend-vue/app/components/NamespaceCoverage.vue +1 -1
  79. package/frontend-vue/app/components/TranslationMatrix.vue +40 -225
  80. package/frontend-vue/app/components/WorkspaceList.vue +1 -1
  81. package/frontend-vue/app/composables/translation/useMutationToast.ts +9 -12
  82. package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +8 -4
  83. package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +1 -1
  84. package/frontend-vue/app/utils/coverage.ts +139 -0
  85. package/frontend-vue/app/utils/translations.ts +1 -133
  86. package/frontend-vue/build/backend-boundary.ts +122 -0
  87. package/frontend-vue/dms.frontend.build.ts +3 -0
  88. package/frontend-vue/package.json +5 -5
  89. package/package.json +32 -16
  90. package/skills/dms-lang/SKILL.md +1 -1
  91. package/skills/dms-lang/cases.json +47 -0
@@ -14,20 +14,18 @@ import {
14
14
  } from '../composables/useKeySaves'
15
15
  import {
16
16
  checkMessage,
17
- escapeMessage,
18
17
  formatTokens,
19
18
  hasBlockingIssue,
20
19
  isLocaleValueMissing,
21
20
  messageIssueText,
22
21
  NAMESPACE_SEPARATOR,
23
22
  placeholdersOf,
24
- replacePlaceholder,
25
23
  stringValue,
26
24
  type MessageIssue,
27
25
  } from '../../utils/translations'
28
- import LocaleTile from './LocaleTile.vue'
29
- import PlaceholderText from './PlaceholderText.vue'
30
26
  import ShortcutKbds from './ShortcutKbds.vue'
27
+ import type { FieldStatus } from '../drawer/fieldStatus'
28
+ import KeyLanguageField from '../drawer/KeyLanguageField.vue'
31
29
  import { KEY_PANEL_KEYS } from '../../utils/shortcuts'
32
30
 
33
31
  interface Props {
@@ -70,17 +68,6 @@ interface KnownInherited {
70
68
  inherited: FlatTranslationRow['inherited']
71
69
  }
72
70
 
73
- type FieldStatus = 'missing' | 'inherited' | 'overridden' | 'outdated' | 'done'
74
-
75
- const BASE_MISSING_LABEL = 'dms_lang.matrix.source_missing'
76
- const FIELD_STATUS_LABELS: Record<FieldStatus, string> = {
77
- missing: 'dms_lang.matrix.missing',
78
- inherited: 'dms_lang.drawer.inherited',
79
- overridden: 'dms_lang.drawer.overridden',
80
- outdated: 'dms_lang.drawer.outdated',
81
- done: '',
82
- }
83
-
84
71
  const props = withDefaults(defineProps<Props>(), {
85
72
  seed: undefined,
86
73
  focusLocale: undefined,
@@ -565,256 +552,33 @@ onMounted(() => show(key.value))
565
552
  :data-locale="code"
566
553
  class="space-y-1.5"
567
554
  >
568
- <div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
569
- <LocaleTile :code="code" size="sm" :is-base="code === base" />
570
- <label
571
- v-if="props.editable"
572
- :for="fieldIdOf(code)"
573
- class="text-highlighted font-medium"
574
- >
575
- {{ nativeName(code) }}
576
- </label>
577
- <span v-else class="text-highlighted font-medium">
578
- {{ nativeName(code) }}
579
- </span>
580
- <span class="text-dimmed font-mono text-xs">{{ code }}</span>
581
- <DmsStatusPill
582
- v-if="code === base"
583
- dot="none"
584
- tone="neutral"
585
- size="sm"
586
- :label="$t('dms_lang.common.base')"
587
- />
588
- <span class="ml-auto inline-flex items-center gap-1.5 text-xs">
589
- <span
590
- v-if="hasConflict(code)"
591
- class="text-error inline-flex items-center gap-1 font-medium"
592
- >
593
- <UIcon name="i-ph-warning" class="size-3.5" />
594
- {{ $t('dms_lang.drawer.conflict') }}
595
- </span>
596
- <template v-else-if="saveStateOf(code) !== 'idle'">
597
- <DmsSaveStatus
598
- :state="saveStateOf(code)"
599
- @retry="save([code])"
600
- />
601
- <UButton
602
- v-if="saveStateOf(code) === 'error'"
603
- size="xs"
604
- color="neutral"
605
- variant="link"
606
- :label="$t('dms_lang.drawer.discard')"
607
- @click="discardDraft(code)"
608
- />
609
- </template>
610
- <span
611
- v-else-if="statusOf(code) === 'missing'"
612
- class="text-warning font-mono font-semibold uppercase"
613
- >
614
- {{
615
- $t(
616
- code === base
617
- ? BASE_MISSING_LABEL
618
- : FIELD_STATUS_LABELS.missing,
619
- )
620
- }}
621
- </span>
622
- <template v-else-if="statusOf(code) !== 'done'">
623
- <span
624
- :class="
625
- statusOf(code) === 'outdated'
626
- ? 'text-warning font-medium'
627
- : 'text-dimmed'
628
- "
629
- >
630
- {{ $t(FIELD_STATUS_LABELS[statusOf(code)]) }}
631
- </span>
632
- <UButton
633
- v-if="statusOf(code) === 'overridden' && props.editable"
634
- size="xs"
635
- color="neutral"
636
- variant="link"
637
- :label="$t('dms_lang.drawer.use_module')"
638
- @click="(setDraft(code, ''), save([code]))"
639
- />
640
- <UButton
641
- v-else-if="statusOf(code) === 'outdated' && props.editable"
642
- size="xs"
643
- color="neutral"
644
- variant="link"
645
- icon="i-ph-check"
646
- :label="$t('dms_lang.drawer.mark_reviewed')"
647
- @click="markReviewed(code)"
648
- />
649
- </template>
650
- <UIcon
651
- v-else-if="code !== base && !issuesOf(code).length"
652
- name="i-ph-check"
653
- class="text-success size-4"
654
- />
655
- </span>
656
- </div>
657
- <UTextarea
658
- v-if="props.editable"
659
- :id="fieldIdOf(code)"
660
- :model-value="draftOf(code)"
661
- autoresize
662
- :rows="1"
663
- :maxrows="10"
664
- class="w-full"
665
- :color="issuesOf(code).length ? 'error' : undefined"
666
- :highlight="issuesOf(code).length > 0"
667
- @update:model-value="(value: string) => setDraft(code, value)"
668
- @blur="onFieldBlur(code)"
669
- @keydown.meta.enter.prevent="saveAndNext"
670
- @keydown.ctrl.enter.prevent="saveAndNext"
555
+ <KeyLanguageField
556
+ :code="code"
557
+ :base="base"
558
+ :base-text="baseText"
559
+ :row="row"
560
+ :field-errors="fieldErrors"
561
+ :editable="props.editable"
562
+ :t="t"
563
+ :native-name="nativeName"
564
+ :field-id-of="fieldIdOf"
565
+ :has-conflict="hasConflict"
566
+ :save-state-of="saveStateOf"
567
+ :status-of="statusOf"
568
+ :issues-of="issuesOf"
569
+ :issue-of-kind="issueOfKind"
570
+ :draft-of="draftOf"
571
+ :own-of="ownOf"
572
+ :save="save"
573
+ :set-draft="setDraft"
574
+ :discard-draft="discardDraft"
575
+ :overwrite="overwrite"
576
+ :mark-reviewed="markReviewed"
577
+ :insert-at-caret="insertAtCaret"
578
+ :rewrite="rewrite"
579
+ :on-field-blur="onFieldBlur"
580
+ :save-and-next="saveAndNext"
671
581
  />
672
- <div
673
- v-else
674
- class="border-default rounded-md border bg-(--dms-bg-muted) px-3 py-2 text-sm"
675
- >
676
- <PlaceholderText v-if="draftOf(code)" :text="draftOf(code)" />
677
- <span v-else class="text-dimmed">—</span>
678
- <p
679
- v-if="row.overrides?.[code]"
680
- class="text-dimmed border-default mt-2 border-t pt-2 text-xs"
681
- >
682
- {{ $t('dms_lang.drawer.project_value') }}
683
- <PlaceholderText
684
- :text="row.overrides[code]"
685
- class="text-default"
686
- />
687
- </p>
688
- </div>
689
- <div
690
- v-if="hasConflict(code)"
691
- class="border-error/40 space-y-1.5 rounded-md border px-3 py-2 text-xs"
692
- >
693
- <p class="text-dimmed">
694
- <template v-if="ownOf(code)">
695
- {{ $t('dms_lang.drawer.conflict_value') }}
696
- <PlaceholderText :text="ownOf(code)" class="text-default" />
697
- </template>
698
- <template v-else>
699
- {{ $t('dms_lang.drawer.conflict_empty') }}
700
- </template>
701
- </p>
702
- <p class="text-dimmed">{{ $t('dms_lang.drawer.conflict_help') }}</p>
703
- <div class="flex flex-wrap gap-1.5">
704
- <UButton
705
- size="xs"
706
- color="error"
707
- variant="soft"
708
- :label="$t('dms_lang.drawer.overwrite')"
709
- @mousedown.prevent
710
- @click="overwrite(code)"
711
- />
712
- <UButton
713
- size="xs"
714
- color="neutral"
715
- variant="outline"
716
- :label="$t('dms_lang.drawer.discard')"
717
- @mousedown.prevent
718
- @click="discardDraft(code)"
719
- />
720
- </div>
721
- </div>
722
- <p v-else-if="fieldErrors[code]" class="text-error text-xs">
723
- {{ fieldErrors[code] }}
724
- </p>
725
- <div
726
- v-if="props.editable && issuesOf(code).length"
727
- class="space-y-1 text-xs"
728
- >
729
- <div
730
- v-for="issue in issuesOf(code)"
731
- :key="issue.kind"
732
- class="flex flex-wrap items-center gap-x-3 gap-y-1"
733
- >
734
- <span
735
- :class="
736
- issue.severity === 'error' ? 'text-error' : 'text-warning'
737
- "
738
- >
739
- {{ messageIssueText(issue, t) }}
740
- <template v-if="issue.kind === 'missing'">
741
- {{
742
- $t(
743
- 'dms_lang.drawer.issue_help',
744
- { tokens: formatTokens(issue.tokens) },
745
- issue.count,
746
- )
747
- }}
748
- </template>
749
- </span>
750
- <template v-if="issue.kind === 'missing'">
751
- <UButton
752
- v-for="token in issue.tokens"
753
- :key="token"
754
- size="xs"
755
- color="error"
756
- variant="soft"
757
- :label="
758
- $t('dms_lang.drawer.insert', {
759
- token: formatTokens([token]),
760
- })
761
- "
762
- @mousedown.prevent
763
- @click="insertAtCaret(code, formatTokens([token]))"
764
- />
765
- <UButton
766
- v-if="
767
- issue.tokens.length === 1 &&
768
- issueOfKind(code, 'extra')?.tokens.length === 1
769
- "
770
- size="xs"
771
- color="error"
772
- variant="soft"
773
- :label="
774
- $t('dms_lang.message_issue.replace', {
775
- token: formatTokens(issue.tokens),
776
- })
777
- "
778
- @mousedown.prevent
779
- @click="
780
- rewrite(
781
- code,
782
- replacePlaceholder(
783
- draftOf(code),
784
- issueOfKind(code, 'extra')?.tokens[0] ?? '',
785
- issue.tokens[0],
786
- ),
787
- )
788
- "
789
- />
790
- </template>
791
- <UButton
792
- v-else-if="
793
- issue.severity === 'error' &&
794
- escapeMessage(draftOf(code)) !== draftOf(code)
795
- "
796
- size="xs"
797
- color="error"
798
- variant="soft"
799
- icon="i-ph-magic-wand"
800
- :label="$t('dms_lang.message_issue.escape')"
801
- @mousedown.prevent
802
- @click="rewrite(code, escapeMessage(draftOf(code)))"
803
- />
804
- </div>
805
- </div>
806
- <p
807
- v-else-if="
808
- props.editable &&
809
- code !== base &&
810
- baseText &&
811
- statusOf(code) === 'missing'
812
- "
813
- class="text-dimmed text-xs"
814
- >
815
- {{ $t('dms_lang.drawer.reference') }}
816
- <PlaceholderText :text="baseText" />
817
- </p>
818
582
  </div>
819
583
  </div>
820
584
  <!-- The DMS footer: at the drawer's bottom edge under a short key,
@@ -1,10 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { LanguageCoverage } from '../../../types/lang'
3
3
  import LocaleTile from '../LocaleTile.vue'
4
- import {
5
- COVERAGE_TEXT_CLASSES,
6
- coverageTone,
7
- } from '../../../utils/translations'
4
+ import { COVERAGE_TEXT_CLASSES, coverageTone } from '../../../utils/coverage'
8
5
 
9
6
  interface Props {
10
7
  languages: LanguageCoverage[]
@@ -118,7 +118,7 @@ function recordFailure(
118
118
  })
119
119
  context.states.setState(id, 'error')
120
120
  if (outcome.failure.kind === 'deleted') context.saves.dropRow(address)
121
- if (isConflict) context.report.conflict(address, outcome.message)
121
+ if (isConflict) context.report.conflict(address, outcome.error)
122
122
  else context.report.failure(address, outcome.error)
123
123
  }
124
124
 
@@ -160,34 +160,30 @@ function useCellReports(
160
160
  retry: (address: CellAddress) => void,
161
161
  discard: (address: CellAddress) => void,
162
162
  ) {
163
- const { t } = useI18n()
164
- const toast = useToast()
163
+ const { presentError } = useApiErrorPresenter()
165
164
  const { reportFailure } = useMutationToast()
166
165
 
167
166
  return {
168
- conflict(address: CellAddress, message: string) {
169
- toast.add({
170
- title: t('dms_lang.matrix.conflict', { ...address }),
171
- description: message,
172
- color: 'error',
173
- icon: 'i-ph-warning-circle',
167
+ conflict(address: CellAddress, error: unknown) {
168
+ presentError(error, {
169
+ fallbackKey: 'dms_lang.matrix.conflict',
170
+ params: { ...address },
174
171
  actions: [
175
172
  {
176
- label: t('dms_lang.matrix.discard'),
177
- color: 'neutral',
178
- variant: 'outline',
179
- onClick: () => discard(address),
173
+ labelKey: 'dms_lang.matrix.discard',
174
+ onSelect: () => discard(address),
180
175
  },
181
176
  {
182
- label: t('dms_lang.matrix.overwrite'),
183
- onClick: () => retry(address),
177
+ labelKey: 'dms_lang.matrix.overwrite',
178
+ onSelect: () => retry(address),
184
179
  },
185
180
  ],
186
181
  })
187
182
  },
188
183
  failure(address: CellAddress, error: unknown, canRetry = true) {
189
184
  reportFailure(error, {
190
- title: t('dms_lang.matrix.save_failed', { ...address }),
185
+ fallbackKey: 'dms_lang.matrix.save_failed',
186
+ params: { ...address },
191
187
  retry: canRetry ? () => retry(address) : undefined,
192
188
  })
193
189
  },
@@ -0,0 +1,97 @@
1
+ import type { Ref } from 'vue'
2
+ import UButton from '@nuxt/ui/components/Button.vue'
3
+ import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
4
+ import type { FlatTranslationRow, FlatTranslations } from '../../types/lang'
5
+ import { exportFileName, translationsCsv } from '../../utils/matrixExport'
6
+
7
+ interface MatrixExportOptions {
8
+ t: ReturnType<typeof useI18n>['t']
9
+ formatCount: (value: number) => string
10
+ flat: Readonly<Ref<FlatTranslations>>
11
+ rows: Readonly<Ref<FlatTranslationRow[]>>
12
+ columnCodes: Readonly<Ref<string[]>>
13
+ order: Readonly<Ref<string[]>>
14
+ selectedWorkspace: Readonly<Ref<string>>
15
+ isLoaded: Readonly<Ref<boolean>>
16
+ }
17
+
18
+ /**
19
+ * The export menu of the matrix in the page header: the keys and languages
20
+ * the matrix shows, or the whole workspace, as a CSV file.
21
+ */
22
+ export function useMatrixExport({
23
+ t,
24
+ formatCount,
25
+ flat,
26
+ rows,
27
+ columnCodes,
28
+ order,
29
+ selectedWorkspace,
30
+ isLoaded,
31
+ }: MatrixExportOptions) {
32
+ function exportCsv(isView: boolean) {
33
+ const base = flat.value.defaultLocale
34
+ const ordered = isView
35
+ ? columnCodes.value
36
+ : [...new Set([...order.value, ...flat.value.locales])].filter((code) =>
37
+ flat.value.locales.includes(code),
38
+ )
39
+ const locales = [base, ...ordered.filter((code) => code !== base)]
40
+ const content = translationsCsv(
41
+ isView ? rows.value : flat.value.rows,
42
+ locales,
43
+ )
44
+ downloadText(
45
+ exportFileName(selectedWorkspace.value, isView ? locales : undefined),
46
+ content,
47
+ 'text/csv;charset=utf-8',
48
+ )
49
+ }
50
+
51
+ function keysLabel(count: number): string {
52
+ return t('dms_lang.matrix.group_keys', { count: formatCount(count) }, count)
53
+ }
54
+
55
+ function languagesLabel(count: number): string {
56
+ return t('dms_lang.matrix.languages_counted', { count }, count)
57
+ }
58
+
59
+ usePageHeaderActions(
60
+ () => [
61
+ h(
62
+ UDropdownMenu,
63
+ {
64
+ items: [
65
+ {
66
+ label: t('dms_lang.matrix.export_view', {
67
+ keys: keysLabel(rows.value.length),
68
+ languages: languagesLabel(columnCodes.value.length),
69
+ }),
70
+ icon: 'i-ph-funnel',
71
+ onSelect: () => exportCsv(true),
72
+ },
73
+ {
74
+ label: t('dms_lang.matrix.export_all', {
75
+ keys: keysLabel(flat.value.rows.length),
76
+ languages: languagesLabel(flat.value.locales.length),
77
+ }),
78
+ icon: 'i-ph-table',
79
+ onSelect: () => exportCsv(false),
80
+ },
81
+ ],
82
+ content: { align: 'end' },
83
+ },
84
+ () =>
85
+ h(UButton, {
86
+ label: t('dms_lang.matrix.export'),
87
+ icon: 'i-ph-download-simple',
88
+ trailingIcon: 'i-ph-caret-down',
89
+ color: 'neutral',
90
+ variant: 'outline',
91
+ disabled: !isLoaded.value,
92
+ }),
93
+ ),
94
+ ],
95
+ { order: -1 },
96
+ )
97
+ }
@@ -81,15 +81,20 @@ function onInvalid(
81
81
  }
82
82
 
83
83
  const SAVE_FAILURES: Record<KeySaveFailureKind, SaveFailureHandler> = {
84
- conflict: (context, write) => context.toasts.warnConflict(write.row.key),
84
+ conflict: (context, write, outcome) =>
85
+ context.failures.reportFailure(outcome.error, {
86
+ fallbackKey: 'dms_lang.queue.conflict_description',
87
+ params: { key: write.row.key },
88
+ }),
85
89
  deleted: (context, write) => onDeleted(context, write.row),
86
90
  invalid: onInvalid,
87
91
  other: (context, write, outcome) =>
88
92
  context.failures.reportFailure(outcome.error, {
89
- title: context.t('dms_lang.matrix.save_failed', {
93
+ fallbackKey: 'dms_lang.matrix.save_failed',
94
+ params: {
90
95
  key: write.row.key,
91
96
  code: context.session.locale.value,
92
- }),
97
+ },
93
98
  retry: () => void send(context, write),
94
99
  }),
95
100
  }
@@ -14,10 +14,13 @@ const STEP_TOASTS: Partial<Record<QueueStep, string>> = {
14
14
  }
15
15
 
16
16
  async function copyText({ t, toast }: ToastContext, value: string) {
17
- try {
18
- await navigator.clipboard.writeText(value)
17
+ const copied = await navigator.clipboard.writeText(value).then(
18
+ () => true,
19
+ () => false,
20
+ )
21
+ if (copied) {
19
22
  toast.add({ title: t('dms_lang.queue.copied'), color: 'success' })
20
- } catch {
23
+ } else {
21
24
  toast.add({
22
25
  title: t('dms_lang.queue.copy_failed'),
23
26
  description: value,
@@ -68,7 +71,7 @@ function showStep({ t, toast }: ToastContext, step: QueueStep | undefined) {
68
71
  function warnBlocked({ t, toast }: ToastContext) {
69
72
  toast.add({
70
73
  title: t('dms_lang.queue.blocked'),
71
- color: 'error',
74
+ color: 'warning',
72
75
  icon: 'i-ph-warning-circle',
73
76
  })
74
77
  }