create-expo-updates-server 0.4.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.
- package/README.md +4 -2
- package/dist/template/Dockerfile +4 -6
- package/dist/template/README.md +4 -9
- package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
- package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
- package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
- package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
- package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
- package/dist/template/app/api/admin/updates/route.test.ts +21 -0
- package/dist/template/app/api/admin/updates/route.ts +12 -1
- package/dist/template/app/globals.css +65 -68
- package/dist/template/app/login/page.tsx +66 -42
- package/dist/template/app/updates/[encodedKey]/page.tsx +375 -263
- package/dist/template/app/updates/devices/page.tsx +188 -152
- package/dist/template/app/updates/embedded/page.tsx +63 -29
- package/dist/template/app/updates/emergency-redirects/page.tsx +93 -58
- package/dist/template/app/updates/layout.tsx +2 -1
- package/dist/template/app/updates/page.tsx +381 -283
- package/dist/template/app/updates/releases.test.tsx +156 -0
- package/dist/template/components/admin/admin-role.ts +5 -0
- package/dist/template/components/admin/admin-shell.tsx +166 -101
- package/dist/template/components/admin/confirm-action.tsx +123 -0
- package/dist/template/components/admin/language-switcher.tsx +25 -17
- package/dist/template/components/admin/release-badges.test.tsx +50 -0
- package/dist/template/components/admin/release-badges.tsx +101 -0
- package/dist/template/components/ui/alert.tsx +10 -3
- package/dist/template/components/ui/avatar.tsx +108 -0
- package/dist/template/components/ui/badge.tsx +2 -2
- package/dist/template/components/ui/breadcrumb.tsx +108 -0
- package/dist/template/components/ui/button.tsx +5 -5
- package/dist/template/components/ui/card.tsx +2 -2
- package/dist/template/components/ui/chart.tsx +1 -1
- package/dist/template/components/ui/collapsible.tsx +7 -0
- package/dist/template/components/ui/empty.tsx +103 -0
- package/dist/template/components/ui/field.tsx +248 -0
- package/dist/template/components/ui/input-group.tsx +170 -0
- package/dist/template/components/ui/input.tsx +1 -1
- package/dist/template/components/ui/native-select.tsx +1 -1
- package/dist/template/components/ui/radio-group.tsx +41 -0
- package/dist/template/components/ui/status-tones.ts +15 -0
- package/dist/template/components/ui/table.tsx +1 -1
- package/dist/template/components/ui/textarea.tsx +1 -1
- package/dist/template/docs/admin-ui.md +7 -3
- package/dist/template/docs/device-targeting.md +2 -7
- package/dist/template/docs/doctor.md +2 -2
- package/dist/template/docs/expo-app-setup.md +9 -27
- package/dist/template/docs/getting-started.md +3 -4
- package/dist/template/docs/installation-telemetry.md +2 -8
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
- package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
- package/dist/template/docs/migrations/schema.sql +349 -0
- package/dist/template/docs/npm-installer.md +3 -3
- package/dist/template/docs/operations-guide.md +8 -6
- package/dist/template/docs/ota-client-lifecycle.md +30 -68
- package/dist/template/docs/ota-update-policy.md +9 -20
- package/dist/template/docs/ru/admin-ui.md +7 -3
- package/dist/template/docs/ru/device-targeting.md +2 -2
- package/dist/template/docs/ru/doctor.md +2 -2
- package/dist/template/docs/ru/expo-app-setup.md +9 -9
- package/dist/template/docs/ru/getting-started.md +3 -3
- package/dist/template/docs/ru/installation-telemetry.md +2 -2
- package/dist/template/docs/ru/npm-installer.md +3 -3
- package/dist/template/docs/ru/operations-guide.md +8 -3
- package/dist/template/docs/ru/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/ru/ota-update-policy.md +9 -7
- package/dist/template/docs/ru/publishing-npm-installer.md +2 -2
- package/dist/template/docs/uk/admin-ui.md +7 -3
- package/dist/template/docs/uk/device-targeting.md +2 -2
- package/dist/template/docs/uk/doctor.md +2 -2
- package/dist/template/docs/uk/expo-app-setup.md +9 -9
- package/dist/template/docs/uk/getting-started.md +3 -3
- package/dist/template/docs/uk/installation-telemetry.md +2 -2
- package/dist/template/docs/uk/npm-installer.md +3 -3
- package/dist/template/docs/uk/operations-guide.md +8 -3
- package/dist/template/docs/uk/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/uk/ota-update-policy.md +9 -7
- package/dist/template/docs/uk/publishing-npm-installer.md +2 -2
- package/dist/template/lib/audience-ids.ts +4 -0
- package/dist/template/package-lock.json +46 -0
- package/dist/template/package.json +3 -1
- package/dist/template/scripts/configure-expo-app.mjs +3 -3
- package/dist/template/scripts/create-access-token.mjs +1 -1
- package/dist/template/scripts/lib/doctor.mjs +10 -7
- package/dist/template/scripts/lib/doctor.test.mjs +7 -5
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
- package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
- package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
- package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
- package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
- package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
- package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
- package/dist/template/scripts/tests/e2e/console.mjs +86 -0
- package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
- package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
- package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
- package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
- package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
- package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
- package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
- package/dist/template/scripts/tests/e2e/run.mjs +224 -0
- package/dist/template/scripts/tests/manifest-identity.sql +7 -5
- package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
- package/dist/template/src/client/admin-api.ts +45 -10
- package/dist/template/src/client/admin-types.ts +35 -1
- package/dist/template/src/client/devices/analytics.tsx +168 -231
- package/dist/template/src/client/devices/cohorts.tsx +181 -0
- package/dist/template/src/client/devices/device-name.tsx +37 -23
- package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
- package/dist/template/src/client/devices/registry.tsx +258 -245
- package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
- package/dist/template/src/client/devices/use-devices-report.ts +53 -82
- package/dist/template/src/client/devices/version-adoption-chart.tsx +47 -49
- package/dist/template/src/client/distribution-control.tsx +89 -57
- package/dist/template/src/client/distribution-history.tsx +353 -0
- package/dist/template/src/client/guard-action-catalog.tsx +183 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
- package/dist/template/src/client/guard-action-combobox.tsx +133 -239
- package/dist/template/src/client/guard-action-options.ts +4 -6
- package/dist/template/src/client/i18n/en.json +133 -2
- package/dist/template/src/client/i18n/language-switching.test.tsx +12 -3
- package/dist/template/src/client/i18n/ru.json +133 -2
- package/dist/template/src/client/i18n/uk.json +133 -2
- package/dist/template/src/client/logout-button.tsx +3 -3
- package/dist/template/src/client/policy-draft.ts +138 -0
- package/dist/template/src/client/update-audience-editor.tsx +597 -206
- package/dist/template/src/client/update-policy-editor.test.ts +101 -29
- package/dist/template/src/client/update-policy-editor.tsx +454 -320
- package/dist/template/src/client/use-filtered-results.ts +55 -0
- package/dist/template/src/server/controllers/manifest.test.ts +23 -3
- package/dist/template/src/server/controllers/manifest.ts +15 -1
- package/dist/template/src/server/devices/audience.ts +9 -5
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
- package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
- package/dist/template/src/server/lib/admin-updates.ts +160 -534
- package/dist/template/src/server/lib/distribution-history.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +24 -0
- package/dist/template/src/server/lib/supabase.test.ts +38 -1
- package/dist/template/src/server/lib/update-policy.test.ts +20 -0
- package/dist/template/src/server/lib/update-policy.ts +23 -10
- package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
- package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
- package/dist/template/src/server/manifest/manifest-values.ts +21 -13
- package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
- package/dist/template/tsconfig.json +2 -2
- package/dist/template-manifest.json +446 -301
- package/package.json +1 -1
- package/dist/template/scripts/lib/device-identity.test.ts +0 -29
- package/dist/template/scripts/lib/ota-client.test.ts +0 -55
- package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
- package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
- package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
- package/dist/template/templates/expo-app/ota-client/README.md +0 -73
- package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
- package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
- package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
- package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
- package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
- package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
- package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
import { useFormatters } from "@/src/client/i18n/use-formatters";
|
|
3
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Collapsible,
|
|
7
|
+
CollapsibleTrigger,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
} from "@/components/ui/collapsible";
|
|
10
|
+
import { Button } from "@/components/ui/button";
|
|
11
|
+
import {
|
|
12
|
+
ChevronDown,
|
|
13
|
+
Activity,
|
|
14
|
+
CircleArrowDown,
|
|
15
|
+
Layers3,
|
|
16
|
+
Smartphone,
|
|
17
|
+
} from "lucide-react";
|
|
18
|
+
import {
|
|
19
|
+
Area,
|
|
20
|
+
AreaChart,
|
|
21
|
+
CartesianGrid,
|
|
22
|
+
ReferenceLine,
|
|
23
|
+
XAxis,
|
|
24
|
+
YAxis,
|
|
25
|
+
} from "recharts";
|
|
6
26
|
import {
|
|
7
27
|
ChartContainer,
|
|
8
28
|
ChartTooltip,
|
|
@@ -15,12 +35,6 @@ import {
|
|
|
15
35
|
CardHeader,
|
|
16
36
|
CardTitle,
|
|
17
37
|
} from "@/components/ui/card";
|
|
18
|
-
import {
|
|
19
|
-
Tabs,
|
|
20
|
-
TabsContent,
|
|
21
|
-
TabsList,
|
|
22
|
-
TabsTrigger,
|
|
23
|
-
} from "@/components/ui/tabs";
|
|
24
38
|
import {
|
|
25
39
|
Table,
|
|
26
40
|
TableBody,
|
|
@@ -29,10 +43,8 @@ import {
|
|
|
29
43
|
TableHeader,
|
|
30
44
|
TableRow,
|
|
31
45
|
} from "@/components/ui/table";
|
|
32
|
-
|
|
46
|
+
|
|
33
47
|
import type { DevicesReport } from "@/src/server/devices/report-types";
|
|
34
|
-
export const percent = (n: number, total: number) =>
|
|
35
|
-
total ? `${Math.round((n / total) * 100)}%` : "—";
|
|
36
48
|
export function useKindNames() {
|
|
37
49
|
const { t } = useI18n();
|
|
38
50
|
return {
|
|
@@ -41,8 +53,8 @@ export function useKindNames() {
|
|
|
41
53
|
unknown: t("Не определён"),
|
|
42
54
|
};
|
|
43
55
|
}
|
|
44
|
-
export function
|
|
45
|
-
const { number, date } = useFormatters();
|
|
56
|
+
export function Overview({ report }: { report: DevicesReport }) {
|
|
57
|
+
const { number, date, share } = useFormatters();
|
|
46
58
|
const { t } = useI18n();
|
|
47
59
|
const { summary: s } = report;
|
|
48
60
|
const kinds = [
|
|
@@ -60,9 +72,10 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
60
72
|
];
|
|
61
73
|
return (
|
|
62
74
|
<>
|
|
63
|
-
<div className="grid
|
|
75
|
+
<div className="grid grid-cols-2 gap-px overflow-hidden rounded-xl border bg-border xl:grid-cols-4">
|
|
64
76
|
{[
|
|
65
77
|
{
|
|
78
|
+
icon: Smartphone,
|
|
66
79
|
label: t("Активные установки"),
|
|
67
80
|
value: number(s.activeInstallations),
|
|
68
81
|
detail: t("Heartbeat за последние {0}", [
|
|
@@ -72,46 +85,52 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
72
85
|
]),
|
|
73
86
|
},
|
|
74
87
|
{
|
|
88
|
+
icon: CircleArrowDown,
|
|
75
89
|
label: t("Используют OTA"),
|
|
76
|
-
value:
|
|
90
|
+
value: share(s.otaInstallations, s.activeInstallations),
|
|
77
91
|
detail: t("{0} из {1} установок", [
|
|
78
92
|
number(s.otaInstallations),
|
|
79
93
|
number(s.activeInstallations),
|
|
80
94
|
]),
|
|
81
95
|
},
|
|
82
96
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
]),
|
|
97
|
+
icon: Activity,
|
|
98
|
+
label: t("New installations"),
|
|
99
|
+
value: number(s.newInstallations),
|
|
100
|
+
detail: t("First seen during this period"),
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]),
|
|
103
|
+
icon: Layers3,
|
|
104
|
+
label: t("Reported versions"),
|
|
105
|
+
value: number(s.reportedVersions),
|
|
106
|
+
detail: t("Distinct version combinations"),
|
|
95
107
|
},
|
|
96
108
|
].map((kpi) => (
|
|
97
|
-
<Card key={kpi.label} className="gap-
|
|
98
|
-
<CardHeader className="px-
|
|
99
|
-
<CardDescription>
|
|
109
|
+
<Card key={kpi.label} className="min-w-0 gap-2 rounded-none border-0 py-4 sm:py-5">
|
|
110
|
+
<CardHeader className="gap-3 px-4">
|
|
111
|
+
<CardDescription className="flex items-center justify-between gap-1 text-xs font-medium">
|
|
112
|
+
{kpi.label}
|
|
113
|
+
<kpi.icon
|
|
114
|
+
className="size-4 shrink-0 text-muted-foreground"
|
|
115
|
+
aria-hidden="true"
|
|
116
|
+
/>
|
|
117
|
+
</CardDescription>
|
|
100
118
|
<CardTitle className="text-3xl font-semibold tracking-tight tabular-nums">
|
|
101
119
|
{kpi.value}
|
|
102
120
|
</CardTitle>
|
|
103
121
|
</CardHeader>
|
|
104
|
-
<CardContent className="px-
|
|
122
|
+
<CardContent className="px-4 text-xs text-muted-foreground">
|
|
105
123
|
{kpi.detail}
|
|
106
124
|
</CardContent>
|
|
107
125
|
</Card>
|
|
108
126
|
))}
|
|
109
127
|
</div>
|
|
110
|
-
<
|
|
111
|
-
<div className="grid min-w-0 gap-4 xl:grid-cols-[1.25fr_1fr]">
|
|
128
|
+
<div className="grid min-w-0 gap-4">
|
|
112
129
|
<Card className="min-w-0 shadow-none">
|
|
113
130
|
<CardHeader>
|
|
114
|
-
<CardTitle>
|
|
131
|
+
<CardTitle>
|
|
132
|
+
<h2>{t("Активность установок")}</h2>
|
|
133
|
+
</CardTitle>
|
|
115
134
|
<CardDescription>
|
|
116
135
|
{t("Уникальные установки с heartbeat за день · UTC")}
|
|
117
136
|
</CardDescription>
|
|
@@ -128,15 +147,15 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
128
147
|
color: "var(--chart-2)",
|
|
129
148
|
},
|
|
130
149
|
}}
|
|
131
|
-
className="h-52 w-full"
|
|
150
|
+
className="aspect-auto h-52 w-full sm:h-64 lg:h-72"
|
|
132
151
|
aria-label={t("График ежедневных активных и новых установок")}
|
|
133
152
|
>
|
|
134
153
|
<AreaChart
|
|
135
154
|
accessibilityLayer
|
|
136
155
|
data={report.activity}
|
|
137
|
-
margin={{ top: 12, right:
|
|
156
|
+
margin={{ top: 12, right: 16, left: 0, bottom: 0 }}
|
|
138
157
|
>
|
|
139
|
-
<CartesianGrid vertical={false} />
|
|
158
|
+
<CartesianGrid vertical={false} stroke="var(--border)" />
|
|
140
159
|
<XAxis
|
|
141
160
|
dataKey="date"
|
|
142
161
|
tickFormatter={date}
|
|
@@ -146,15 +165,33 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
146
165
|
minTickGap={24}
|
|
147
166
|
/>
|
|
148
167
|
<YAxis
|
|
168
|
+
width="auto"
|
|
149
169
|
allowDecimals={false}
|
|
150
170
|
axisLine={false}
|
|
151
171
|
tickLine={false}
|
|
152
172
|
tick={{ fill: "var(--muted-foreground)" }}
|
|
153
173
|
/>
|
|
174
|
+
{report.activity
|
|
175
|
+
.filter((day) => day.coverage === "partial")
|
|
176
|
+
.map((day) => (
|
|
177
|
+
<ReferenceLine
|
|
178
|
+
key={day.date}
|
|
179
|
+
x={day.date}
|
|
180
|
+
stroke="var(--muted-foreground)"
|
|
181
|
+
strokeDasharray="3 4"
|
|
182
|
+
/>
|
|
183
|
+
))}
|
|
154
184
|
<ChartTooltip
|
|
155
185
|
content={
|
|
156
186
|
<ChartTooltipContent
|
|
157
|
-
labelFormatter={(value) =>
|
|
187
|
+
labelFormatter={(value) => {
|
|
188
|
+
const day = report.activity.find(
|
|
189
|
+
(entry) => entry.date === value,
|
|
190
|
+
);
|
|
191
|
+
return day?.coverage === "partial"
|
|
192
|
+
? `${date(day.date)} · ${t("Неполный день")}`
|
|
193
|
+
: date(String(value));
|
|
194
|
+
}}
|
|
158
195
|
/>
|
|
159
196
|
}
|
|
160
197
|
/>
|
|
@@ -165,7 +202,7 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
165
202
|
fill="var(--color-activeInstallations)"
|
|
166
203
|
fillOpacity={0.12}
|
|
167
204
|
strokeWidth={2}
|
|
168
|
-
dot={{ r:
|
|
205
|
+
dot={{ r: 2, fill: "var(--color-activeInstallations)" }}
|
|
169
206
|
connectNulls={false}
|
|
170
207
|
isAnimationActive={false}
|
|
171
208
|
/>
|
|
@@ -176,7 +213,8 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
176
213
|
fill="var(--color-newInstallations)"
|
|
177
214
|
fillOpacity={0.05}
|
|
178
215
|
strokeWidth={2}
|
|
179
|
-
|
|
216
|
+
strokeDasharray="5 3"
|
|
217
|
+
dot={{ r: 2, fill: "var(--color-newInstallations)" }}
|
|
180
218
|
connectNulls={false}
|
|
181
219
|
isAnimationActive={false}
|
|
182
220
|
/>
|
|
@@ -184,13 +222,26 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
184
222
|
</ChartContainer>
|
|
185
223
|
<div className="mt-3 flex flex-wrap gap-4 text-xs text-muted-foreground">
|
|
186
224
|
<span>
|
|
187
|
-
<i
|
|
225
|
+
<i
|
|
226
|
+
aria-hidden="true"
|
|
227
|
+
className="mr-2 inline-block w-4 align-middle border-t-2 border-chart-1"
|
|
228
|
+
/>
|
|
188
229
|
{t("Активные")}
|
|
189
230
|
</span>
|
|
190
231
|
<span>
|
|
191
|
-
<i
|
|
232
|
+
<i
|
|
233
|
+
aria-hidden="true"
|
|
234
|
+
className="mr-2 inline-block w-4 align-middle border-t-2 border-dashed border-chart-2"
|
|
235
|
+
/>
|
|
192
236
|
{t("Новые")}
|
|
193
237
|
</span>
|
|
238
|
+
<span>
|
|
239
|
+
<i
|
|
240
|
+
aria-hidden="true"
|
|
241
|
+
className="mr-2 inline-block h-3 align-middle border-l border-dashed border-muted-foreground"
|
|
242
|
+
/>
|
|
243
|
+
{t("Неполный день")}
|
|
244
|
+
</span>
|
|
194
245
|
</div>
|
|
195
246
|
<p className="mt-3 text-xs leading-5 text-muted-foreground">
|
|
196
247
|
{t("Сбор с ")}
|
|
@@ -199,55 +250,72 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
199
250
|
" · Сегодня — неполный день. До начала сбора данных нет; история хранится 90 дней.",
|
|
200
251
|
)}
|
|
201
252
|
</p>
|
|
202
|
-
<
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
</
|
|
222
|
-
<
|
|
223
|
-
<TableCell>
|
|
224
|
-
{day.coverage === "complete"
|
|
225
|
-
? t("Полный день")
|
|
226
|
-
: day.coverage === "partial"
|
|
227
|
-
? t("Неполный день")
|
|
228
|
-
: t("Нет данных")}
|
|
229
|
-
</TableCell>
|
|
253
|
+
<Collapsible className="group/daily mt-3 text-xs text-muted-foreground">
|
|
254
|
+
<CollapsibleTrigger asChild>
|
|
255
|
+
<Button size="sm" variant="outline">
|
|
256
|
+
<ChevronDown
|
|
257
|
+
className="group-data-[state=open]/daily:rotate-180"
|
|
258
|
+
aria-hidden="true"
|
|
259
|
+
/>
|
|
260
|
+
{t("Показать значения по дням")}
|
|
261
|
+
</Button>
|
|
262
|
+
</CollapsibleTrigger>
|
|
263
|
+
<CollapsibleContent>
|
|
264
|
+
<Table
|
|
265
|
+
className="mt-2"
|
|
266
|
+
aria-label={t("Показать значения по дням")}
|
|
267
|
+
>
|
|
268
|
+
<TableHeader>
|
|
269
|
+
<TableRow>
|
|
270
|
+
<TableHead>{t("Дата UTC")}</TableHead>
|
|
271
|
+
<TableHead>{t("Активные")}</TableHead>
|
|
272
|
+
<TableHead>{t("Новые")}</TableHead>
|
|
273
|
+
<TableHead>{t("Покрытие")}</TableHead>
|
|
230
274
|
</TableRow>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
275
|
+
</TableHeader>
|
|
276
|
+
<TableBody>
|
|
277
|
+
{report.activity.map((day) => (
|
|
278
|
+
<TableRow key={day.date}>
|
|
279
|
+
<TableCell>{date(day.date)}</TableCell>
|
|
280
|
+
<TableCell>
|
|
281
|
+
{day.activeInstallations === null
|
|
282
|
+
? "—"
|
|
283
|
+
: number(day.activeInstallations)}
|
|
284
|
+
</TableCell>
|
|
285
|
+
<TableCell>
|
|
286
|
+
{day.newInstallations === null
|
|
287
|
+
? "—"
|
|
288
|
+
: number(day.newInstallations)}
|
|
289
|
+
</TableCell>
|
|
290
|
+
<TableCell>
|
|
291
|
+
{day.coverage === "complete"
|
|
292
|
+
? t("Полный день")
|
|
293
|
+
: day.coverage === "partial"
|
|
294
|
+
? t("Неполный день")
|
|
295
|
+
: t("Нет данных")}
|
|
296
|
+
</TableCell>
|
|
297
|
+
</TableRow>
|
|
298
|
+
))}
|
|
299
|
+
</TableBody>
|
|
300
|
+
</Table>
|
|
301
|
+
</CollapsibleContent>
|
|
302
|
+
</Collapsible>
|
|
235
303
|
</CardContent>
|
|
236
304
|
</Card>
|
|
237
305
|
<Card className="min-w-0 shadow-none">
|
|
238
306
|
<CardHeader>
|
|
239
|
-
<CardTitle>
|
|
307
|
+
<CardTitle>
|
|
308
|
+
<h2>{t("Тип запуска")}</h2>
|
|
309
|
+
</CardTitle>
|
|
240
310
|
<CardDescription>
|
|
241
311
|
{t("Текущее состояние активных установок")}
|
|
242
312
|
</CardDescription>
|
|
243
313
|
</CardHeader>
|
|
244
|
-
<CardContent className="space-y-
|
|
314
|
+
<CardContent className="space-y-4">
|
|
245
315
|
<div
|
|
246
|
-
className="flex h-
|
|
316
|
+
className="flex h-2 overflow-hidden rounded-sm bg-muted"
|
|
247
317
|
role="img"
|
|
248
|
-
aria-label={kinds
|
|
249
|
-
.map((k) => `${k.label}: ${k.value}`)
|
|
250
|
-
.join(", ")}
|
|
318
|
+
aria-label={kinds.map((k) => `${k.label}: ${k.value}`).join(", ")}
|
|
251
319
|
>
|
|
252
320
|
{kinds.map((k) => (
|
|
253
321
|
<div
|
|
@@ -261,9 +329,12 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
261
329
|
/>
|
|
262
330
|
))}
|
|
263
331
|
</div>
|
|
264
|
-
<div className="grid grid-cols-3
|
|
332
|
+
<div className="grid divide-y sm:grid-cols-3 sm:divide-x sm:divide-y-0">
|
|
265
333
|
{kinds.map((k) => (
|
|
266
|
-
<div
|
|
334
|
+
<div
|
|
335
|
+
key={k.label}
|
|
336
|
+
className="flex flex-wrap items-center justify-between gap-2 py-2 sm:px-4 sm:first:pl-0 sm:last:pr-0"
|
|
337
|
+
>
|
|
267
338
|
<p className="text-xs text-muted-foreground">
|
|
268
339
|
<i
|
|
269
340
|
className="mr-1.5 inline-block size-2 rounded-full"
|
|
@@ -271,15 +342,30 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
271
342
|
/>
|
|
272
343
|
{k.label}
|
|
273
344
|
</p>
|
|
274
|
-
<p className="
|
|
345
|
+
<p className="text-base font-semibold tabular-nums">
|
|
275
346
|
{number(k.value)}{" "}
|
|
276
|
-
<span className="text-xs font-normal text-muted-foreground">
|
|
277
|
-
{
|
|
347
|
+
<span className="inline-block min-w-12 text-right text-xs font-normal text-muted-foreground">
|
|
348
|
+
{share(k.value, s.activeInstallations)}
|
|
278
349
|
</span>
|
|
279
350
|
</p>
|
|
280
351
|
</div>
|
|
281
352
|
))}
|
|
282
353
|
</div>
|
|
354
|
+
<div className={
|
|
355
|
+
"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-xs " +
|
|
356
|
+
(s.emergencyInstallations ? "border-destructive/40 bg-destructive/10" : "bg-muted/40")
|
|
357
|
+
}>
|
|
358
|
+
<span>{t("Аварийный запуск")}</span>
|
|
359
|
+
<strong
|
|
360
|
+
className={
|
|
361
|
+
s.emergencyInstallations
|
|
362
|
+
? "text-destructive"
|
|
363
|
+
: "text-foreground"
|
|
364
|
+
}
|
|
365
|
+
>
|
|
366
|
+
{number(s.emergencyInstallations)}
|
|
367
|
+
</strong>
|
|
368
|
+
</div>
|
|
283
369
|
{!report.total && (
|
|
284
370
|
<p className="text-sm text-muted-foreground">
|
|
285
371
|
{t("Нет установок с выбранными фильтрами.")}
|
|
@@ -288,155 +374,6 @@ export function Analytics({ report }: { report: DevicesReport }) {
|
|
|
288
374
|
</CardContent>
|
|
289
375
|
</Card>
|
|
290
376
|
</div>
|
|
291
|
-
<Card className="min-w-0 shadow-none">
|
|
292
|
-
<CardHeader>
|
|
293
|
-
<CardTitle>{t("Когорты установок")}</CardTitle>
|
|
294
|
-
<CardDescription>
|
|
295
|
-
{t(
|
|
296
|
-
"Группы по неделе первого heartbeat. Одна установка — одна запись, переустановка может создать новую.",
|
|
297
|
-
)}
|
|
298
|
-
</CardDescription>
|
|
299
|
-
</CardHeader>
|
|
300
|
-
<CardContent>
|
|
301
|
-
<Tabs defaultValue="adoption">
|
|
302
|
-
<TabsList className="mb-4">
|
|
303
|
-
<TabsTrigger value="adoption">
|
|
304
|
-
{t("Текущие версии")}
|
|
305
|
-
</TabsTrigger>
|
|
306
|
-
<TabsTrigger value="retention">
|
|
307
|
-
{t("Возвращаемость")}
|
|
308
|
-
</TabsTrigger>
|
|
309
|
-
</TabsList>
|
|
310
|
-
<TabsContent value="adoption">
|
|
311
|
-
<p className="mb-3 text-xs text-muted-foreground">
|
|
312
|
-
{t(
|
|
313
|
-
"Активные за выбранный период, сгруппированные по неделе первого появления. Проценты внутри каждой когорты.",
|
|
314
|
-
)}
|
|
315
|
-
</p>
|
|
316
|
-
<Table>
|
|
317
|
-
<TableHeader>
|
|
318
|
-
<TableRow>
|
|
319
|
-
<TableHead>{t("Неделя · UTC")}</TableHead>
|
|
320
|
-
<TableHead>{t("Установки")}</TableHead>
|
|
321
|
-
<TableHead>OTA</TableHead>
|
|
322
|
-
<TableHead>{t("Embedded")}</TableHead>
|
|
323
|
-
<TableHead>{t("Не определён")}</TableHead>
|
|
324
|
-
</TableRow>
|
|
325
|
-
</TableHeader>
|
|
326
|
-
<TableBody>
|
|
327
|
-
{report.adoptionCohorts.map((c) => (
|
|
328
|
-
<TableRow key={c.weekStart}>
|
|
329
|
-
<TableCell className="font-medium">
|
|
330
|
-
{date(c.weekStart)}
|
|
331
|
-
</TableCell>
|
|
332
|
-
<TableCell className="tabular-nums">
|
|
333
|
-
{number(c.installations)}
|
|
334
|
-
</TableCell>
|
|
335
|
-
{[
|
|
336
|
-
c.otaInstallations,
|
|
337
|
-
c.embeddedInstallations,
|
|
338
|
-
c.unknownInstallations,
|
|
339
|
-
].map((count, i) => (
|
|
340
|
-
<TableCell key={i}>
|
|
341
|
-
<div
|
|
342
|
-
className="rounded-md px-3 py-2 text-center tabular-nums"
|
|
343
|
-
style={{
|
|
344
|
-
background: `color-mix(in srgb, var(--chart-${i + 1}) ${c.installations ? 5 + (count / c.installations) * 20 : 0}%, transparent)`,
|
|
345
|
-
}}
|
|
346
|
-
>
|
|
347
|
-
{percent(count, c.installations)}{" "}
|
|
348
|
-
<span className="ml-1 text-xs text-muted-foreground">
|
|
349
|
-
({number(count)})
|
|
350
|
-
</span>
|
|
351
|
-
</div>
|
|
352
|
-
</TableCell>
|
|
353
|
-
))}
|
|
354
|
-
</TableRow>
|
|
355
|
-
))}
|
|
356
|
-
</TableBody>
|
|
357
|
-
</Table>
|
|
358
|
-
{!report.adoptionCohorts.length && (
|
|
359
|
-
<p className="py-6 text-center text-sm text-muted-foreground">
|
|
360
|
-
{t("Пока нет когорт для этой выборки.")}
|
|
361
|
-
</p>
|
|
362
|
-
)}
|
|
363
|
-
</TabsContent>
|
|
364
|
-
<TabsContent value="retention">
|
|
365
|
-
<p className="mb-3 max-w-4xl text-xs leading-5 text-muted-foreground">
|
|
366
|
-
{t(
|
|
367
|
-
"Новые установки за последние 90 дней после начала сбора. Фильтры платформы, канала, runtime и типа запуска применяются на момент первого heartbeat. D1/D7 — heartbeat ровно через 1/7 дней, даже если версия изменилась. D0 — исходная когорта (100%); для D1 и дальше неполные дни исключены. «—» означает, что день ещё не наблюдался полностью.",
|
|
368
|
-
)}
|
|
369
|
-
</p>
|
|
370
|
-
<Table>
|
|
371
|
-
<TableHeader>
|
|
372
|
-
<TableRow>
|
|
373
|
-
<TableHead>{t("Неделя · UTC")}</TableHead>
|
|
374
|
-
<TableHead>{t("Новые")}</TableHead>
|
|
375
|
-
{[0, 1, 7, 14, 30].map((d) => (
|
|
376
|
-
<TableHead key={d} className="text-center">
|
|
377
|
-
D{d}
|
|
378
|
-
</TableHead>
|
|
379
|
-
))}
|
|
380
|
-
</TableRow>
|
|
381
|
-
</TableHeader>
|
|
382
|
-
<TableBody>
|
|
383
|
-
{report.cohorts.map((c) => (
|
|
384
|
-
<TableRow key={c.weekStart}>
|
|
385
|
-
<TableCell>{date(c.weekStart)}</TableCell>
|
|
386
|
-
<TableCell>{number(c.installations)}</TableCell>
|
|
387
|
-
{c.cells.map((cell) => (
|
|
388
|
-
<TableCell key={cell.day}>
|
|
389
|
-
<div
|
|
390
|
-
className="rounded-md px-2 py-2 text-center tabular-nums"
|
|
391
|
-
title={
|
|
392
|
-
cell.rate === null
|
|
393
|
-
? t("Нет полностью наблюдаемых дней")
|
|
394
|
-
: cell.day === 0
|
|
395
|
-
? t(
|
|
396
|
-
"D0: исходная когорта, включая сегодняшние установки",
|
|
397
|
-
)
|
|
398
|
-
: t(
|
|
399
|
-
"{0} из {1} установок с полностью наблюдаемым днём",
|
|
400
|
-
[
|
|
401
|
-
cell.retainedInstallations,
|
|
402
|
-
cell.eligibleInstallations,
|
|
403
|
-
],
|
|
404
|
-
)
|
|
405
|
-
}
|
|
406
|
-
style={{
|
|
407
|
-
background:
|
|
408
|
-
cell.rate === null
|
|
409
|
-
? "var(--muted)"
|
|
410
|
-
: `color-mix(in srgb, var(--chart-1) ${5 + cell.rate * 25}%, transparent)`,
|
|
411
|
-
}}
|
|
412
|
-
>
|
|
413
|
-
{cell.rate === null
|
|
414
|
-
? "—"
|
|
415
|
-
: `${Math.round(cell.rate * 100)}%`}
|
|
416
|
-
<span className="block text-[10px] text-muted-foreground">
|
|
417
|
-
{cell.rate === null
|
|
418
|
-
? t("нет данных")
|
|
419
|
-
: `${cell.retainedInstallations}/${cell.eligibleInstallations}`}
|
|
420
|
-
</span>
|
|
421
|
-
</div>
|
|
422
|
-
</TableCell>
|
|
423
|
-
))}
|
|
424
|
-
</TableRow>
|
|
425
|
-
))}
|
|
426
|
-
</TableBody>
|
|
427
|
-
</Table>
|
|
428
|
-
{!report.cohorts.length && (
|
|
429
|
-
<p className="py-6 text-center text-sm text-muted-foreground">
|
|
430
|
-
{t(
|
|
431
|
-
"Возвращаемость появится для новых установок после начала сбора",
|
|
432
|
-
)}{" "}
|
|
433
|
-
{date(report.coverage.collectionStartedAt)}.
|
|
434
|
-
</p>
|
|
435
|
-
)}
|
|
436
|
-
</TabsContent>
|
|
437
|
-
</Tabs>
|
|
438
|
-
</CardContent>
|
|
439
|
-
</Card>
|
|
440
377
|
</>
|
|
441
378
|
);
|
|
442
379
|
}
|