create-expo-updates-server 0.3.0 → 0.6.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.
Files changed (191) hide show
  1. package/README.md +4 -2
  2. package/dist/template/Dockerfile +4 -6
  3. package/dist/template/README.md +5 -10
  4. package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
  5. package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
  6. package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
  7. package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
  8. package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
  9. package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
  10. package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
  11. package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
  12. package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
  13. package/dist/template/app/api/admin/updates/route.test.ts +21 -0
  14. package/dist/template/app/api/admin/updates/route.ts +12 -1
  15. package/dist/template/app/globals.css +65 -68
  16. package/dist/template/app/login/page.tsx +66 -42
  17. package/dist/template/app/updates/[encodedKey]/page.tsx +382 -248
  18. package/dist/template/app/updates/devices/page.tsx +187 -145
  19. package/dist/template/app/updates/embedded/page.tsx +80 -34
  20. package/dist/template/app/updates/emergency-redirects/page.tsx +138 -71
  21. package/dist/template/app/updates/layout.tsx +2 -1
  22. package/dist/template/app/updates/page.tsx +385 -274
  23. package/dist/template/app/updates/releases.test.tsx +156 -0
  24. package/dist/template/components/admin/admin-role.ts +5 -0
  25. package/dist/template/components/admin/admin-shell.tsx +166 -95
  26. package/dist/template/components/admin/confirm-action.tsx +123 -0
  27. package/dist/template/components/admin/language-switcher.tsx +27 -16
  28. package/dist/template/components/admin/release-badges.test.tsx +50 -0
  29. package/dist/template/components/admin/release-badges.tsx +101 -0
  30. package/dist/template/components/ui/alert.tsx +10 -3
  31. package/dist/template/components/ui/avatar.tsx +108 -0
  32. package/dist/template/components/ui/badge.tsx +2 -2
  33. package/dist/template/components/ui/breadcrumb.tsx +108 -0
  34. package/dist/template/components/ui/button.tsx +5 -5
  35. package/dist/template/components/ui/card.tsx +2 -2
  36. package/dist/template/components/ui/chart.tsx +1 -1
  37. package/dist/template/components/ui/collapsible.tsx +7 -0
  38. package/dist/template/components/ui/dialog.tsx +13 -4
  39. package/dist/template/components/ui/empty.tsx +103 -0
  40. package/dist/template/components/ui/field.tsx +248 -0
  41. package/dist/template/components/ui/input-group.tsx +170 -0
  42. package/dist/template/components/ui/input.tsx +1 -1
  43. package/dist/template/components/ui/native-select.tsx +1 -1
  44. package/dist/template/components/ui/radio-group.tsx +41 -0
  45. package/dist/template/components/ui/sheet.tsx +6 -2
  46. package/dist/template/components/ui/sidebar.tsx +62 -17
  47. package/dist/template/components/ui/status-tones.ts +15 -0
  48. package/dist/template/components/ui/table.tsx +1 -1
  49. package/dist/template/components/ui/textarea.tsx +1 -1
  50. package/dist/template/docs/admin-ui.md +22 -24
  51. package/dist/template/docs/device-targeting.md +6 -12
  52. package/dist/template/docs/doctor.md +2 -2
  53. package/dist/template/docs/expo-app-setup.md +9 -27
  54. package/dist/template/docs/getting-started.md +3 -4
  55. package/dist/template/docs/getting-started.ru.md +11 -544
  56. package/dist/template/docs/index.md +1 -1
  57. package/dist/template/docs/installation-telemetry.md +6 -12
  58. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
  59. package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
  60. package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
  61. package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
  62. package/dist/template/docs/migrations/schema.sql +349 -0
  63. package/dist/template/docs/npm-installer.md +3 -3
  64. package/dist/template/docs/operations-guide.md +9 -7
  65. package/dist/template/docs/ota-client-lifecycle.md +30 -68
  66. package/dist/template/docs/ota-emergency-recovery.md +34 -57
  67. package/dist/template/docs/ota-update-policy.md +9 -20
  68. package/dist/template/docs/ru/admin-ui.md +33 -0
  69. package/dist/template/docs/ru/device-targeting.md +59 -0
  70. package/dist/template/docs/ru/doctor.md +98 -0
  71. package/dist/template/docs/ru/expo-app-setup.md +497 -0
  72. package/dist/template/docs/ru/getting-started.md +391 -0
  73. package/dist/template/docs/ru/index.md +50 -0
  74. package/dist/template/docs/ru/installation-telemetry.md +125 -0
  75. package/dist/template/docs/ru/npm-installer.md +71 -0
  76. package/dist/template/docs/ru/operations-guide.md +322 -0
  77. package/dist/template/docs/ru/ota-client-lifecycle.md +162 -0
  78. package/dist/template/docs/ru/ota-emergency-recovery.md +108 -0
  79. package/dist/template/docs/ru/ota-update-policy.md +69 -0
  80. package/dist/template/docs/ru/publishing-npm-installer.md +49 -0
  81. package/dist/template/docs/ru/supabase-setup.md +120 -0
  82. package/dist/template/docs/uk/admin-ui.md +33 -0
  83. package/dist/template/docs/uk/device-targeting.md +59 -0
  84. package/dist/template/docs/uk/doctor.md +98 -0
  85. package/dist/template/docs/uk/expo-app-setup.md +497 -0
  86. package/dist/template/docs/uk/getting-started.md +391 -0
  87. package/dist/template/docs/uk/index.md +50 -0
  88. package/dist/template/docs/uk/installation-telemetry.md +125 -0
  89. package/dist/template/docs/uk/npm-installer.md +71 -0
  90. package/dist/template/docs/uk/operations-guide.md +322 -0
  91. package/dist/template/docs/uk/ota-client-lifecycle.md +162 -0
  92. package/dist/template/docs/uk/ota-emergency-recovery.md +108 -0
  93. package/dist/template/docs/uk/ota-update-policy.md +69 -0
  94. package/dist/template/docs/uk/publishing-npm-installer.md +49 -0
  95. package/dist/template/docs/uk/supabase-setup.md +120 -0
  96. package/dist/template/lib/audience-ids.ts +4 -0
  97. package/dist/template/package-lock.json +46 -0
  98. package/dist/template/package.json +4 -1
  99. package/dist/template/scripts/configure-expo-app.mjs +3 -3
  100. package/dist/template/scripts/create-access-token.mjs +1 -1
  101. package/dist/template/scripts/lib/doctor.mjs +10 -7
  102. package/dist/template/scripts/lib/doctor.test.mjs +7 -5
  103. package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
  104. package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
  105. package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
  106. package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
  107. package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
  108. package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
  109. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
  110. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
  111. package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
  112. package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
  113. package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
  114. package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
  115. package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
  116. package/dist/template/scripts/tests/e2e/console.mjs +86 -0
  117. package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
  118. package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
  119. package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
  120. package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
  121. package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
  122. package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
  123. package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
  124. package/dist/template/scripts/tests/e2e/run.mjs +224 -0
  125. package/dist/template/scripts/tests/manifest-identity.sql +7 -5
  126. package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
  127. package/dist/template/src/client/admin-api.ts +45 -10
  128. package/dist/template/src/client/admin-types.ts +35 -1
  129. package/dist/template/src/client/devices/analytics.tsx +169 -219
  130. package/dist/template/src/client/devices/cohorts.tsx +181 -0
  131. package/dist/template/src/client/devices/device-name.tsx +37 -21
  132. package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
  133. package/dist/template/src/client/devices/registry.tsx +265 -233
  134. package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
  135. package/dist/template/src/client/devices/use-devices-report.ts +53 -82
  136. package/dist/template/src/client/devices/version-adoption-chart.tsx +48 -38
  137. package/dist/template/src/client/distribution-control.tsx +98 -53
  138. package/dist/template/src/client/distribution-history.tsx +353 -0
  139. package/dist/template/src/client/guard-action-catalog.tsx +183 -0
  140. package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
  141. package/dist/template/src/client/guard-action-combobox.tsx +134 -234
  142. package/dist/template/src/client/guard-action-options.ts +4 -6
  143. package/dist/template/src/client/i18n/en.json +335 -2
  144. package/dist/template/src/client/i18n/language-switching.test.tsx +233 -0
  145. package/dist/template/src/client/i18n/messages.test.ts +102 -19
  146. package/dist/template/src/client/i18n/messages.ts +31 -16
  147. package/dist/template/src/client/i18n/provider.tsx +6 -3
  148. package/dist/template/src/client/i18n/ru.json +619 -0
  149. package/dist/template/src/client/i18n/uk.json +619 -0
  150. package/dist/template/src/client/i18n/use-formatters.ts +5 -0
  151. package/dist/template/src/client/logout-button.tsx +3 -3
  152. package/dist/template/src/client/policy-draft.ts +138 -0
  153. package/dist/template/src/client/update-audience-editor.tsx +597 -199
  154. package/dist/template/src/client/update-policy-editor.test.ts +101 -29
  155. package/dist/template/src/client/update-policy-editor.tsx +466 -307
  156. package/dist/template/src/client/use-filtered-results.ts +55 -0
  157. package/dist/template/src/server/controllers/manifest.test.ts +23 -3
  158. package/dist/template/src/server/controllers/manifest.ts +15 -1
  159. package/dist/template/src/server/devices/audience.ts +9 -5
  160. package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
  161. package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
  162. package/dist/template/src/server/lib/admin-updates.ts +160 -534
  163. package/dist/template/src/server/lib/distribution-history.ts +97 -0
  164. package/dist/template/src/server/lib/supabase.js +24 -0
  165. package/dist/template/src/server/lib/supabase.test.ts +38 -1
  166. package/dist/template/src/server/lib/update-policy.test.ts +20 -0
  167. package/dist/template/src/server/lib/update-policy.ts +23 -10
  168. package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
  169. package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
  170. package/dist/template/src/server/manifest/manifest-values.ts +21 -13
  171. package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
  172. package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
  173. package/dist/template/tsconfig.json +2 -2
  174. package/dist/template-manifest.json +571 -271
  175. package/package.json +1 -1
  176. package/dist/template/scripts/lib/device-identity.test.ts +0 -29
  177. package/dist/template/scripts/lib/ota-client.test.ts +0 -55
  178. package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
  179. package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
  180. package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
  181. package/dist/template/templates/expo-app/ota-client/README.md +0 -73
  182. package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
  183. package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
  184. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
  185. package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
  186. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
  187. package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
  188. package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
  189. package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
  190. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
  191. package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
