@shware/workflow-ui 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +180 -2
- package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
- package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
- package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +673 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/config.d.mts +247 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +27 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +451 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2722 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postgres.d.mts +34 -0
- package/dist/postgres.d.mts.map +1 -0
- package/dist/postgres.mjs +313 -0
- package/dist/postgres.mjs.map +1 -0
- package/package.json +93 -3
- package/src/app/assets/devices/iphone-17-pro.png +0 -0
- package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
- package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
- package/src/app/assets/flags/AC.svg +1 -0
- package/src/app/assets/flags/AD.svg +1 -0
- package/src/app/assets/flags/AE.svg +1 -0
- package/src/app/assets/flags/AF.svg +1 -0
- package/src/app/assets/flags/AG.svg +1 -0
- package/src/app/assets/flags/AI.svg +1 -0
- package/src/app/assets/flags/AL.svg +1 -0
- package/src/app/assets/flags/AM.svg +1 -0
- package/src/app/assets/flags/AO.svg +1 -0
- package/src/app/assets/flags/AQ.svg +1 -0
- package/src/app/assets/flags/AR.svg +1 -0
- package/src/app/assets/flags/AS.svg +1 -0
- package/src/app/assets/flags/AT.svg +1 -0
- package/src/app/assets/flags/AU.svg +1 -0
- package/src/app/assets/flags/AW.svg +1 -0
- package/src/app/assets/flags/AX.svg +1 -0
- package/src/app/assets/flags/AZ.svg +1 -0
- package/src/app/assets/flags/BA.svg +1 -0
- package/src/app/assets/flags/BB.svg +1 -0
- package/src/app/assets/flags/BD.svg +1 -0
- package/src/app/assets/flags/BE.svg +1 -0
- package/src/app/assets/flags/BF.svg +1 -0
- package/src/app/assets/flags/BG.svg +1 -0
- package/src/app/assets/flags/BH.svg +1 -0
- package/src/app/assets/flags/BI.svg +1 -0
- package/src/app/assets/flags/BJ.svg +1 -0
- package/src/app/assets/flags/BL.svg +1 -0
- package/src/app/assets/flags/BM.svg +1 -0
- package/src/app/assets/flags/BN.svg +1 -0
- package/src/app/assets/flags/BO.svg +1 -0
- package/src/app/assets/flags/BQ-BO.svg +1 -0
- package/src/app/assets/flags/BQ-SA.svg +1 -0
- package/src/app/assets/flags/BQ-SE.svg +1 -0
- package/src/app/assets/flags/BQ.svg +1 -0
- package/src/app/assets/flags/BR.svg +1 -0
- package/src/app/assets/flags/BS.svg +1 -0
- package/src/app/assets/flags/BT.svg +1 -0
- package/src/app/assets/flags/BV.svg +1 -0
- package/src/app/assets/flags/BW.svg +1 -0
- package/src/app/assets/flags/BY.svg +1 -0
- package/src/app/assets/flags/BZ.svg +1 -0
- package/src/app/assets/flags/CA.svg +1 -0
- package/src/app/assets/flags/CC.svg +1 -0
- package/src/app/assets/flags/CD.svg +1 -0
- package/src/app/assets/flags/CF.svg +1 -0
- package/src/app/assets/flags/CG.svg +1 -0
- package/src/app/assets/flags/CH.svg +1 -0
- package/src/app/assets/flags/CI.svg +1 -0
- package/src/app/assets/flags/CK.svg +1 -0
- package/src/app/assets/flags/CL.svg +1 -0
- package/src/app/assets/flags/CM.svg +1 -0
- package/src/app/assets/flags/CN.svg +1 -0
- package/src/app/assets/flags/CO.svg +1 -0
- package/src/app/assets/flags/CR.svg +1 -0
- package/src/app/assets/flags/CU.svg +1 -0
- package/src/app/assets/flags/CV.svg +1 -0
- package/src/app/assets/flags/CW.svg +1 -0
- package/src/app/assets/flags/CX.svg +1 -0
- package/src/app/assets/flags/CY.svg +1 -0
- package/src/app/assets/flags/CZ.svg +1 -0
- package/src/app/assets/flags/DE.svg +1 -0
- package/src/app/assets/flags/DJ.svg +1 -0
- package/src/app/assets/flags/DK.svg +1 -0
- package/src/app/assets/flags/DM.svg +1 -0
- package/src/app/assets/flags/DO.svg +1 -0
- package/src/app/assets/flags/DZ.svg +1 -0
- package/src/app/assets/flags/EC.svg +1 -0
- package/src/app/assets/flags/EE.svg +1 -0
- package/src/app/assets/flags/EG.svg +1 -0
- package/src/app/assets/flags/EH.svg +1 -0
- package/src/app/assets/flags/ER.svg +1 -0
- package/src/app/assets/flags/ES-CT.svg +1 -0
- package/src/app/assets/flags/ES.svg +1 -0
- package/src/app/assets/flags/ET.svg +1 -0
- package/src/app/assets/flags/EU.svg +1 -0
- package/src/app/assets/flags/FI.svg +1 -0
- package/src/app/assets/flags/FJ.svg +1 -0
- package/src/app/assets/flags/FK.svg +1 -0
- package/src/app/assets/flags/FM.svg +1 -0
- package/src/app/assets/flags/FO.svg +1 -0
- package/src/app/assets/flags/FR.svg +1 -0
- package/src/app/assets/flags/GA.svg +1 -0
- package/src/app/assets/flags/GB-ENG.svg +1 -0
- package/src/app/assets/flags/GB-NIR.svg +1 -0
- package/src/app/assets/flags/GB-SCT.svg +1 -0
- package/src/app/assets/flags/GB-WLS.svg +1 -0
- package/src/app/assets/flags/GB.svg +1 -0
- package/src/app/assets/flags/GD.svg +1 -0
- package/src/app/assets/flags/GE.svg +1 -0
- package/src/app/assets/flags/GF.svg +1 -0
- package/src/app/assets/flags/GG.svg +1 -0
- package/src/app/assets/flags/GH.svg +1 -0
- package/src/app/assets/flags/GI.svg +1 -0
- package/src/app/assets/flags/GL.svg +1 -0
- package/src/app/assets/flags/GM.svg +1 -0
- package/src/app/assets/flags/GN.svg +1 -0
- package/src/app/assets/flags/GP.svg +1 -0
- package/src/app/assets/flags/GQ.svg +1 -0
- package/src/app/assets/flags/GR.svg +1 -0
- package/src/app/assets/flags/GS.svg +1 -0
- package/src/app/assets/flags/GT.svg +1 -0
- package/src/app/assets/flags/GU.svg +1 -0
- package/src/app/assets/flags/GW.svg +1 -0
- package/src/app/assets/flags/GY.svg +1 -0
- package/src/app/assets/flags/HK.svg +1 -0
- package/src/app/assets/flags/HM.svg +1 -0
- package/src/app/assets/flags/HN.svg +1 -0
- package/src/app/assets/flags/HR.svg +1 -0
- package/src/app/assets/flags/HT.svg +1 -0
- package/src/app/assets/flags/HU.svg +1 -0
- package/src/app/assets/flags/IC.svg +1 -0
- package/src/app/assets/flags/ID.svg +1 -0
- package/src/app/assets/flags/IE.svg +1 -0
- package/src/app/assets/flags/IL.svg +1 -0
- package/src/app/assets/flags/IM.svg +1 -0
- package/src/app/assets/flags/IN.svg +1 -0
- package/src/app/assets/flags/IO.svg +1 -0
- package/src/app/assets/flags/IQ.svg +1 -0
- package/src/app/assets/flags/IR.svg +1 -0
- package/src/app/assets/flags/IS.svg +1 -0
- package/src/app/assets/flags/IT.svg +1 -0
- package/src/app/assets/flags/JE.svg +1 -0
- package/src/app/assets/flags/JM.svg +1 -0
- package/src/app/assets/flags/JO.svg +1 -0
- package/src/app/assets/flags/JP.svg +1 -0
- package/src/app/assets/flags/KE.svg +1 -0
- package/src/app/assets/flags/KG.svg +1 -0
- package/src/app/assets/flags/KH.svg +1 -0
- package/src/app/assets/flags/KI.svg +1 -0
- package/src/app/assets/flags/KM.svg +1 -0
- package/src/app/assets/flags/KN.svg +1 -0
- package/src/app/assets/flags/KP.svg +1 -0
- package/src/app/assets/flags/KR.svg +1 -0
- package/src/app/assets/flags/KW.svg +1 -0
- package/src/app/assets/flags/KY.svg +1 -0
- package/src/app/assets/flags/KZ.svg +1 -0
- package/src/app/assets/flags/LA.svg +1 -0
- package/src/app/assets/flags/LB.svg +1 -0
- package/src/app/assets/flags/LC.svg +1 -0
- package/src/app/assets/flags/LI.svg +1 -0
- package/src/app/assets/flags/LK.svg +1 -0
- package/src/app/assets/flags/LR.svg +1 -0
- package/src/app/assets/flags/LS.svg +1 -0
- package/src/app/assets/flags/LT.svg +1 -0
- package/src/app/assets/flags/LU.svg +1 -0
- package/src/app/assets/flags/LV.svg +1 -0
- package/src/app/assets/flags/LY.svg +1 -0
- package/src/app/assets/flags/MA.svg +1 -0
- package/src/app/assets/flags/MC.svg +1 -0
- package/src/app/assets/flags/MD.svg +1 -0
- package/src/app/assets/flags/ME.svg +1 -0
- package/src/app/assets/flags/MF.svg +1 -0
- package/src/app/assets/flags/MG.svg +1 -0
- package/src/app/assets/flags/MH.svg +1 -0
- package/src/app/assets/flags/MK.svg +1 -0
- package/src/app/assets/flags/ML.svg +1 -0
- package/src/app/assets/flags/MM.svg +1 -0
- package/src/app/assets/flags/MN.svg +1 -0
- package/src/app/assets/flags/MO.svg +1 -0
- package/src/app/assets/flags/MP.svg +1 -0
- package/src/app/assets/flags/MQ.svg +1 -0
- package/src/app/assets/flags/MR.svg +1 -0
- package/src/app/assets/flags/MS.svg +1 -0
- package/src/app/assets/flags/MT.svg +1 -0
- package/src/app/assets/flags/MU.svg +1 -0
- package/src/app/assets/flags/MV.svg +1 -0
- package/src/app/assets/flags/MW.svg +1 -0
- package/src/app/assets/flags/MX.svg +1 -0
- package/src/app/assets/flags/MY.svg +1 -0
- package/src/app/assets/flags/MZ.svg +1 -0
- package/src/app/assets/flags/NA.svg +1 -0
- package/src/app/assets/flags/NC.svg +1 -0
- package/src/app/assets/flags/NE.svg +1 -0
- package/src/app/assets/flags/NF.svg +1 -0
- package/src/app/assets/flags/NG.svg +1 -0
- package/src/app/assets/flags/NI.svg +1 -0
- package/src/app/assets/flags/NL.svg +1 -0
- package/src/app/assets/flags/NO.svg +1 -0
- package/src/app/assets/flags/NP.svg +1 -0
- package/src/app/assets/flags/NR.svg +1 -0
- package/src/app/assets/flags/NU.svg +1 -0
- package/src/app/assets/flags/NZ.svg +1 -0
- package/src/app/assets/flags/OM.svg +1 -0
- package/src/app/assets/flags/PA.svg +1 -0
- package/src/app/assets/flags/PE.svg +1 -0
- package/src/app/assets/flags/PF.svg +1 -0
- package/src/app/assets/flags/PG.svg +1 -0
- package/src/app/assets/flags/PH.svg +1 -0
- package/src/app/assets/flags/PK.svg +1 -0
- package/src/app/assets/flags/PL.svg +1 -0
- package/src/app/assets/flags/PM.svg +1 -0
- package/src/app/assets/flags/PN.svg +1 -0
- package/src/app/assets/flags/PR.svg +1 -0
- package/src/app/assets/flags/PS.svg +1 -0
- package/src/app/assets/flags/PT.svg +1 -0
- package/src/app/assets/flags/PW.svg +1 -0
- package/src/app/assets/flags/PY.svg +1 -0
- package/src/app/assets/flags/QA.svg +1 -0
- package/src/app/assets/flags/RE.svg +1 -0
- package/src/app/assets/flags/README.md +6 -0
- package/src/app/assets/flags/RO.svg +1 -0
- package/src/app/assets/flags/RS.svg +1 -0
- package/src/app/assets/flags/RU.svg +1 -0
- package/src/app/assets/flags/RW.svg +1 -0
- package/src/app/assets/flags/SA.svg +1 -0
- package/src/app/assets/flags/SB.svg +1 -0
- package/src/app/assets/flags/SC.svg +1 -0
- package/src/app/assets/flags/SD.svg +1 -0
- package/src/app/assets/flags/SE.svg +1 -0
- package/src/app/assets/flags/SG.svg +1 -0
- package/src/app/assets/flags/SH.svg +1 -0
- package/src/app/assets/flags/SI.svg +1 -0
- package/src/app/assets/flags/SJ.svg +1 -0
- package/src/app/assets/flags/SK.svg +1 -0
- package/src/app/assets/flags/SL.svg +1 -0
- package/src/app/assets/flags/SM.svg +1 -0
- package/src/app/assets/flags/SN.svg +1 -0
- package/src/app/assets/flags/SO.svg +1 -0
- package/src/app/assets/flags/SR.svg +1 -0
- package/src/app/assets/flags/SS.svg +1 -0
- package/src/app/assets/flags/ST.svg +1 -0
- package/src/app/assets/flags/SV.svg +1 -0
- package/src/app/assets/flags/SX.svg +1 -0
- package/src/app/assets/flags/SY.svg +1 -0
- package/src/app/assets/flags/SZ.svg +1 -0
- package/src/app/assets/flags/TA.svg +1 -0
- package/src/app/assets/flags/TC.svg +1 -0
- package/src/app/assets/flags/TD.svg +1 -0
- package/src/app/assets/flags/TF.svg +1 -0
- package/src/app/assets/flags/TG.svg +1 -0
- package/src/app/assets/flags/TH.svg +1 -0
- package/src/app/assets/flags/TJ.svg +1 -0
- package/src/app/assets/flags/TK.svg +1 -0
- package/src/app/assets/flags/TL.svg +1 -0
- package/src/app/assets/flags/TM.svg +1 -0
- package/src/app/assets/flags/TN.svg +1 -0
- package/src/app/assets/flags/TO.svg +1 -0
- package/src/app/assets/flags/TR.svg +1 -0
- package/src/app/assets/flags/TT.svg +1 -0
- package/src/app/assets/flags/TV.svg +1 -0
- package/src/app/assets/flags/TW.svg +1 -0
- package/src/app/assets/flags/TZ.svg +1 -0
- package/src/app/assets/flags/UA.svg +1 -0
- package/src/app/assets/flags/UG.svg +1 -0
- package/src/app/assets/flags/UM.svg +1 -0
- package/src/app/assets/flags/US.svg +1 -0
- package/src/app/assets/flags/UY.svg +1 -0
- package/src/app/assets/flags/UZ.svg +1 -0
- package/src/app/assets/flags/VA.svg +1 -0
- package/src/app/assets/flags/VC.svg +1 -0
- package/src/app/assets/flags/VE.svg +1 -0
- package/src/app/assets/flags/VG.svg +1 -0
- package/src/app/assets/flags/VI.svg +1 -0
- package/src/app/assets/flags/VN.svg +1 -0
- package/src/app/assets/flags/VU.svg +1 -0
- package/src/app/assets/flags/WF.svg +1 -0
- package/src/app/assets/flags/WS.svg +1 -0
- package/src/app/assets/flags/XA.svg +1 -0
- package/src/app/assets/flags/XC.svg +1 -0
- package/src/app/assets/flags/XK.svg +1 -0
- package/src/app/assets/flags/XO.svg +1 -0
- package/src/app/assets/flags/YE.svg +1 -0
- package/src/app/assets/flags/YT.svg +1 -0
- package/src/app/assets/flags/ZA.svg +1 -0
- package/src/app/assets/flags/ZM.svg +1 -0
- package/src/app/assets/flags/ZW.svg +1 -0
- package/src/app/email-preview.ts +46 -0
- package/src/app/index.css +203 -0
- package/src/app/index.html +12 -0
- package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
- package/src/app/integrations/i18n/root-provider.tsx +62 -0
- package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
- package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
- package/src/app/integrations/theme/root-provider.tsx +75 -0
- package/src/app/integrations/toast/toast-provider.tsx +46 -0
- package/src/app/locales/en-US/common.ts +268 -0
- package/src/app/locales/zh-CN/common.ts +263 -0
- package/src/app/main.tsx +40 -0
- package/src/app/page-chrome.tsx +79 -0
- package/src/app/router.tsx +40 -0
- package/src/app/routes/__root.tsx +293 -0
- package/src/app/routes/emails.tsx +199 -0
- package/src/app/routes/home.tsx +87 -0
- package/src/app/routes/index.ts +19 -0
- package/src/app/routes/metrics.tsx +541 -0
- package/src/app/routes/segment-overview.tsx +211 -0
- package/src/app/routes/segments.tsx +236 -0
- package/src/app/routes/settings.tsx +90 -0
- package/src/app/routes/workflows.tsx +348 -0
- package/src/app/studio.ts +16 -0
- package/src/app/svg.d.ts +17 -0
- package/src/app/virtual-config.d.ts +6 -0
- package/src/cli.ts +110 -0
- package/src/components/avatar.tsx +57 -0
- package/src/components/breadcrumb.tsx +49 -0
- package/src/components/button/index.tsx +86 -0
- package/src/components/channel-icon.ts +39 -0
- package/src/components/chat-markup.tsx +109 -0
- package/src/components/corner-shape.ts +13 -0
- package/src/components/date-range.tsx +181 -0
- package/src/components/discord-preview.tsx +165 -0
- package/src/components/dropdown/index.tsx +172 -0
- package/src/components/email-defaults.tsx +40 -0
- package/src/components/email-list.tsx +149 -0
- package/src/components/email-thumbnail.tsx +123 -0
- package/src/components/flag.tsx +40 -0
- package/src/components/input/index.tsx +40 -0
- package/src/components/input/search-input.tsx +24 -0
- package/src/components/layout.ts +403 -0
- package/src/components/menu/index.tsx +118 -0
- package/src/components/metric-card.tsx +321 -0
- package/src/components/modal/index.tsx +70 -0
- package/src/components/nav-drawer.tsx +84 -0
- package/src/components/node-inspector.tsx +242 -0
- package/src/components/profile-drawer.tsx +331 -0
- package/src/components/push-preview.tsx +470 -0
- package/src/components/push-thumbnail.tsx +78 -0
- package/src/components/segment-list.tsx +184 -0
- package/src/components/select/index.tsx +70 -0
- package/src/components/series-chart.tsx +120 -0
- package/src/components/slack-preview.tsx +223 -0
- package/src/components/sparkline.tsx +58 -0
- package/src/components/tabs/index.tsx +45 -0
- package/src/components/template-refs.ts +110 -0
- package/src/components/templates-page.tsx +601 -0
- package/src/components/textarea/index.tsx +37 -0
- package/src/components/thumbnail-window.tsx +65 -0
- package/src/components/workflow-canvas.tsx +503 -0
- package/src/components/workflow-list.tsx +231 -0
- package/src/config.ts +288 -0
- package/src/generate.ts +56 -0
- package/src/index.ts +35 -0
- package/src/postgres.ts +415 -0
- package/src/server/project.ts +290 -0
- package/src/server.ts +500 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/label.ts +12 -0
- package/src/utils/lookup.ts +11 -0
- package/src/utils/template-content.ts +213 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { createRoute } from '@tanstack/react-router';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Avatar } from '../../components/avatar';
|
|
6
|
+
import { superellipse } from '../../components/corner-shape';
|
|
7
|
+
import { ProfileDrawer } from '../../components/profile-drawer';
|
|
8
|
+
import { SeriesChart } from '../../components/series-chart';
|
|
9
|
+
import type { Profile } from '../../config';
|
|
10
|
+
import { segmentDetailRoute } from './segments';
|
|
11
|
+
|
|
12
|
+
const PAGE_SIZE = 25;
|
|
13
|
+
|
|
14
|
+
const number = (value: number) => value.toLocaleString();
|
|
15
|
+
|
|
16
|
+
/** ISO timestamp → a date; the clock time is noise in a list this dense. */
|
|
17
|
+
const day = (iso: string | undefined) => (iso === undefined ? '—' : iso.slice(0, 10));
|
|
18
|
+
|
|
19
|
+
function Stat({ label, value }: { label: string; value: string }) {
|
|
20
|
+
return (
|
|
21
|
+
<div className="border-border bg-card rounded-2xl border px-4 py-3" style={superellipse}>
|
|
22
|
+
<div className="text-muted text-xs">{label}</div>
|
|
23
|
+
<div className="mt-1 text-xl font-semibold tabular-nums">{value}</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A segment's Overview: how big it is and how that has moved, then who is
|
|
30
|
+
* actually in it. The chart answers "is this condition matching the population
|
|
31
|
+
* I meant"; the table is how you check that by looking at real people.
|
|
32
|
+
*/
|
|
33
|
+
function SegmentOverview() {
|
|
34
|
+
const { id } = segmentDetailRoute.useParams();
|
|
35
|
+
const { config } = segmentDetailRoute.useRouteContext();
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
|
|
38
|
+
const [page, setPage] = useState(0);
|
|
39
|
+
const [selected, setSelected] = useState<Profile | undefined>(undefined);
|
|
40
|
+
|
|
41
|
+
const { data: reports } = useQuery({
|
|
42
|
+
queryKey: ['segment-reports'],
|
|
43
|
+
queryFn: async () => (await config.stats?.segments?.()) ?? [],
|
|
44
|
+
enabled: config.stats?.segments !== undefined,
|
|
45
|
+
});
|
|
46
|
+
const report = reports?.find((row) => row.id === id);
|
|
47
|
+
|
|
48
|
+
const { data: profilePage, isPending } = useQuery({
|
|
49
|
+
queryKey: ['segment-profiles', id, page],
|
|
50
|
+
queryFn: async () =>
|
|
51
|
+
(await config.stats?.profiles?.(id, { limit: PAGE_SIZE, offset: page * PAGE_SIZE })) ?? {
|
|
52
|
+
profiles: [],
|
|
53
|
+
total: 0,
|
|
54
|
+
},
|
|
55
|
+
enabled: config.stats?.profiles !== undefined,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const series = report?.series ?? [];
|
|
59
|
+
const first = series.at(0);
|
|
60
|
+
const last = series.at(-1);
|
|
61
|
+
const change =
|
|
62
|
+
first !== undefined && last !== undefined && first !== 0
|
|
63
|
+
? ((last - first) / first) * 100
|
|
64
|
+
: undefined;
|
|
65
|
+
|
|
66
|
+
const total = profilePage?.total ?? 0;
|
|
67
|
+
const lastPage = Math.max(0, Math.ceil(total / PAGE_SIZE) - 1);
|
|
68
|
+
|
|
69
|
+
if (config.stats?.segments === undefined && config.stats?.profiles === undefined) {
|
|
70
|
+
return (
|
|
71
|
+
<div className="flex flex-1 items-center justify-center p-8">
|
|
72
|
+
<div
|
|
73
|
+
className="border-border bg-card max-w-md rounded-2xl border border-dashed p-8 text-center"
|
|
74
|
+
style={superellipse}
|
|
75
|
+
>
|
|
76
|
+
<p className="text-sm font-medium">{t('segments.noSource')}</p>
|
|
77
|
+
<p className="text-muted mt-2 text-sm">{t('segments.noSourceHint')}</p>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
/* The drawer is fixed to the viewport, so it can sit outside the flow here
|
|
85
|
+
while the page itself scrolls in the shell's one scrollport. */
|
|
86
|
+
<>
|
|
87
|
+
<div className="flex-1 p-6">
|
|
88
|
+
<div className="grid grid-cols-2 gap-3 md:grid-cols-3">
|
|
89
|
+
<Stat label={t('segments.size')} value={report ? number(report.size) : '—'} />
|
|
90
|
+
<Stat
|
|
91
|
+
label={t('segments.change')}
|
|
92
|
+
value={change === undefined ? '—' : `${change >= 0 ? '+' : ''}${change.toFixed(1)}%`}
|
|
93
|
+
/>
|
|
94
|
+
<Stat label={t('segments.profiles')} value={total > 0 ? number(total) : '—'} />
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<section className="border-border bg-card mt-6 rounded-2xl border p-5" style={superellipse}>
|
|
98
|
+
<h2 className="text-sm font-semibold">{t('segments.overTime')}</h2>
|
|
99
|
+
{series.length > 1 ? (
|
|
100
|
+
<div className="mt-4">
|
|
101
|
+
<SeriesChart values={series} ariaLabel={t('segments.overTime')} />
|
|
102
|
+
</div>
|
|
103
|
+
) : (
|
|
104
|
+
<p className="text-muted mt-6 text-sm">{t('segments.noData')}</p>
|
|
105
|
+
)}
|
|
106
|
+
</section>
|
|
107
|
+
|
|
108
|
+
{/* No `overflow-hidden`: it would clip the corners for free, but any
|
|
109
|
+
overflow value turns a card into a scrollport, which is the habit
|
|
110
|
+
this layout is getting rid of. The last row re-cuts its own. */}
|
|
111
|
+
<section className="border-border bg-card mt-6 rounded-2xl border" style={superellipse}>
|
|
112
|
+
<div className="border-border flex items-center justify-between border-b px-5 py-3">
|
|
113
|
+
<h2 className="text-sm font-semibold">{t('segments.members')}</h2>
|
|
114
|
+
{total > PAGE_SIZE && (
|
|
115
|
+
<div className="text-muted flex items-center gap-2 text-xs">
|
|
116
|
+
<span className="tabular-nums">
|
|
117
|
+
{number(page * PAGE_SIZE + 1)}–{number(Math.min((page + 1) * PAGE_SIZE, total))} /{' '}
|
|
118
|
+
{number(total)}
|
|
119
|
+
</span>
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
disabled={page === 0}
|
|
123
|
+
onClick={() => setPage((current) => current - 1)}
|
|
124
|
+
className="hover:bg-hover rounded px-2 py-1 transition-colors disabled:opacity-40"
|
|
125
|
+
>
|
|
126
|
+
{t('common.previous')}
|
|
127
|
+
</button>
|
|
128
|
+
<button
|
|
129
|
+
type="button"
|
|
130
|
+
disabled={page >= lastPage}
|
|
131
|
+
onClick={() => setPage((current) => current + 1)}
|
|
132
|
+
className="hover:bg-hover rounded px-2 py-1 transition-colors disabled:opacity-40"
|
|
133
|
+
>
|
|
134
|
+
{t('common.next')}
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
{isPending ? (
|
|
141
|
+
<p className="text-muted p-5 text-sm">{t('common.loading')}</p>
|
|
142
|
+
) : profilePage === undefined || profilePage.profiles.length === 0 ? (
|
|
143
|
+
<p className="text-muted p-5 text-sm">{t('segments.noProfiles')}</p>
|
|
144
|
+
) : (
|
|
145
|
+
<table className="w-full table-fixed border-separate border-spacing-0 text-sm">
|
|
146
|
+
<thead>
|
|
147
|
+
<tr className="text-muted text-left text-xs font-medium">
|
|
148
|
+
<th className="border-border border-b px-5 py-2">{t('profiles.email')}</th>
|
|
149
|
+
<th className="border-border w-56 border-b px-5 py-2">
|
|
150
|
+
{t('profiles.utmSource')}
|
|
151
|
+
</th>
|
|
152
|
+
<th className="border-border w-36 border-b px-5 py-2 whitespace-nowrap">
|
|
153
|
+
{t('profiles.createdAt')}
|
|
154
|
+
</th>
|
|
155
|
+
</tr>
|
|
156
|
+
</thead>
|
|
157
|
+
<tbody>
|
|
158
|
+
{profilePage.profiles.map((profile) => (
|
|
159
|
+
<tr
|
|
160
|
+
key={profile.id}
|
|
161
|
+
onClick={() => setSelected(profile)}
|
|
162
|
+
/* The section already draws a rounded edge; a row border on
|
|
163
|
+
top of it reads as a doubled line. The hover fill sits on
|
|
164
|
+
the cells so the last row's corners can follow the card's
|
|
165
|
+
— a row box paints below any cell radius. */
|
|
166
|
+
className="hover:[&>td]:bg-hover cursor-pointer [&>td]:transition-colors last:[&>td]:border-b-0 last:[&>td:first-child]:rounded-bl-2xl last:[&>td:last-child]:rounded-br-2xl"
|
|
167
|
+
style={superellipse}
|
|
168
|
+
>
|
|
169
|
+
<td className="border-border border-b px-5 py-2.5" style={superellipse}>
|
|
170
|
+
{/* The avatar is fixed-width, so the address does the
|
|
171
|
+
truncating — `truncate` on the cell itself would be
|
|
172
|
+
undone by the flex row inside it. */}
|
|
173
|
+
<div className="flex items-center gap-2.5">
|
|
174
|
+
<Avatar
|
|
175
|
+
picture={profile.properties?.picture}
|
|
176
|
+
label={profile.email ?? profile.id}
|
|
177
|
+
size="sm"
|
|
178
|
+
/>
|
|
179
|
+
<span className="truncate">{profile.email ?? '—'}</span>
|
|
180
|
+
</div>
|
|
181
|
+
</td>
|
|
182
|
+
<td className="border-border text-muted truncate border-b px-5 py-2.5 font-mono text-sm">
|
|
183
|
+
{/* Out of a dictionary of unknowns, so anything but a string reads as absent. */}
|
|
184
|
+
{typeof profile.properties?.utm_source === 'string'
|
|
185
|
+
? profile.properties.utm_source
|
|
186
|
+
: '—'}
|
|
187
|
+
</td>
|
|
188
|
+
<td
|
|
189
|
+
className="border-border text-muted border-b px-5 py-2.5 whitespace-nowrap tabular-nums"
|
|
190
|
+
style={superellipse}
|
|
191
|
+
>
|
|
192
|
+
{day(profile.createdAt)}
|
|
193
|
+
</td>
|
|
194
|
+
</tr>
|
|
195
|
+
))}
|
|
196
|
+
</tbody>
|
|
197
|
+
</table>
|
|
198
|
+
)}
|
|
199
|
+
</section>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<ProfileDrawer profile={selected} onClose={() => setSelected(undefined)} />
|
|
203
|
+
</>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const segmentOverviewRoute = createRoute({
|
|
208
|
+
getParentRoute: () => segmentDetailRoute,
|
|
209
|
+
path: '/',
|
|
210
|
+
component: SegmentOverview,
|
|
211
|
+
});
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { ConditionIR, WorkflowIR } from '@shware/workflow';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { Outlet, createRoute, useNavigate } from '@tanstack/react-router';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Breadcrumb } from '../../components/breadcrumb';
|
|
7
|
+
import { SearchInput } from '../../components/input/search-input';
|
|
8
|
+
import { SegmentList } from '../../components/segment-list';
|
|
9
|
+
import { displayName } from '../../utils/label';
|
|
10
|
+
import { PageChrome } from '../page-chrome';
|
|
11
|
+
import { Route as rootRoute } from './__root';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Segments referenced by these workflows, derived from IR the same way the
|
|
15
|
+
* email list is — so a segment used in a condition but never passed to the
|
|
16
|
+
* config is visible rather than silently missing.
|
|
17
|
+
*/
|
|
18
|
+
export function collectSegmentRefs(irs: WorkflowIR[]): { id: string; usedBy: string[] }[] {
|
|
19
|
+
const byName = new Map<string, Set<string>>();
|
|
20
|
+
|
|
21
|
+
const walkCondition = (condition: ConditionIR | undefined, workflow: string) => {
|
|
22
|
+
if (condition === undefined) return;
|
|
23
|
+
switch (condition.type) {
|
|
24
|
+
case 'segment': {
|
|
25
|
+
const set = byName.get(condition.segment) ?? new Set();
|
|
26
|
+
set.add(workflow);
|
|
27
|
+
byName.set(condition.segment, set);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 'and':
|
|
31
|
+
case 'or':
|
|
32
|
+
for (const child of condition.conditions) walkCondition(child, workflow);
|
|
33
|
+
break;
|
|
34
|
+
case 'not':
|
|
35
|
+
walkCondition(condition.condition, workflow);
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const walkNodes = (nodes: WorkflowIR['flow'], workflow: string) => {
|
|
43
|
+
for (const node of nodes) {
|
|
44
|
+
if (node.type === 'branch') {
|
|
45
|
+
for (const branchCase of node.cases) {
|
|
46
|
+
walkCondition(branchCase.condition, workflow);
|
|
47
|
+
walkNodes(branchCase.flow, workflow);
|
|
48
|
+
}
|
|
49
|
+
if (node.otherwise) walkNodes(node.otherwise, workflow);
|
|
50
|
+
}
|
|
51
|
+
if (node.type === 'filter') walkCondition(node.condition, workflow);
|
|
52
|
+
if (node.type === 'wait_until') {
|
|
53
|
+
walkCondition(node.condition, workflow);
|
|
54
|
+
if (Array.isArray(node.onTimeout)) walkNodes(node.onTimeout, workflow);
|
|
55
|
+
}
|
|
56
|
+
if (node.type === 'cohort') for (const arm of node.arms) walkNodes(arm.flow, workflow);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
for (const ir of irs) {
|
|
61
|
+
if (ir.trigger.type === 'segment') {
|
|
62
|
+
const set = byName.get(ir.trigger.segment) ?? new Set();
|
|
63
|
+
set.add(ir.id);
|
|
64
|
+
byName.set(ir.trigger.segment, set);
|
|
65
|
+
}
|
|
66
|
+
if (ir.trigger.type === 'event') walkCondition(ir.trigger.filter, ir.id);
|
|
67
|
+
walkCondition(ir.goal?.condition, ir.id);
|
|
68
|
+
walkCondition(ir.exitWhen, ir.id);
|
|
69
|
+
walkNodes(ir.flow, ir.id);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return [...byName.entries()]
|
|
73
|
+
.map(([id, usedBy]) => ({ id, usedBy: [...usedBy] }))
|
|
74
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Every segment the studio shows: each deployed one — referenced by a workflow or not, since a
|
|
79
|
+
* segment is an audience worth watching on its own — plus each one a workflow references without
|
|
80
|
+
* it being deployed (shown as not defined). The IR only adds who uses it.
|
|
81
|
+
*/
|
|
82
|
+
export function collectSegments(
|
|
83
|
+
irs: WorkflowIR[],
|
|
84
|
+
deployed: readonly { id: string }[]
|
|
85
|
+
): { id: string; usedBy: string[] }[] {
|
|
86
|
+
const byId = new Map(collectSegmentRefs(irs).map((ref) => [ref.id, ref]));
|
|
87
|
+
for (const { id } of deployed) {
|
|
88
|
+
if (!byId.has(id)) byId.set(id, { id, usedBy: [] });
|
|
89
|
+
}
|
|
90
|
+
return [...byId.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function Segments() {
|
|
94
|
+
const { config } = segmentsRoute.useRouteContext();
|
|
95
|
+
const { t } = useTranslation();
|
|
96
|
+
const navigate = useNavigate();
|
|
97
|
+
const [query, setQuery] = useState('');
|
|
98
|
+
|
|
99
|
+
const refs = useMemo(
|
|
100
|
+
() => collectSegments(Object.values(config.workflows), config.segments),
|
|
101
|
+
[config]
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const items = useMemo(() => {
|
|
105
|
+
/** Definitions come from the compiled segments; a reference alone gives only a name. */
|
|
106
|
+
const declared = new Map(config.segments.map((segment) => [segment.id, segment]));
|
|
107
|
+
return refs.map((ref) => {
|
|
108
|
+
const found = declared.get(ref.id);
|
|
109
|
+
return {
|
|
110
|
+
...ref,
|
|
111
|
+
...(found !== undefined ? { definition: found.condition } : {}),
|
|
112
|
+
...(found?.meta?.name !== undefined ? { label: found.meta.name } : {}),
|
|
113
|
+
...(found?.meta?.description !== undefined ? { description: found.meta.description } : {}),
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}, [refs, config]);
|
|
117
|
+
|
|
118
|
+
/* Substring match over everything a segment is known by: key, label, description. */
|
|
119
|
+
const filtered = useMemo(() => {
|
|
120
|
+
const needle = query.trim().toLowerCase();
|
|
121
|
+
if (needle === '') return items;
|
|
122
|
+
return items.filter((item) =>
|
|
123
|
+
[item.id, item.label ?? '', item.description ?? ''].some((text) =>
|
|
124
|
+
text.toLowerCase().includes(needle)
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
}, [items, query]);
|
|
128
|
+
|
|
129
|
+
const { data: reports } = useQuery({
|
|
130
|
+
queryKey: ['segment-reports'],
|
|
131
|
+
queryFn: async () => (await config.stats?.segments?.()) ?? [],
|
|
132
|
+
enabled: config.stats?.segments !== undefined,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
if (refs.length === 0) {
|
|
136
|
+
return (
|
|
137
|
+
<div className="text-muted flex flex-1 items-center justify-center text-sm">
|
|
138
|
+
{t('segments.empty')}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
/* Nothing here scrolls: the shell's content column is the one scrollport. */
|
|
145
|
+
<div className="flex-1">
|
|
146
|
+
<PageChrome breadcrumb={<Breadcrumb items={[{ label: t('nav.segments') }]} />} />
|
|
147
|
+
{/*
|
|
148
|
+
The search field belongs with what it filters, not up in the chrome.
|
|
149
|
+
It scrolls away with the list: only the app header pins, and a stack
|
|
150
|
+
of three fixed bars over a short list was more chrome than content.
|
|
151
|
+
*/}
|
|
152
|
+
<div className="px-6 pt-4 pb-3">
|
|
153
|
+
<SearchInput
|
|
154
|
+
className="w-72"
|
|
155
|
+
placeholder={t('segments.searchPlaceholder')}
|
|
156
|
+
value={query}
|
|
157
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
<div className="px-6 pb-6">
|
|
161
|
+
{filtered.length === 0 ? (
|
|
162
|
+
<div className="text-muted flex items-center justify-center py-24 text-sm">
|
|
163
|
+
{t('segments.noMatches', { query: query.trim() })}
|
|
164
|
+
</div>
|
|
165
|
+
) : (
|
|
166
|
+
<SegmentList
|
|
167
|
+
items={filtered}
|
|
168
|
+
{...(reports !== undefined ? { reports } : {})}
|
|
169
|
+
onOpen={(id) => void navigate({ to: '/segments/$id', params: { id } })}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const segmentsRoute = createRoute({
|
|
178
|
+
getParentRoute: () => rootRoute,
|
|
179
|
+
path: '/segments',
|
|
180
|
+
component: Segments,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
/* ------------------------------- Detail shell ------------------------------ */
|
|
184
|
+
|
|
185
|
+
function SegmentDetail() {
|
|
186
|
+
const { id } = segmentDetailRoute.useParams();
|
|
187
|
+
const { config } = segmentDetailRoute.useRouteContext();
|
|
188
|
+
const { t } = useTranslation();
|
|
189
|
+
|
|
190
|
+
/* Switcher options: every segment the workflows reference, like the list page. */
|
|
191
|
+
const options = useMemo(() => {
|
|
192
|
+
const declared = new Map(config.segments.map((segment) => [segment.id, segment]));
|
|
193
|
+
const refs = collectSegments(Object.values(config.workflows), config.segments);
|
|
194
|
+
return refs.map((ref) => ({
|
|
195
|
+
value: ref.id,
|
|
196
|
+
label: displayName(declared.get(ref.id)?.meta?.name, ref.id),
|
|
197
|
+
}));
|
|
198
|
+
}, [config]);
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* The header is the root's: breadcrumb with the segment switcher as its
|
|
202
|
+
* leaf. No tab strip — there is exactly one view here, and a strip of one
|
|
203
|
+
* tab is a control that can never do anything. The breadcrumb still ends in
|
|
204
|
+
* the view's name, which is what keeps this page the same shape as the
|
|
205
|
+
* workflow detail page, where the tabs are real.
|
|
206
|
+
*/
|
|
207
|
+
return (
|
|
208
|
+
<div className="flex flex-1 flex-col">
|
|
209
|
+
<PageChrome
|
|
210
|
+
breadcrumb={
|
|
211
|
+
<Breadcrumb
|
|
212
|
+
items={[
|
|
213
|
+
{ label: t('nav.segments'), to: '/segments' },
|
|
214
|
+
{
|
|
215
|
+
label: options.find((option) => option.value === id)?.label ?? id,
|
|
216
|
+
to: '/segments/$id',
|
|
217
|
+
params: { id },
|
|
218
|
+
},
|
|
219
|
+
{ label: t('segments.tabs.overview') },
|
|
220
|
+
]}
|
|
221
|
+
/>
|
|
222
|
+
}
|
|
223
|
+
/>
|
|
224
|
+
|
|
225
|
+
<div className="flex flex-1 flex-col">
|
|
226
|
+
<Outlet />
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export const segmentDetailRoute = createRoute({
|
|
233
|
+
getParentRoute: () => rootRoute,
|
|
234
|
+
path: '/segments/$id',
|
|
235
|
+
component: SegmentDetail,
|
|
236
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createRoute } from '@tanstack/react-router';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Breadcrumb } from '../../components/breadcrumb';
|
|
4
|
+
import { Button } from '../../components/button';
|
|
5
|
+
import { superellipse } from '../../components/corner-shape';
|
|
6
|
+
import { EmailDefaults } from '../../components/email-defaults';
|
|
7
|
+
import {
|
|
8
|
+
type SupportedLng,
|
|
9
|
+
languageNames,
|
|
10
|
+
supportedLngs,
|
|
11
|
+
} from '../integrations/i18n/root-provider';
|
|
12
|
+
import { type Theme, themes, useTheme } from '../integrations/theme/root-provider';
|
|
13
|
+
import { PageChrome } from '../page-chrome';
|
|
14
|
+
import { Route as rootRoute } from './__root';
|
|
15
|
+
|
|
16
|
+
function Settings() {
|
|
17
|
+
const { config } = settingsRoute.useRouteContext();
|
|
18
|
+
const { t, i18n } = useTranslation();
|
|
19
|
+
const { theme, setTheme } = useTheme();
|
|
20
|
+
|
|
21
|
+
const current = supportedLngs.find((lng) => i18n.resolvedLanguage === lng) ?? 'en-US';
|
|
22
|
+
const sources = (['reports', 'nodeStats', 'metrics'] as const).filter(
|
|
23
|
+
(key) => config.stats?.[key] !== undefined
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
/* No scroll container of its own: the shell's content column is the only one. */
|
|
28
|
+
<div className="flex-1 p-6">
|
|
29
|
+
<PageChrome breadcrumb={<Breadcrumb items={[{ label: t('nav.settings') }]} />} />
|
|
30
|
+
|
|
31
|
+
<section
|
|
32
|
+
className="border-border bg-card mt-5 max-w-xl rounded-2xl border p-5"
|
|
33
|
+
style={superellipse}
|
|
34
|
+
>
|
|
35
|
+
<h2 className="text-sm font-medium">{t('settings.language')}</h2>
|
|
36
|
+
<p className="text-muted mt-1 text-xs">{t('settings.languageHint')}</p>
|
|
37
|
+
<div className="mt-3 flex gap-2">
|
|
38
|
+
{supportedLngs.map((lng: SupportedLng) => (
|
|
39
|
+
<Button
|
|
40
|
+
key={lng}
|
|
41
|
+
size="sm"
|
|
42
|
+
variant={current === lng ? 'default' : 'secondary'}
|
|
43
|
+
onClick={() => void i18n.changeLanguage(lng)}
|
|
44
|
+
>
|
|
45
|
+
{languageNames[lng]}
|
|
46
|
+
</Button>
|
|
47
|
+
))}
|
|
48
|
+
</div>
|
|
49
|
+
</section>
|
|
50
|
+
|
|
51
|
+
<section
|
|
52
|
+
className="border-border bg-card mt-4 max-w-xl rounded-2xl border p-5"
|
|
53
|
+
style={superellipse}
|
|
54
|
+
>
|
|
55
|
+
<h2 className="text-sm font-medium">{t('settings.theme')}</h2>
|
|
56
|
+
<p className="text-muted mt-1 text-xs">{t('settings.themeHint')}</p>
|
|
57
|
+
<div className="mt-3 flex gap-2">
|
|
58
|
+
{themes.map((option: Theme) => (
|
|
59
|
+
<Button
|
|
60
|
+
key={option}
|
|
61
|
+
size="sm"
|
|
62
|
+
variant={theme === option ? 'default' : 'secondary'}
|
|
63
|
+
onClick={() => setTheme(option)}
|
|
64
|
+
>
|
|
65
|
+
{t(`settings.themes.${option}`)}
|
|
66
|
+
</Button>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
</section>
|
|
70
|
+
|
|
71
|
+
<EmailDefaults from={config.emailDefaults.from} replyTo={config.emailDefaults.replyTo} />
|
|
72
|
+
|
|
73
|
+
<section
|
|
74
|
+
className="border-border bg-card mt-4 max-w-xl rounded-2xl border p-5"
|
|
75
|
+
style={superellipse}
|
|
76
|
+
>
|
|
77
|
+
<h2 className="text-sm font-medium">{t('settings.statsSource')}</h2>
|
|
78
|
+
<p className="text-secondary mt-2 font-mono text-xs">
|
|
79
|
+
{sources.length > 0 ? sources.join(', ') : t('common.notConfigured')}
|
|
80
|
+
</p>
|
|
81
|
+
</section>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const settingsRoute = createRoute({
|
|
87
|
+
getParentRoute: () => rootRoute,
|
|
88
|
+
path: '/settings',
|
|
89
|
+
component: Settings,
|
|
90
|
+
});
|