create-expo-updates-server 0.1.5 → 0.2.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 (141) hide show
  1. package/dist/template/.dockerignore +16 -0
  2. package/dist/template/README.md +51 -660
  3. package/dist/template/app/api/admin/device-targets/route.test.ts +43 -0
  4. package/dist/template/app/api/admin/device-targets/route.ts +91 -0
  5. package/dist/template/app/api/admin/devices/route.test.ts +41 -0
  6. package/dist/template/app/api/admin/devices/route.ts +15 -0
  7. package/dist/template/app/api/admin/updates/[encodedKey]/audience/route.ts +75 -0
  8. package/dist/template/app/api/device-heartbeat/route.ts +2 -0
  9. package/dist/template/app/globals.css +114 -15
  10. package/dist/template/app/layout.tsx +12 -4
  11. package/dist/template/app/login/page.tsx +22 -18
  12. package/dist/template/app/updates/[encodedKey]/page.tsx +112 -88
  13. package/dist/template/app/updates/devices/page.tsx +264 -0
  14. package/dist/template/app/updates/embedded/page.tsx +102 -68
  15. package/dist/template/app/updates/emergency-redirects/page.tsx +144 -111
  16. package/dist/template/app/updates/layout.tsx +6 -1
  17. package/dist/template/app/updates/page.tsx +262 -212
  18. package/dist/template/components/admin/admin-shell.tsx +196 -0
  19. package/dist/template/components/admin/language-switcher.tsx +25 -0
  20. package/dist/template/components/admin/theme-provider.tsx +15 -0
  21. package/dist/template/components/ui/alert.tsx +65 -0
  22. package/dist/template/components/ui/badge.tsx +47 -0
  23. package/dist/template/components/ui/button.tsx +63 -0
  24. package/dist/template/components/ui/card.tsx +91 -0
  25. package/dist/template/components/ui/chart.tsx +373 -0
  26. package/dist/template/components/ui/checkbox.tsx +31 -0
  27. package/dist/template/components/ui/dialog.tsx +158 -0
  28. package/dist/template/components/ui/dropdown-menu.tsx +256 -0
  29. package/dist/template/components/ui/input.tsx +20 -0
  30. package/dist/template/components/ui/label.tsx +23 -0
  31. package/dist/template/components/ui/native-select.tsx +61 -0
  32. package/dist/template/components/ui/popover.tsx +88 -0
  33. package/dist/template/components/ui/scroll-area.tsx +57 -0
  34. package/dist/template/components/ui/select.tsx +189 -0
  35. package/dist/template/components/ui/separator.tsx +27 -0
  36. package/dist/template/components/ui/sheet.tsx +142 -0
  37. package/dist/template/components/ui/sidebar.tsx +736 -0
  38. package/dist/template/components/ui/skeleton.tsx +13 -0
  39. package/dist/template/components/ui/switch.tsx +34 -0
  40. package/dist/template/components/ui/table.tsx +115 -0
  41. package/dist/template/components/ui/tabs.tsx +90 -0
  42. package/dist/template/components/ui/textarea.tsx +17 -0
  43. package/dist/template/components/ui/tooltip.tsx +56 -0
  44. package/dist/template/components.json +22 -0
  45. package/dist/template/docs/admin-ui.md +35 -0
  46. package/dist/template/docs/device-targeting.md +129 -0
  47. package/dist/template/docs/doctor.md +137 -0
  48. package/dist/template/docs/expo-app-setup.md +174 -47
  49. package/dist/template/docs/getting-started.md +105 -146
  50. package/dist/template/docs/getting-started.ru.md +106 -191
  51. package/dist/template/docs/index.md +14 -33
  52. package/dist/template/docs/installation-telemetry.md +233 -0
  53. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +89 -0
  54. package/dist/template/docs/migrations/2026-10-19-device-heartbeat.sql +131 -0
  55. package/dist/template/docs/migrations/2026-10-22-device-analytics.sql +264 -0
  56. package/dist/template/docs/migrations/2026-10-22-device-targeting-activation.sql +108 -0
  57. package/dist/template/docs/migrations/2026-10-22-device-targeting.sql +130 -0
  58. package/dist/template/docs/migrations/2026-10-22-device-version-metadata.sql +154 -0
  59. package/dist/template/docs/migrations/schema.sql +868 -6
  60. package/dist/template/docs/npm-installer.md +15 -30
  61. package/dist/template/docs/operations-guide.md +87 -0
  62. package/dist/template/docs/ota-client-lifecycle.md +263 -0
  63. package/dist/template/docs/ota-update-policy.md +36 -2
  64. package/dist/template/docs/supabase-setup.md +4 -0
  65. package/dist/template/hooks/use-mobile.ts +21 -0
  66. package/dist/template/lib/utils.ts +6 -0
  67. package/dist/template/package-lock.json +2325 -101
  68. package/dist/template/package.json +13 -3
  69. package/dist/template/scripts/configure-expo-app.mjs +11 -15
  70. package/dist/template/scripts/doctor.mjs +51 -0
  71. package/dist/template/scripts/ensure-test-bucket.mjs +21 -0
  72. package/dist/template/scripts/lib/device-identity.test.ts +29 -0
  73. package/dist/template/scripts/lib/doctor-probes.mjs +139 -0
  74. package/dist/template/scripts/lib/doctor.mjs +208 -0
  75. package/dist/template/scripts/lib/doctor.test.mjs +262 -0
  76. package/dist/template/scripts/lib/expo-app-configurator.mjs +14 -9
  77. package/dist/template/scripts/lib/expo-app-configurator.test.ts +3 -2
  78. package/dist/template/scripts/lib/ota-client-configurator.mjs +69 -0
  79. package/dist/template/scripts/lib/ota-client-configurator.test.ts +88 -0
  80. package/dist/template/scripts/lib/ota-client.test.ts +55 -0
  81. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +173 -0
  82. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +123 -0
  83. package/dist/template/scripts/lib/ota-update-controller.test.ts +231 -0
  84. package/dist/template/scripts/tests/device-analytics-migrations.mjs +80 -0
  85. package/dist/template/scripts/tests/device-analytics.mjs +126 -0
  86. package/dist/template/scripts/tests/device-heartbeat.mjs +86 -0
  87. package/dist/template/scripts/tests/device-targeting-activation.mjs +111 -0
  88. package/dist/template/scripts/tests/device-targeting.mjs +39 -0
  89. package/dist/template/scripts/tests/device-version-metadata.mjs +31 -0
  90. package/dist/template/scripts/tests/manifest-identity-concurrency.mjs +106 -0
  91. package/dist/template/scripts/tests/manifest-identity.sql +204 -0
  92. package/dist/template/src/client/admin-types.ts +1 -0
  93. package/dist/template/src/client/devices/analytics.tsx +429 -0
  94. package/dist/template/src/client/devices/device-name.tsx +82 -0
  95. package/dist/template/src/client/devices/registry.tsx +399 -0
  96. package/dist/template/src/client/devices/use-devices-report.ts +108 -0
  97. package/dist/template/src/client/devices/version-adoption-chart.tsx +269 -0
  98. package/dist/template/src/client/devices/version-groups.test.ts +57 -0
  99. package/dist/template/src/client/devices/version-groups.ts +101 -0
  100. package/dist/template/src/client/distribution-control.tsx +135 -81
  101. package/dist/template/src/client/guard-action-combobox.tsx +13 -24
  102. package/dist/template/src/client/i18n/en.json +286 -0
  103. package/dist/template/src/client/i18n/messages.test.ts +42 -0
  104. package/dist/template/src/client/i18n/messages.ts +31 -0
  105. package/dist/template/src/client/i18n/provider.tsx +55 -0
  106. package/dist/template/src/client/i18n/use-formatters.ts +38 -0
  107. package/dist/template/src/client/logout-button.tsx +3 -1
  108. package/dist/template/src/client/update-audience-editor.tsx +285 -0
  109. package/dist/template/src/client/update-policy-editor.tsx +53 -41
  110. package/dist/template/src/server/controllers/manifest.test.ts +250 -7
  111. package/dist/template/src/server/controllers/manifest.ts +39 -31
  112. package/dist/template/src/server/devices/audience.test.ts +48 -0
  113. package/dist/template/src/server/devices/audience.ts +86 -0
  114. package/dist/template/src/server/devices/heartbeat.test.ts +39 -0
  115. package/dist/template/src/server/devices/heartbeat.ts +75 -0
  116. package/dist/template/src/server/devices/report-types.ts +114 -0
  117. package/dist/template/src/server/devices/report.test.ts +29 -0
  118. package/dist/template/src/server/devices/report.ts +27 -0
  119. package/dist/template/src/server/lib/admin-audience-activation.test.ts +94 -0
  120. package/dist/template/src/server/lib/admin-updates.ts +32 -168
  121. package/dist/template/src/server/lib/distribution-control.test.ts +23 -2
  122. package/dist/template/src/server/lib/distribution-control.ts +13 -4
  123. package/dist/template/src/server/lib/supabase.js +10 -10
  124. package/dist/template/src/server/lib/supabase.test.ts +11 -0
  125. package/dist/template/src/server/manifest/manifest-identity.test.ts +30 -0
  126. package/dist/template/src/server/manifest/manifest-identity.ts +24 -0
  127. package/dist/template/src/server/manifest/manifest-repository.ts +31 -102
  128. package/dist/template/src/server/manifest/manifest-response.ts +1 -1
  129. package/dist/template/templates/expo-app/ota-client/README.md +59 -0
  130. package/dist/template/templates/expo-app/ota-client/controller.js +60 -0
  131. package/dist/template/templates/expo-app/ota-client/device-identity.js +26 -0
  132. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +52 -0
  133. package/dist/template/templates/expo-app/ota-client/index.d.ts +47 -0
  134. package/dist/template/templates/expo-app/ota-client/index.js +3 -0
  135. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +48 -0
  136. package/dist/template/templates/expo-app/ota-client/model/update-controller.js +182 -0
  137. package/dist/template/templates/expo-app/ota-client/runtime.js +112 -0
  138. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +56 -0
  139. package/dist/template-manifest.json +582 -77
  140. package/lib/cli.mjs +4 -6
  141. package/package.json +1 -1