@@ -1,4 +1,11 @@
1
1
  "use client";
2
+ import { Siren, Trash2 } from "lucide-react";
3
+ import { ChannelBadge, PlatformBadge } from "@/components/admin/release-badges";
4
+ import { statusTones } from "@/components/ui/status-tones";
5
+ import { Alert, AlertDescription } from "@/components/ui/alert";
6
+ import { Switch } from "@/components/ui/switch";
7
+ import { useConfirmAction } from "@/components/admin/confirm-action";
8
+ import type { TranslationMessage } from "@/src/client/i18n/messages";
2
9
  import { useI18n } from "@/src/client/i18n/provider";
3
10
 
4
11
  import { NativeSelect } from "@/components/ui/native-select";
@@ -42,15 +49,17 @@ const EMPTY_FORM: EmergencyRedirectInput = {
42
49
  };
43
50
 
44
51
  export default function EmergencyRedirectsPage() {
52
+ const confirmAction = useConfirmAction();
45
53
  const { t } = useI18n();
46
54
  const [items, setItems] = useState<EmergencyRedirectItem[]>([]);
47
55
  const [form, setForm] = useState<EmergencyRedirectInput>(EMPTY_FORM);
56
+ const [showEditor, setShowEditor] = useState(false);
48
57
  const [editingId, setEditingId] = useState<string | null>(null);
49
58
  const [canWrite, setCanWrite] = useState(false);
50
59
  const [loading, setLoading] = useState(true);
51
60
  const [saving, setSaving] = useState(false);
52
61
  const [error, setError] = useState("");
53
- const [success, setSuccess] = useState("");
62
+ const [success, setSuccess] = useState<TranslationMessage>("");
54
63
 
55
64
  const load = useCallback(async () => {
56
65
  setLoading(true);
@@ -79,6 +88,7 @@ export default function EmergencyRedirectsPage() {
79
88
  const resetForm = () => {
80
89
  setEditingId(null);
81
90
  setForm(EMPTY_FORM);
91
+ setShowEditor(false);
82
92
  };
83
93
 
84
94
  const handleSubmit = async (event: FormEvent) => {
@@ -95,10 +105,10 @@ export default function EmergencyRedirectsPage() {
95
105
 
96
106
  if (editingId) {
97
107
  await updateEmergencyRedirect(editingId, payload);
98
- setSuccess(t("Emergency redirect обновлён"));
108
+ setSuccess("Emergency redirect обновлён");
99
109
  } else {
100
110
  await createEmergencyRedirect(payload);
101
- setSuccess(t("Emergency redirect создан"));
111
+ setSuccess("Emergency redirect создан");
102
112
  }
103
113
 
104
114
  resetForm();
@@ -115,6 +125,7 @@ export default function EmergencyRedirectsPage() {
115
125
 
116
126
  const edit = (item: EmergencyRedirectItem) => {
117
127
  setEditingId(item.id);
128
+ setShowEditor(true);
118
129
  setForm({
119
130
  name: item.name,
120
131
  enabled: item.enabled,
@@ -134,7 +145,7 @@ export default function EmergencyRedirectsPage() {
134
145
  setSuccess("");
135
146
  try {
136
147
  await updateEmergencyRedirect(item.id, { enabled: !item.enabled });
137
- setSuccess(item.enabled ? t("Redirect отключён") : t("Redirect включён"));
148
+ setSuccess(item.enabled ? "Redirect отключён" : "Redirect включён");
138
149
  await load();
139
150
  } catch (toggleError: unknown) {
140
151
  setError((toggleError as Error).message || "Не удалось изменить статус");
@@ -142,7 +153,13 @@ export default function EmergencyRedirectsPage() {
142
153
  };
143
154
 
144
155
  const remove = async (item: EmergencyRedirectItem) => {
145
- if (!window.confirm(t('Удалить emergency redirect "{0}"?', [item.name]))) {
156
+ if (
157
+ !(await confirmAction(
158
+ t("Удалить"),
159
+ t('Удалить emergency redirect "{0}"?', [item.name]),
160
+ true,
161
+ ))
162
+ ) {
146
163
  return;
147
164
  }
148
165
 
@@ -150,7 +167,7 @@ export default function EmergencyRedirectsPage() {
150
167
  setSuccess("");
151
168
  try {
152
169
  await deleteEmergencyRedirect(item.id);
153
- setSuccess(t("Emergency redirect удалён"));
170
+ setSuccess("Emergency redirect удалён");
154
171
  if (editingId === item.id) {
155
172
  resetForm();
156
173
  }
@@ -165,8 +182,13 @@ export default function EmergencyRedirectsPage() {
165
182
  <div className="space-y-6">
166
183
  <header className="flex flex-wrap items-start justify-between gap-4">
167
184
  <div className="space-y-1">
168
- <h1 className="text-2xl font-semibold tracking-tight">
169
- Emergency redirects
185
+ <h1 className="flex items-center gap-2 text-2xl font-semibold tracking-tight">
186
+ <span
187
+ className={`inline-flex rounded-md border p-1.5 ${statusTones.destructive}`}
188
+ >
189
+ <Siren aria-hidden="true" className="size-5" />
190
+ </span>
191
+ {t("Emergency redirects")}
170
192
  </h1>
171
193
  <p className="text-sm text-muted-foreground">
172
194
  {t(
@@ -174,23 +196,36 @@ export default function EmergencyRedirectsPage() {
174
196
  )}
175
197
  </p>
176
198
  </div>
177
- <Badge variant="secondary" className="px-3 py-1">
178
- {items.length} {t(" правил")}
179
- </Badge>
199
+ <div className="flex items-center gap-3">
200
+ {canWrite && !showEditor && (
201
+ <Button
202
+ size="sm"
203
+ onClick={() => {
204
+ setError("");
205
+ setShowEditor(true);
206
+ }}
207
+ >
208
+ {t("Новое правило")}
209
+ </Button>
210
+ )}
211
+ <Badge variant="info" className="px-3 py-1">
212
+ {t("Rules: {0}", [items.length])}
213
+ </Badge>
214
+ </div>
180
215
  </header>
181
216
 
182
217
  {error ? (
183
- <div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300">
184
- {t(error)}
185
- </div>
218
+ <Alert variant="destructive">
219
+ <AlertDescription>{t(error)}</AlertDescription>
220
+ </Alert>
186
221
  ) : null}
187
222
  {success ? (
188
- <div className="rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300">
189
- {success}
190
- </div>
223
+ <Alert role="status">
224
+ <AlertDescription>{t(success)}</AlertDescription>
225
+ </Alert>
191
226
  ) : null}
192
227
 
193
- {canWrite ? (
228
+ {canWrite && showEditor ? (
194
229
  <form
195
230
  onSubmit={handleSubmit}
196
231
  className="space-y-4 rounded-xl border border-border bg-card p-5 "
@@ -199,33 +234,34 @@ export default function EmergencyRedirectsPage() {
199
234
  <h2 className="font-semibold">
200
235
  {editingId ? t("Редактирование правила") : t("Новое правило")}
201
236
  </h2>
202
- {editingId ? (
203
- <Button
204
- variant="outline"
205
- size="sm"
206
- type="button"
207
- onClick={resetForm}
208
- >
209
- {t("Отменить")}
210
- </Button>
211
- ) : null}
237
+ <Button
238
+ variant="outline"
239
+ size="sm"
240
+ type="button"
241
+ onClick={resetForm}
242
+ >
243
+ {t("Отменить")}
244
+ </Button>
212
245
  </div>
213
246
 
214
- <div className="grid gap-3 md:grid-cols-2 lg:grid-cols-4">
247
+ <fieldset className="grid gap-3 md:grid-cols-2 lg:grid-cols-3">
248
+ <legend className="mb-3 text-sm font-medium">
249
+ {t("Matching build")}
250
+ </legend>
215
251
  <Input
216
252
  label={t("Название")}
217
253
  value={form.name}
218
254
  onChange={(value) => setForm({ ...form, name: value })}
219
255
  />
220
256
  <Input
221
- label="Runtime version"
257
+ label={t("Runtime version")}
222
258
  value={form.runtimeVersion}
223
259
  onChange={(value) =>
224
260
  setForm({ ...form, runtimeVersion: value })
225
261
  }
226
262
  />
227
263
  <label className="space-y-1 text-sm">
228
- <span>Platform</span>
264
+ <span>{t("Platform")}</span>
229
265
  <NativeSelect
230
266
  value={form.platform}
231
267
  onChange={(event) =>
@@ -241,24 +277,29 @@ export default function EmergencyRedirectsPage() {
241
277
  </NativeSelect>
242
278
  </label>
243
279
  <Input
244
- label="Embedded update ID"
280
+ label={t("Embedded update ID")}
245
281
  value={form.embeddedUpdateId}
246
282
  onChange={(value) =>
247
283
  setForm({ ...form, embeddedUpdateId: value })
248
284
  }
249
285
  />
250
286
  <Input
251
- label="From channel"
287
+ label={t("From channel")}
252
288
  value={form.fromChannel}
253
289
  onChange={(value) => setForm({ ...form, fromChannel: value })}
254
290
  />
291
+ </fieldset>
292
+ <fieldset className="grid gap-3 border-t pt-3 md:grid-cols-3">
293
+ <legend className="pr-2 text-sm font-medium">
294
+ {t("Destination release")}
295
+ </legend>
255
296
  <Input
256
- label="To channel"
297
+ label={t("To channel")}
257
298
  value={form.toChannel}
258
299
  onChange={(value) => setForm({ ...form, toChannel: value })}
259
300
  />
260
301
  <label className="space-y-1 text-sm">
261
- <span>Target mode</span>
302
+ <span>{t("Target mode")}</span>
262
303
  <NativeSelect
263
304
  value={form.targetMode}
264
305
  onChange={(event) =>
@@ -269,15 +310,15 @@ export default function EmergencyRedirectsPage() {
269
310
  }
270
311
  className="w-full rounded-md border border-input bg-background px-3 py-2 "
271
312
  >
272
- <option value="pinned">Pinned update</option>
273
- <option value="follow">Follow channel</option>
313
+ <option value="pinned">{t("Pinned update")}</option>
314
+ <option value="follow">{t("Follow channel")}</option>
274
315
  </NativeSelect>
275
316
  </label>
276
317
  <Input
277
318
  label={
278
319
  form.targetMode === "pinned"
279
- ? "Expected update ID"
280
- : "Expected update ID (optional)"
320
+ ? t("Expected update ID")
321
+ : t("Expected update ID (optional)")
281
322
  }
282
323
  value={form.expectedUpdateId || ""}
283
324
  required={form.targetMode === "pinned"}
@@ -285,21 +326,26 @@ export default function EmergencyRedirectsPage() {
285
326
  setForm({ ...form, expectedUpdateId: value || null })
286
327
  }
287
328
  />
288
- </div>
329
+ </fieldset>
289
330
 
290
- <label className="flex items-center gap-2 text-sm">
291
- <input
292
- className="size-4 rounded border-input accent-primary"
293
- type="checkbox"
331
+ <label
332
+ className={`flex items-center gap-3 rounded-md border p-3 text-sm ${form.enabled ? statusTones.warning : "bg-muted/25"}`}
333
+ >
334
+ <Switch
294
335
  checked={form.enabled}
295
- onChange={(event) =>
296
- setForm({ ...form, enabled: event.target.checked })
336
+ onCheckedChange={(checked) =>
337
+ setForm({ ...form, enabled: checked })
297
338
  }
298
339
  />
299
340
  {t("Включить правило сразу после сохранения")}
300
341
  </label>
301
342
 
302
- <Button variant="default" size="sm" type="submit" disabled={saving}>
343
+ <Button
344
+ variant={form.enabled ? "destructive" : "default"}
345
+ size="sm"
346
+ type="submit"
347
+ disabled={saving}
348
+ >
303
349
  {saving
304
350
  ? t("Сохранение...")
305
351
  : editingId
@@ -314,17 +360,27 @@ export default function EmergencyRedirectsPage() {
314
360
  <Table className="min-w-full text-sm">
315
361
  <TableHeader className="bg-muted/40">
316
362
  <TableRow>
317
- <TableHead className="px-4 py-3 text-left">Status</TableHead>
318
- <TableHead className="px-4 py-3 text-left">Name</TableHead>
319
- <TableHead className="px-4 py-3 text-left">Scope</TableHead>
320
363
  <TableHead className="px-4 py-3 text-left">
321
- Redirect
364
+ {t("Status")}
365
+ </TableHead>
366
+ <TableHead className="px-4 py-3 text-left">
367
+ {t("Name")}
368
+ </TableHead>
369
+ <TableHead className="px-4 py-3 text-left">
370
+ {t("Scope")}
322
371
  </TableHead>
323
- <TableHead className="px-4 py-3 text-left">Target</TableHead>
324
372
  <TableHead className="px-4 py-3 text-left">
325
- Embedded ID
373
+ {t("Redirect")}
374
+ </TableHead>
375
+ <TableHead className="px-4 py-3 text-left">
376
+ {t("Target")}
377
+ </TableHead>
378
+ <TableHead className="px-4 py-3 text-left">
379
+ {t("Embedded ID")}
380
+ </TableHead>
381
+ <TableHead className="px-4 py-3 text-left">
382
+ {t("Actions")}
326
383
  </TableHead>
327
- <TableHead className="px-4 py-3 text-left">Actions</TableHead>
328
384
  </TableRow>
329
385
  </TableHeader>
330
386
  <TableBody>
@@ -355,26 +411,34 @@ export default function EmergencyRedirectsPage() {
355
411
  className="border-t border-border "
356
412
  >
357
413
  <TableCell className="px-4 py-3">
358
- <Badge
359
- variant="secondary"
360
- className={
361
- item.enabled
362
- ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
363
- : ""
364
- }
365
- >
366
- {item.enabled ? "Enabled" : "Disabled"}
414
+ <Badge variant={item.enabled ? "warning" : "neutral"}>
415
+ {item.enabled ? t("Enabled") : t("Disabled")}
367
416
  </Badge>
368
417
  </TableCell>
369
418
  <TableCell className="px-4 py-3">{item.name}</TableCell>
370
419
  <TableCell className="px-4 py-3">
371
- {item.runtimeVersion} / {item.platform}
420
+ <div className="flex flex-wrap items-center gap-1.5">
421
+ <PlatformBadge platform={item.platform} />
422
+ <span>{item.runtimeVersion}</span>
423
+ </div>
372
424
  </TableCell>
373
425
  <TableCell className="px-4 py-3">
374
- {item.fromChannel} → {item.toChannel}
426
+ <div className="flex max-w-72 flex-wrap items-center gap-1">
427
+ <ChannelBadge channel={item.fromChannel} />
428
+ <span>→</span>
429
+ <ChannelBadge channel={item.toChannel} />
430
+ </div>
375
431
  </TableCell>
376
432
  <TableCell className="px-4 py-3">
377
- <Badge variant="outline">{item.targetMode}</Badge>
433
+ <Badge
434
+ variant={
435
+ item.targetMode === "pinned" ? "violet" : "info"
436
+ }
437
+ >
438
+ {item.targetMode === "pinned"
439
+ ? t("Pinned update")
440
+ : t("Follow channel")}
441
+ </Badge>
378
442
  {item.expectedUpdateId ? (
379
443
  <div
380
444
  title={item.expectedUpdateId}
@@ -401,15 +465,17 @@ export default function EmergencyRedirectsPage() {
401
465
  type="button"
402
466
  onClick={() => edit(item)}
403
467
  >
404
- Edit
468
+ {t("Edit")}
405
469
  </Button>
406
470
  <Button
407
- variant="outline"
471
+ variant={
472
+ item.enabled ? "outline" : "destructive"
473
+ }
408
474
  size="sm"
409
475
  type="button"
410
476
  onClick={() => void toggle(item)}
411
477
  >
412
- {item.enabled ? "Disable" : "Enable"}
478
+ {item.enabled ? t("Disable") : t("Enable")}
413
479
  </Button>
414
480
  <Button
415
481
  variant="destructive"
@@ -417,12 +483,13 @@ export default function EmergencyRedirectsPage() {
417
483
  type="button"
418
484
  onClick={() => void remove(item)}
419
485
  >
420
- Delete
486
+ <Trash2 aria-hidden="true" />
487
+ {t("Delete")}
421
488
  </Button>
422
489
  </div>
423
490
  ) : (
424
491
  <span className="text-xs text-muted-foreground">
425
- Read only
492
+ {t("Read only")}
426
493
  </span>
427
494
  )}
428
495
  </TableCell>
@@ -1,3 +1,4 @@
1
+ import { ConfirmActionProvider } from "@/components/admin/confirm-action";
1
2
  import { getAdminSessionFromServerCookies } from "@/src/server/lib/admin-auth";
2
3
  import { AdminShell } from "@/components/admin/admin-shell";
3
4
  import { redirect } from "next/navigation";
@@ -13,7 +14,7 @@ export default async function UpdatesLayout({
13
14
 
14
15
  return (
15
16
  <AdminShell session={{ username: session.username, role: session.role }}>
16
- {children}
17
+ <ConfirmActionProvider>{children}</ConfirmActionProvider>
17
18
  </AdminShell>
18
19
  );
19
20
  }