@@ -1,10 +1,32 @@
1
1
  "use client";
2
+ import { useI18n } from "@/src/client/i18n/provider";
3
+
4
+ import { NativeSelect } from "@/components/ui/native-select";
2
5
 
3
6
  import { getUpdates } from "@/src/client/admin-api";
4
7
  import { UpdateItem } from "@/src/client/admin-types";
5
- import LogoutButton from "@/src/client/logout-button";
6
8
  import DistributionControl from "@/src/client/distribution-control";
7
9
  import Link from "next/link";
10
+ import { Button } from "@/components/ui/button";
11
+ import { Badge } from "@/components/ui/badge";
12
+ import { Card } from "@/components/ui/card";
13
+ import {
14
+ Table,
15
+ TableHeader,
16
+ TableBody,
17
+ TableRow,
18
+ TableHead,
19
+ TableCell,
20
+ } from "@/components/ui/table";
21
+ import {
22
+ ArrowDownUp,
23
+ ArrowRight,
24
+ ChevronLeft,
25
+ ChevronRight,
26
+ RefreshCw,
27
+ Package,
28
+ ShieldAlert,
29
+ } from "lucide-react";
8
30
  import { useCallback, useEffect, useState } from "react";
9
31
 
10
32
  const PAGE_SIZE = 20;
@@ -19,6 +41,7 @@ type SortBy =
19
41
  | "updateId";
20
42
 
21
43
  export default function UpdatesPage() {
44
+ const { t, formatLocale } = useI18n();
22
45
  const [items, setItems] = useState<UpdateItem[]>([]);
23
46
  const [rollbackScopes, setRollbackScopes] = useState<
24
47
  Array<{
@@ -71,236 +94,263 @@ export default function UpdatesPage() {
71
94
  }, [loadUpdates]);
72
95
 
73
96
  return (
74
- <main className="min-h-screen bg-zinc-50 p-4 dark:bg-zinc-950 md:p-8">
75
- <div className="mx-auto max-w-7xl space-y-4">
76
- <header className="flex flex-col gap-3 rounded-xl border border-zinc-200 bg-white p-4 dark:border-zinc-800 dark:bg-zinc-900 md:flex-row md:items-center md:justify-between">
97
+ <div className="mx-auto max-w-[1600px] space-y-6 p-4 md:p-8">
98
+ <header className="flex flex-wrap items-start justify-between gap-4">
99
+ <div className="space-y-1">
100
+ <h1 className="text-2xl font-semibold tracking-tight">OTA Updates</h1>
101
+ <p className="text-sm text-muted-foreground">
102
+ {t("Публикации, версии и управление доставкой обновлений.")}
103
+ </p>
104
+ </div>
105
+ <Button
106
+ variant="outline"
107
+ onClick={() => void loadUpdates()}
108
+ disabled={loading}
109
+ >
110
+ <RefreshCw className={loading ? "animate-spin" : ""} />{" "}
111
+ {t(" Обновить")}
112
+ </Button>
113
+ </header>
114
+
115
+ <DistributionControl />
116
+
117
+ {error && (
118
+ <div
119
+ role="alert"
120
+ className="rounded-lg border border-destructive/25 bg-destructive/5 p-4 text-sm text-destructive"
121
+ >
122
+ {t(error)}
123
+ </div>
124
+ )}
125
+ {hasRollbackActive && (
126
+ <div className="flex gap-3 rounded-lg border border-amber-500/25 bg-amber-500/5 p-4 text-sm">
127
+ <ShieldAlert className="mt-0.5 size-4 shrink-0 text-amber-600" />
77
128
  <div>
78
- <h1 className="text-xl font-semibold">OTA Updates</h1>
79
- <p className="text-sm text-zinc-600 dark:text-zinc-400">
80
- Всего апдейтов: {total}
129
+ <p className="font-medium">{t("Rollback активен")}</p>
130
+ <p className="mt-1 text-muted-foreground">
131
+ {t("Автодоставка новых обновлений временно отключена.")}
132
+ {hasIgnoredUpdates
133
+ ? t(" Новые публикации в этих scope помечены как ignored.")
134
+ : ""}
81
135
  </p>
82
136
  </div>
137
+ </div>
138
+ )}
139
+ {lockedScopes.length > 0 && (
140
+ <p className="text-xs text-muted-foreground">
141
+ Rollback lock:{" "}
142
+ {lockedScopes
143
+ .map(
144
+ (scope) =>
145
+ `${scope.runtimeVersion} / ${scope.platform} / ${scope.channel}`,
146
+ )
147
+ .join("; ")}
148
+ </p>
149
+ )}
150
+
151
+ <Card className="gap-0 overflow-hidden py-0 shadow-none">
152
+ <div className="flex flex-wrap items-center justify-between gap-4 border-b p-4">
83
153
  <div className="flex items-center gap-2">
84
- <Link
85
- href="/updates/emergency-redirects"
86
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
87
- >
88
- Emergency
89
- </Link>
90
- <Link
91
- href="/updates/embedded"
92
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
93
- >
94
- Embedded
95
- </Link>
96
- <label className="text-sm">Сортировка</label>
97
- <select
154
+ <Package className="size-4 text-muted-foreground" />
155
+ <h2 className="text-sm font-semibold">{t("Публикации")}</h2>
156
+ <Badge variant="secondary">{total}</Badge>
157
+ </div>
158
+ <div className="flex items-center gap-2">
159
+ <NativeSelect
98
160
  value={sortBy}
99
161
  onChange={(event) => {
100
162
  setSortBy(event.target.value as SortBy);
101
163
  setPage(1);
102
164
  }}
103
- aria-label="Сортировка списка апдейтов"
104
- className="rounded-md border border-zinc-300 bg-transparent px-2 py-2 text-sm dark:border-zinc-700"
165
+ aria-label={t("Сортировка списка апдейтов")}
166
+ className="h-9 rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
105
167
  >
106
- <option value="createdAt">Дата</option>
107
- <option value="runtimeVersion">Runtime</option>
108
- <option value="platform">Платформа</option>
109
- <option value="channel">Канал</option>
110
- <option value="stage">Stage</option>
111
- <option value="status">Статус</option>
112
- <option value="updateId">ID</option>
113
- </select>
114
- <button
115
- type="button"
168
+ <option value="createdAt">{t("По дате")}</option>
169
+ <option value="runtimeVersion">{t("По runtime")}</option>
170
+ <option value="platform">{t("По платформе")}</option>
171
+ <option value="channel">{t("По каналу")}</option>
172
+ <option value="stage">{t("По stage")}</option>
173
+ <option value="status">{t("По статусу")}</option>
174
+ <option value="updateId">{t("По ID")}</option>
175
+ </NativeSelect>
176
+ <Button
177
+ variant="outline"
178
+ size="sm"
116
179
  onClick={() => {
117
180
  setOrder((current) => (current === "asc" ? "desc" : "asc"));
118
181
  setPage(1);
119
182
  }}
120
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
183
+ aria-label={
184
+ order === "asc"
185
+ ? t("Сортировать по убыванию")
186
+ : t("Сортировать по возрастанию")
187
+ }
121
188
  >
189
+ <ArrowDownUp />
122
190
  {order === "asc" ? "ASC" : "DESC"}
123
- </button>
124
- <LogoutButton />
125
- </div>
126
- </header>
127
-
128
- <DistributionControl />
129
-
130
- {error ? (
131
- <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">
132
- {error}
133
- </div>
134
- ) : null}
135
-
136
- {hasRollbackActive ? (
137
- <div className="rounded-md border border-orange-300 bg-orange-50 p-3 text-sm text-orange-900 dark:border-orange-700 dark:bg-orange-950/30 dark:text-orange-200">
138
- ⚠️ Rollback активен: автодоставка новых апдейтов временно отключена.
139
- {hasIgnoredUpdates
140
- ? " Новые апдейты в этом scope помечены как ignored."
141
- : ""}
142
- </div>
143
- ) : null}
144
-
145
- {lockedScopes.length > 0 ? (
146
- <div className="rounded-md border border-zinc-300 bg-zinc-50 p-3 text-sm text-zinc-800 dark:border-zinc-700 dark:bg-zinc-900/40 dark:text-zinc-200">
147
- <p className="font-medium">Rollback lock по scope:</p>
148
- <p className="mt-1 text-xs">
149
- {lockedScopes
150
- .map(
151
- (scope) =>
152
- `${scope.runtimeVersion} / ${scope.platform} / ${scope.channel}`,
153
- )
154
- .join("; ")}
155
- </p>
191
+ </Button>
156
192
  </div>
157
- ) : null}
158
-
159
- <section className="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900">
160
- <div className="overflow-x-auto">
161
- <table className="min-w-full text-sm">
162
- <thead className="bg-zinc-100 dark:bg-zinc-800">
163
- <tr>
164
- <th className="px-4 py-4 text-left">Дата</th>
165
- <th className="px-4 py-4 text-left">Runtime</th>
166
- <th className="px-4 py-4 text-left">App version</th>
167
- <th className="px-4 py-4 text-left">Платформа</th>
168
- <th className="px-4 py-4 text-left">Канал</th>
169
- <th className="px-4 py-4 text-left">Комментарий</th>
170
- <th className="px-4 py-4 text-left">Stage</th>
171
- <th className="px-4 py-4 text-left">Статус</th>
172
- <th className="px-4 py-4 text-left">Режим</th>
173
- <th className="px-4 py-4 text-left">Latest</th>
174
- <th className="px-4 py-4 text-left">Assets</th>
175
- <th className="px-4 py-4 text-left">ID</th>
176
- </tr>
177
- </thead>
178
- <tbody>
179
- {loading ? (
180
- <tr>
181
- <td className="px-3 py-4 text-zinc-500" colSpan={12}>
182
- Загрузка...
183
- </td>
184
- </tr>
185
- ) : null}
186
-
187
- {!loading && items.length === 0 ? (
188
- <tr>
189
- <td className="px-3 py-4 text-zinc-500" colSpan={12}>
190
- Апдейты не найдены
191
- </td>
192
- </tr>
193
- ) : null}
194
-
195
- {!loading
196
- ? items.map((item) => (
197
- <tr
198
- key={item.key}
199
- className={`border-t border-zinc-200 dark:border-zinc-800 ${
200
- item.isRollbackActive
201
- ? "bg-amber-50/70 dark:bg-amber-950/30"
193
+ </div>
194
+ <Table>
195
+ <TableHeader>
196
+ <TableRow className="bg-muted/40 hover:bg-muted/40">
197
+ <TableHead className="pl-5">{t("Обновление")}</TableHead>
198
+ <TableHead>Runtime / App</TableHead>
199
+ <TableHead>{t("Платформа / канал")}</TableHead>
200
+ <TableHead>{t("Состояние")}</TableHead>
201
+ <TableHead>{t("Доставка")}</TableHead>
202
+ <TableHead>Assets</TableHead>
203
+ <TableHead className="pr-5 text-right">{t("Создано")}</TableHead>
204
+ </TableRow>
205
+ </TableHeader>
206
+ <TableBody>
207
+ {loading && (
208
+ <TableRow>
209
+ <TableCell
210
+ colSpan={7}
211
+ className="h-36 text-center text-muted-foreground"
212
+ >
213
+ <RefreshCw className="mx-auto mb-2 size-5 animate-spin" />
214
+ {t("Загрузка обновлений…")}
215
+ </TableCell>
216
+ </TableRow>
217
+ )}
218
+ {!loading && items.length === 0 && (
219
+ <TableRow>
220
+ <TableCell colSpan={7} className="h-48 text-center">
221
+ <Package className="mx-auto mb-3 size-8 text-muted-foreground/50" />
222
+ <p className="font-medium">{t("Обновлений пока нет")}</p>
223
+ <p className="mt-1 text-sm text-muted-foreground">
224
+ {t("Опубликуйте OTA, чтобы управлять его доставкой здесь.")}
225
+ </p>
226
+ </TableCell>
227
+ </TableRow>
228
+ )}
229
+ {!loading &&
230
+ items.map((item) => (
231
+ <TableRow
232
+ key={item.key}
233
+ className={item.isRollbackActive ? "bg-amber-500/5" : ""}
234
+ >
235
+ <TableCell className="max-w-80 py-4 pl-5">
236
+ <Link
237
+ href={`/updates/${item.encodedKey}`}
238
+ className="group flex items-center gap-2 text-sm font-medium text-foreground hover:text-primary"
239
+ >
240
+ <span className="truncate">
241
+ {item.comment || t("Без комментария")}
242
+ </span>
243
+ <ArrowRight className="size-3.5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100" />
244
+ </Link>
245
+ <Link
246
+ href={`/updates/${item.encodedKey}`}
247
+ className="mt-1 block max-w-60 truncate font-mono text-[11px] text-muted-foreground hover:text-primary"
248
+ title={item.updateId}
249
+ >
250
+ {item.updateId}
251
+ </Link>
252
+ </TableCell>
253
+ <TableCell>
254
+ <p className="font-medium">{item.runtimeVersion}</p>
255
+ <p className="mt-1 text-xs text-muted-foreground">
256
+ App {item.appVersion || "—"}
257
+ </p>
258
+ </TableCell>
259
+ <TableCell>
260
+ <span className="text-sm">
261
+ {item.platform === "ios" ? "iOS" : "Android"}
262
+ </span>
263
+ <p className="mt-1 text-xs text-muted-foreground">
264
+ {item.channel}
265
+ </p>
266
+ </TableCell>
267
+ <TableCell>
268
+ <div className="flex flex-wrap gap-1.5">
269
+ <Badge
270
+ variant={
271
+ item.status === "active" ? "default" : "secondary"
272
+ }
273
+ className={
274
+ item.status === "active"
275
+ ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
202
276
  : ""
203
- }`}
277
+ }
204
278
  >
205
- <td className="px-4 py-4">
206
- {new Date(item.createdAt).toLocaleString("uk-UA") ||
207
- item.createdAtPath}
208
- </td>
209
- <td className="px-4 py-4">{item.runtimeVersion}</td>
210
- <td className="px-4 py-4">
211
- {item.appVersion || "—"}
212
- </td>
213
- <td className="px-4 py-4">{item.platform}</td>
214
- <td className="px-4 py-4">{item.channel}</td>
215
- <td className="px-4 py-4">
216
- <div
217
- className="max-w-72 truncate"
218
- title={item.comment || ""}
219
- >
220
- {item.comment || "-"}
221
- </div>
222
- </td>
223
- <td className="px-4 py-4">{item.stage}</td>
224
- <td className="px-4 py-4">{item.status}</td>
225
- <td className="px-4 py-4">
226
- <div className="flex flex-wrap gap-1">
227
- <span
228
- className={`rounded border px-2 py-0.5 text-xs ${
229
- item.deliveryMode === "background"
230
- ? "border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
231
- : "border-zinc-300 text-zinc-700 dark:border-zinc-600 dark:text-zinc-300"
232
- }`}
233
- >
234
- {item.deliveryMode === "background"
235
- ? "Background"
236
- : "Manual"}
237
- </span>
238
- {item.hasGuard ? (
239
- <span className="rounded border border-violet-300 px-2 py-0.5 text-xs text-violet-700 dark:border-violet-700 dark:text-violet-300">
240
- Guard
241
- </span>
242
- ) : null}
243
- {item.isRollbackActive ? (
244
- <span className="rounded border border-amber-300 px-2 py-0.5 text-xs text-amber-800 dark:border-amber-700 dark:text-amber-300">
245
- rollback
246
- </span>
247
- ) : item.isIgnoredByRollback ? (
248
- <span className="rounded border border-zinc-300 px-2 py-0.5 text-xs text-zinc-700 dark:border-zinc-600 dark:text-zinc-300">
249
- ignored
250
- </span>
251
- ) : (
252
- <span className="rounded border border-emerald-300 px-2 py-0.5 text-xs text-emerald-700 dark:border-emerald-700 dark:text-emerald-300">
253
- scope open
254
- </span>
255
- )}
256
- </div>
257
- </td>
258
- <td className="px-4 py-4">
259
- {item.isLatest ? "Да" : "Нет"}
260
- </td>
261
- <td className="px-4 py-4">{item.assetsCount}</td>
262
- <td className="px-4 py-4">
263
- <Link
264
- href={`/updates/${item.encodedKey}`}
265
- className="text-blue-600 hover:underline dark:text-blue-400"
266
- >
267
- {item.updateId}
268
- </Link>
269
- </td>
270
- </tr>
271
- ))
272
- : null}
273
- </tbody>
274
- </table>
275
- </div>
276
-
277
- <div className="flex items-center justify-between border-t border-zinc-200 px-4 py-3 dark:border-zinc-800">
278
- <p className="text-sm text-zinc-600 dark:text-zinc-400">
279
- Страница {page} из {totalPages}
280
- </p>
281
- <div className="flex gap-2">
282
- <button
283
- type="button"
284
- onClick={() => setPage((current) => Math.max(1, current - 1))}
285
- disabled={page <= 1 || loading}
286
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-800"
287
- >
288
- Назад
289
- </button>
290
- <button
291
- type="button"
292
- onClick={() =>
293
- setPage((current) => Math.min(totalPages, current + 1))
294
- }
295
- disabled={page >= totalPages || loading}
296
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-800"
297
- >
298
- Вперёд
299
- </button>
300
- </div>
279
+ {item.status}
280
+ </Badge>
281
+ {item.isLatest && <Badge variant="outline">Latest</Badge>}
282
+ {item.audienceMode === "devices" && (
283
+ <Badge variant="outline">
284
+ {t("Выбранные устройства")}
285
+ </Badge>
286
+ )}
287
+ </div>
288
+ <p className="mt-1.5 text-xs text-muted-foreground">
289
+ {item.stage}
290
+ </p>
291
+ </TableCell>
292
+ <TableCell>
293
+ <div className="flex flex-wrap gap-1.5">
294
+ <Badge variant="outline">
295
+ {item.deliveryMode === "background"
296
+ ? "Background"
297
+ : "Manual"}
298
+ </Badge>
299
+ {item.hasGuard && (
300
+ <Badge variant="secondary">Guard</Badge>
301
+ )}
302
+ </div>
303
+ <p
304
+ className={`mt-1.5 text-xs ${item.isRollbackActive ? "text-amber-600" : "text-muted-foreground"}`}
305
+ >
306
+ {item.isRollbackActive
307
+ ? "Rollback"
308
+ : item.isIgnoredByRollback
309
+ ? "Ignored by rollback"
310
+ : "Scope open"}
311
+ </p>
312
+ </TableCell>
313
+ <TableCell className="tabular-nums text-muted-foreground">
314
+ {item.assetsCount}
315
+ </TableCell>
316
+ <TableCell className="pr-5 text-right text-xs tabular-nums text-muted-foreground">
317
+ {new Date(item.createdAt).toLocaleString(formatLocale) ||
318
+ item.createdAtPath}
319
+ </TableCell>
320
+ </TableRow>
321
+ ))}
322
+ </TableBody>
323
+ </Table>
324
+ <div className="flex items-center justify-between gap-3 border-t px-5 py-3">
325
+ <p className="text-xs text-muted-foreground">
326
+ {t("Страница ")}
327
+ {page} {t(" из ")}
328
+ {totalPages}
329
+ </p>
330
+ <div className="flex gap-2">
331
+ <Button
332
+ variant="outline"
333
+ size="sm"
334
+ onClick={() => setPage((current) => Math.max(1, current - 1))}
335
+ disabled={page <= 1 || loading}
336
+ >
337
+ <ChevronLeft />
338
+ {t("Назад")}
339
+ </Button>
340
+ <Button
341
+ variant="outline"
342
+ size="sm"
343
+ onClick={() =>
344
+ setPage((current) => Math.min(totalPages, current + 1))
345
+ }
346
+ disabled={page >= totalPages || loading}
347
+ >
348
+ {t("Вперёд")}
349
+ <ChevronRight />
350
+ </Button>
301
351
  </div>
302
- </section>
303
- </div>
304
- </main>
352
+ </div>
353
+ </Card>
354
+ </div>
305
355
  );
306
356
  }