@burdenoff/microfe-subscriberbot 2026.1102.3 → 2026.1102.5
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/dist/stories/pages/BankConnectionsPage.stories.d.ts +12 -0
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -0
- package/dist/stories/pages/DashboardPage.stories.d.ts +4 -0
- package/dist/stories/pages/DashboardPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/RelationshipsListPage.stories.d.ts +5 -0
- package/dist/stories/pages/RelationshipsListPage.stories.d.ts.map +1 -1
- package/dist/stories/support/bankingFixtures.d.ts +8 -0
- package/dist/stories/support/bankingFixtures.d.ts.map +1 -0
- package/dist/stories/support/phoneViewport.d.ts +4 -0
- package/dist/stories/support/phoneViewport.d.ts.map +1 -0
- package/dist/subscriberbot/SubscriberBotRoot.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoot.js +58 -50
- package/dist/subscriberbot/SubscriberBotRoot.js.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.js +10 -6
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -1
- package/dist/subscriberbot/components/PageLayout.js +3 -3
- package/dist/subscriberbot/components/PageLayout.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.js +3 -0
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts +18 -0
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -0
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +247 -0
- package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -0
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts +10 -0
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -0
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +217 -0
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts +26 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts.map +1 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.js +46 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -0
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.d.ts +10 -0
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.d.ts.map +1 -0
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js +25 -0
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js.map +1 -0
- package/dist/subscriberbot/components/mobile/index.d.ts +9 -0
- package/dist/subscriberbot/components/mobile/index.d.ts.map +1 -0
- package/dist/subscriberbot/components/mobile/index.js +4 -0
- package/dist/subscriberbot/hooks/index.d.ts +1 -0
- package/dist/subscriberbot/hooks/index.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/index.js +1 -0
- package/dist/subscriberbot/hooks/useBankingApi.d.ts +31 -0
- package/dist/subscriberbot/hooks/useBankingApi.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useBankingApi.js +105 -0
- package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -0
- package/dist/subscriberbot/hooks/useCompactViewport.d.ts +13 -0
- package/dist/subscriberbot/hooks/useCompactViewport.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useCompactViewport.js +21 -0
- package/dist/subscriberbot/hooks/useCompactViewport.js.map +1 -0
- package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.js +166 -189
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +11 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +564 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -0
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +120 -119
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +226 -212
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/dist/subscriberbot/types/banking.d.ts +86 -0
- package/dist/subscriberbot/types/banking.d.ts.map +1 -0
- package/dist/subscriberbot/utils/plaidLink.d.ts +47 -0
- package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -0
- package/dist/subscriberbot/utils/plaidLink.js +35 -0
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -0
- package/dist/subscriberbot/utils/portfolio.d.ts +106 -0
- package/dist/subscriberbot/utils/portfolio.d.ts.map +1 -0
- package/dist/subscriberbot/utils/portfolio.js +151 -0
- package/dist/subscriberbot/utils/portfolio.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { formatCurrency as t, formatIntervalSuffix as n } from "../../utils/formatters.js";
|
|
3
|
+
import { StatusBadge as r } from "../StatusBadge.js";
|
|
4
|
+
import { useTr as i } from "../../hooks/useTr.js";
|
|
5
|
+
import { daysUntil as a, renewalCountdown as o } from "../../utils/portfolio.js";
|
|
6
|
+
import { MobileScreen as s, MobileSection as c } from "./MobileScreen.js";
|
|
7
|
+
import { RelationshipGlyph as l } from "./RelationshipGlyph.js";
|
|
8
|
+
import { RECOMMENDATION_LABEL as u } from "../decisions/decisionModel.js";
|
|
9
|
+
import { AlertTriangle as d, ArrowRight as f, Bot as p, ChevronRight as m, Inbox as h, Lightbulb as g, PiggyBank as _, Plus as v, ShieldCheck as y } from "lucide-react";
|
|
10
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
11
|
+
//#region src/subscriberbot/components/mobile/MobileDashboard.tsx
|
|
12
|
+
var S = "flex w-full items-center gap-3 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left shadow-sm transition-colors active:bg-bg-sunken", C = "inline-flex items-center gap-0.5 text-sm font-medium text-text-link", w = ({ greetingName: w, spend: T, upcoming: E, actionMessages: D, decisions: O, relationshipLabel: k, openInvoiceCount: A, openInvoiceTotal: j, navigateTo: M }) => {
|
|
13
|
+
let N = i(), P = [
|
|
14
|
+
{
|
|
15
|
+
id: "add",
|
|
16
|
+
label: N("mobile.dashboard.quick.add", "Add subscription"),
|
|
17
|
+
icon: /* @__PURE__ */ b(v, { className: "h-5 w-5" }),
|
|
18
|
+
path: "/relationships/new"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "inbox",
|
|
22
|
+
label: N("mobile.dashboard.quick.inbox", "Inbox"),
|
|
23
|
+
icon: /* @__PURE__ */ b(h, { className: "h-5 w-5" }),
|
|
24
|
+
path: "/inbox"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "savings",
|
|
28
|
+
label: N("mobile.dashboard.quick.savings", "Savings"),
|
|
29
|
+
icon: /* @__PURE__ */ b(_, { className: "h-5 w-5" }),
|
|
30
|
+
path: "/savings"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "agents",
|
|
34
|
+
label: N("mobile.dashboard.quick.agents", "Agents"),
|
|
35
|
+
icon: /* @__PURE__ */ b(p, { className: "h-5 w-5" }),
|
|
36
|
+
path: "/agents"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
return /* @__PURE__ */ x(s, {
|
|
40
|
+
testId: "sb-mobile-dashboard",
|
|
41
|
+
title: N("dashboard.title", "Overview"),
|
|
42
|
+
eyebrow: w ? N("mobile.dashboard.greeting", "Hi, {{name}}", { name: w }) : void 0,
|
|
43
|
+
hero: /* @__PURE__ */ x("div", { children: [
|
|
44
|
+
/* @__PURE__ */ b("p", {
|
|
45
|
+
className: "text-sm opacity-80",
|
|
46
|
+
children: N("mobile.dashboard.totalSpend", "Total recurring spend")
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ x("p", {
|
|
49
|
+
className: "mt-1 font-bold tabular-nums",
|
|
50
|
+
"data-testid": "sb-mobile-total-spend",
|
|
51
|
+
children: [/* @__PURE__ */ b("span", {
|
|
52
|
+
className: "text-4xl",
|
|
53
|
+
children: t(T.monthly, T.currency)
|
|
54
|
+
}), /* @__PURE__ */ b("span", {
|
|
55
|
+
className: "text-base font-medium opacity-80",
|
|
56
|
+
children: N("mobile.dashboard.perMonth", "/month")
|
|
57
|
+
})]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ b("p", {
|
|
60
|
+
className: "mt-1 text-xs opacity-80",
|
|
61
|
+
children: N(T.activeCount === 1 ? "mobile.dashboard.activeCountOne" : "mobile.dashboard.activeCount", T.activeCount === 1 ? "{{count}} active subscription" : "{{count}} active subscriptions", { count: T.activeCount })
|
|
62
|
+
})
|
|
63
|
+
] }),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ b(c, {
|
|
66
|
+
title: N("dashboard.renewals.title", "Upcoming renewals"),
|
|
67
|
+
action: E.length > 0 ? /* @__PURE__ */ x("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
className: C,
|
|
70
|
+
onClick: () => M("/relationships"),
|
|
71
|
+
children: [
|
|
72
|
+
N("common.viewAll", "View all"),
|
|
73
|
+
" ",
|
|
74
|
+
/* @__PURE__ */ b(m, { className: "h-4 w-4" })
|
|
75
|
+
]
|
|
76
|
+
}) : void 0,
|
|
77
|
+
children: E.length === 0 ? /* @__PURE__ */ b("div", {
|
|
78
|
+
className: e(S, "text-sm text-text-secondary"),
|
|
79
|
+
children: N("dashboard.renewals.emptyDescription", "Renewals you track will appear here ahead of time.")
|
|
80
|
+
}) : /* @__PURE__ */ b("ul", {
|
|
81
|
+
className: "space-y-3",
|
|
82
|
+
"data-testid": "sb-mobile-renewals",
|
|
83
|
+
children: E.slice(0, 5).map((r) => {
|
|
84
|
+
let i = a(r.when), s = i == null ? null : o(i);
|
|
85
|
+
return /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
className: S,
|
|
88
|
+
onClick: () => M(`/relationships/${r.relationshipId}`),
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ b(l, { kind: r.kind }),
|
|
91
|
+
/* @__PURE__ */ x("span", {
|
|
92
|
+
className: "min-w-0 flex-1",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ b("span", {
|
|
95
|
+
className: "block truncate font-semibold text-text-primary",
|
|
96
|
+
children: r.title
|
|
97
|
+
}),
|
|
98
|
+
r.amount != null && /* @__PURE__ */ x("span", {
|
|
99
|
+
className: "block text-base tabular-nums text-text-primary",
|
|
100
|
+
children: [t(r.amount, r.currency ?? T.currency), r.interval ? n(r.interval) : ""]
|
|
101
|
+
}),
|
|
102
|
+
s && /* @__PURE__ */ b("span", {
|
|
103
|
+
className: e("block text-sm", s.tone === "later" ? "text-text-secondary" : "text-status-warning-text"),
|
|
104
|
+
children: N(s.key, s.fallback, s.params)
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ b(m, { className: "h-4 w-4 shrink-0 text-text-secondary" })
|
|
109
|
+
]
|
|
110
|
+
}) }, r.id);
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ b(c, {
|
|
115
|
+
title: N("mobile.dashboard.needsAction", "Needs action"),
|
|
116
|
+
action: /* @__PURE__ */ x("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
className: C,
|
|
119
|
+
onClick: () => M("/inbox"),
|
|
120
|
+
children: [
|
|
121
|
+
N("dashboard.needsAttention.openInbox", "Open inbox"),
|
|
122
|
+
" ",
|
|
123
|
+
/* @__PURE__ */ b(m, { className: "h-4 w-4" })
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
children: D.length === 0 ? /* @__PURE__ */ x("div", {
|
|
127
|
+
className: S,
|
|
128
|
+
children: [/* @__PURE__ */ b("span", {
|
|
129
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-status-success-bg-subtle text-status-success-text",
|
|
130
|
+
children: /* @__PURE__ */ b(y, { className: "h-5 w-5" })
|
|
131
|
+
}), /* @__PURE__ */ x("span", {
|
|
132
|
+
className: "min-w-0",
|
|
133
|
+
children: [/* @__PURE__ */ b("span", {
|
|
134
|
+
className: "block text-sm font-medium text-text-primary",
|
|
135
|
+
children: N("dashboard.needsAttention.allCaughtUp", "You're all caught up")
|
|
136
|
+
}), /* @__PURE__ */ b("span", {
|
|
137
|
+
className: "block text-xs text-text-secondary",
|
|
138
|
+
children: N("dashboard.needsAttention.allCaughtUpDescription", "Required actions across your channels will surface here.")
|
|
139
|
+
})]
|
|
140
|
+
})]
|
|
141
|
+
}) : /* @__PURE__ */ b("ul", {
|
|
142
|
+
className: "space-y-3",
|
|
143
|
+
children: D.slice(0, 3).map((e) => /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
|
|
144
|
+
type: "button",
|
|
145
|
+
className: S,
|
|
146
|
+
onClick: () => M("/inbox"),
|
|
147
|
+
children: [/* @__PURE__ */ x("span", {
|
|
148
|
+
className: "min-w-0 flex-1",
|
|
149
|
+
children: [/* @__PURE__ */ b("span", {
|
|
150
|
+
className: "block truncate font-semibold text-text-primary",
|
|
151
|
+
children: e.subject || N("dashboard.needsAttention.noSubject", "(no subject)")
|
|
152
|
+
}), e.preview && /* @__PURE__ */ b("span", {
|
|
153
|
+
className: "block truncate text-sm text-text-secondary",
|
|
154
|
+
children: e.preview
|
|
155
|
+
})]
|
|
156
|
+
}), /* @__PURE__ */ b(r, {
|
|
157
|
+
status: e.category,
|
|
158
|
+
className: "shrink-0"
|
|
159
|
+
})]
|
|
160
|
+
}) }, e.id))
|
|
161
|
+
})
|
|
162
|
+
}),
|
|
163
|
+
O.length > 0 && /* @__PURE__ */ b(c, {
|
|
164
|
+
title: N("mobile.dashboard.recommendations", "AI recommendations"),
|
|
165
|
+
action: /* @__PURE__ */ x("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
className: C,
|
|
168
|
+
onClick: () => M("/decisions"),
|
|
169
|
+
children: [
|
|
170
|
+
N("common.viewAll", "View all"),
|
|
171
|
+
" ",
|
|
172
|
+
/* @__PURE__ */ b(m, { className: "h-4 w-4" })
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
children: /* @__PURE__ */ b("ul", {
|
|
176
|
+
className: "space-y-3",
|
|
177
|
+
"data-testid": "sb-mobile-decisions",
|
|
178
|
+
children: O.slice(0, 3).map((e) => {
|
|
179
|
+
let n = u[e.recommendation];
|
|
180
|
+
return /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
className: S,
|
|
183
|
+
onClick: () => M(`/decisions/${e.id}`),
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ b("span", {
|
|
186
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary",
|
|
187
|
+
children: /* @__PURE__ */ b(g, { className: "h-5 w-5" })
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ x("span", {
|
|
190
|
+
className: "min-w-0 flex-1",
|
|
191
|
+
children: [/* @__PURE__ */ b("span", {
|
|
192
|
+
className: "block truncate font-semibold text-text-primary",
|
|
193
|
+
children: n ? N(n.key, n.fallback) : e.recommendation
|
|
194
|
+
}), /* @__PURE__ */ b("span", {
|
|
195
|
+
className: "block truncate text-sm text-text-secondary",
|
|
196
|
+
children: k(e.relationshipId) ?? e.rationale
|
|
197
|
+
})]
|
|
198
|
+
}),
|
|
199
|
+
e.estimatedSavings > 0 && /* @__PURE__ */ b("span", {
|
|
200
|
+
className: "shrink-0 text-sm font-semibold tabular-nums text-status-success-text",
|
|
201
|
+
children: N("mobile.dashboard.savesPerYear", "Save {{amount}}/yr", { amount: t(e.estimatedSavings, e.currency, { maximumFractionDigits: 0 }) })
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}) }, e.id);
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
A > 0 && /* @__PURE__ */ x("button", {
|
|
209
|
+
type: "button",
|
|
210
|
+
onClick: () => M("/invoices"),
|
|
211
|
+
className: "mt-6 flex w-full items-center justify-between gap-3 rounded-2xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-4 py-3 text-left",
|
|
212
|
+
children: [/* @__PURE__ */ x("span", {
|
|
213
|
+
className: "flex items-center gap-3",
|
|
214
|
+
children: [/* @__PURE__ */ b(d, { className: "h-5 w-5 shrink-0 text-status-warning-text" }), /* @__PURE__ */ b("span", {
|
|
215
|
+
className: "text-sm font-medium text-status-warning-text",
|
|
216
|
+
children: N("dashboard.openInvoices.label", "{{count}} open invoice · {{amount}} outstanding", {
|
|
217
|
+
count: A,
|
|
218
|
+
amount: t(j, T.currency)
|
|
219
|
+
})
|
|
220
|
+
})]
|
|
221
|
+
}), /* @__PURE__ */ b(f, { className: "h-4 w-4 shrink-0 text-status-warning-text" })]
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ b(c, {
|
|
224
|
+
title: N("dashboard.quickActions.title", "Quick actions"),
|
|
225
|
+
children: /* @__PURE__ */ b("div", {
|
|
226
|
+
className: "grid grid-cols-2 gap-3",
|
|
227
|
+
children: P.map((e) => /* @__PURE__ */ x("button", {
|
|
228
|
+
type: "button",
|
|
229
|
+
onClick: () => M(e.path),
|
|
230
|
+
className: "flex min-h-20 flex-col items-start justify-between gap-2 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left active:bg-bg-sunken",
|
|
231
|
+
children: [/* @__PURE__ */ b("span", {
|
|
232
|
+
className: "flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary",
|
|
233
|
+
children: e.icon
|
|
234
|
+
}), /* @__PURE__ */ b("span", {
|
|
235
|
+
className: "text-sm font-medium text-text-primary",
|
|
236
|
+
children: e.label
|
|
237
|
+
})]
|
|
238
|
+
}, e.id))
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
//#endregion
|
|
245
|
+
export { w as MobileDashboard };
|
|
246
|
+
|
|
247
|
+
//# sourceMappingURL=MobileDashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobileDashboard.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileDashboard.tsx"],"sourcesContent":["/**\n * Mobile overview\n * @module subscriberbot/components/mobile\n *\n * The phone overview from `sb-24-mobile-app.jpg`: total recurring spend in the\n * hero, then card-first sections for upcoming renewals, what needs action in\n * the Universal Inbox, open AI recommendations, and quick actions. Every\n * number comes from the same real queries the desktop dashboard uses — the\n * page computes once and hands the results down.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport {\n AlertTriangle,\n ArrowRight,\n Bot,\n ChevronRight,\n Inbox,\n Lightbulb,\n PiggyBank,\n Plus,\n ShieldCheck,\n} from 'lucide-react';\nimport { StatusBadge } from '../StatusBadge';\nimport { MobileScreen, MobileSection } from './MobileScreen';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { RECOMMENDATION_LABEL } from '../decisions/decisionModel';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatIntervalSuffix } from '../../utils/formatters';\nimport {\n daysUntil,\n renewalCountdown,\n type RecurringSpend,\n type UpcomingRenewal,\n} from '../../utils/portfolio';\nimport type { SubDecision, SubInboxMessage } from '../../types';\n\nexport interface MobileDashboardProps {\n greetingName?: string;\n spend: RecurringSpend;\n upcoming: UpcomingRenewal[];\n actionMessages: SubInboxMessage[];\n /** PROPOSED AI decisions, newest first. */\n decisions: SubDecision[];\n relationshipLabel: (relationshipId: string) => string | undefined;\n openInvoiceCount: number;\n openInvoiceTotal: number;\n navigateTo: (relativePath: string) => void;\n}\n\nconst cardCls =\n 'flex w-full items-center gap-3 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left shadow-sm transition-colors active:bg-bg-sunken';\n\nconst linkCls = 'inline-flex items-center gap-0.5 text-sm font-medium text-text-link';\n\nexport const MobileDashboard: FC<MobileDashboardProps> = ({\n greetingName,\n spend,\n upcoming,\n actionMessages,\n decisions,\n relationshipLabel,\n openInvoiceCount,\n openInvoiceTotal,\n navigateTo,\n}) => {\n const tr = useTr();\n\n const quickActions: Array<{ id: string; label: string; icon: ReactNode; path: string }> = [\n {\n id: 'add',\n label: tr('mobile.dashboard.quick.add', 'Add subscription'),\n icon: <Plus className=\"h-5 w-5\" />,\n path: '/relationships/new',\n },\n {\n id: 'inbox',\n label: tr('mobile.dashboard.quick.inbox', 'Inbox'),\n icon: <Inbox className=\"h-5 w-5\" />,\n path: '/inbox',\n },\n {\n id: 'savings',\n label: tr('mobile.dashboard.quick.savings', 'Savings'),\n icon: <PiggyBank className=\"h-5 w-5\" />,\n path: '/savings',\n },\n {\n id: 'agents',\n label: tr('mobile.dashboard.quick.agents', 'Agents'),\n icon: <Bot className=\"h-5 w-5\" />,\n path: '/agents',\n },\n ];\n\n return (\n <MobileScreen\n testId=\"sb-mobile-dashboard\"\n title={tr('dashboard.title', 'Overview')}\n eyebrow={\n greetingName\n ? tr('mobile.dashboard.greeting', 'Hi, {{name}}', { name: greetingName })\n : undefined\n }\n hero={\n <div>\n <p className=\"text-sm opacity-80\">\n {tr('mobile.dashboard.totalSpend', 'Total recurring spend')}\n </p>\n <p className=\"mt-1 font-bold tabular-nums\" data-testid=\"sb-mobile-total-spend\">\n <span className=\"text-4xl\">{formatCurrency(spend.monthly, spend.currency)}</span>\n <span className=\"text-base font-medium opacity-80\">\n {tr('mobile.dashboard.perMonth', '/month')}\n </span>\n </p>\n <p className=\"mt-1 text-xs opacity-80\">\n {tr(\n spend.activeCount === 1\n ? 'mobile.dashboard.activeCountOne'\n : 'mobile.dashboard.activeCount',\n spend.activeCount === 1\n ? '{{count}} active subscription'\n : '{{count}} active subscriptions',\n { count: spend.activeCount }\n )}\n </p>\n </div>\n }\n >\n <MobileSection\n title={tr('dashboard.renewals.title', 'Upcoming renewals')}\n action={\n upcoming.length > 0 ? (\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/relationships')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n ) : undefined\n }\n >\n {upcoming.length === 0 ? (\n <div className={cn(cardCls, 'text-sm text-text-secondary')}>\n {tr(\n 'dashboard.renewals.emptyDescription',\n 'Renewals you track will appear here ahead of time.'\n )}\n </div>\n ) : (\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-renewals\">\n {upcoming.slice(0, 5).map((u) => {\n const days = daysUntil(u.when);\n const countdown = days == null ? null : renewalCountdown(days);\n return (\n <li key={u.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/relationships/${u.relationshipId}`)}\n >\n <RelationshipGlyph kind={u.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {u.title}\n </span>\n {u.amount != null && (\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(u.amount, u.currency ?? spend.currency)}\n {u.interval ? formatIntervalSuffix(u.interval) : ''}\n </span>\n )}\n {countdown && (\n <span\n className={cn(\n 'block text-sm',\n countdown.tone === 'later'\n ? 'text-text-secondary'\n : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n <ChevronRight className=\"h-4 w-4 shrink-0 text-text-secondary\" />\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </MobileSection>\n\n <MobileSection\n title={tr('mobile.dashboard.needsAction', 'Needs action')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/inbox')}>\n {tr('dashboard.needsAttention.openInbox', 'Open inbox')}{' '}\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n }\n >\n {actionMessages.length === 0 ? (\n <div className={cardCls}>\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-status-success-bg-subtle text-status-success-text\">\n <ShieldCheck className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {tr('dashboard.needsAttention.allCaughtUp', \"You're all caught up\")}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(\n 'dashboard.needsAttention.allCaughtUpDescription',\n 'Required actions across your channels will surface here.'\n )}\n </span>\n </span>\n </div>\n ) : (\n <ul className=\"space-y-3\">\n {actionMessages.slice(0, 3).map((m) => (\n <li key={m.id}>\n <button type=\"button\" className={cardCls} onClick={() => navigateTo('/inbox')}>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {m.subject || tr('dashboard.needsAttention.noSubject', '(no subject)')}\n </span>\n {m.preview && (\n <span className=\"block truncate text-sm text-text-secondary\">\n {m.preview}\n </span>\n )}\n </span>\n <StatusBadge status={m.category} className=\"shrink-0\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </MobileSection>\n\n {decisions.length > 0 && (\n <MobileSection\n title={tr('mobile.dashboard.recommendations', 'AI recommendations')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/decisions')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n }\n >\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-decisions\">\n {decisions.slice(0, 3).map((d) => {\n const rec = RECOMMENDATION_LABEL[d.recommendation];\n return (\n <li key={d.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/decisions/${d.id}`)}\n >\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary\">\n <Lightbulb className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {rec ? tr(rec.key, rec.fallback) : d.recommendation}\n </span>\n <span className=\"block truncate text-sm text-text-secondary\">\n {relationshipLabel(d.relationshipId) ?? d.rationale}\n </span>\n </span>\n {d.estimatedSavings > 0 && (\n <span className=\"shrink-0 text-sm font-semibold tabular-nums text-status-success-text\">\n {tr('mobile.dashboard.savesPerYear', 'Save {{amount}}/yr', {\n amount: formatCurrency(d.estimatedSavings, d.currency, {\n maximumFractionDigits: 0,\n }),\n })}\n </span>\n )}\n </button>\n </li>\n );\n })}\n </ul>\n </MobileSection>\n )}\n\n {openInvoiceCount > 0 && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/invoices')}\n className=\"mt-6 flex w-full items-center justify-between gap-3 rounded-2xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-4 py-3 text-left\"\n >\n <span className=\"flex items-center gap-3\">\n <AlertTriangle className=\"h-5 w-5 shrink-0 text-status-warning-text\" />\n <span className=\"text-sm font-medium text-status-warning-text\">\n {tr(\n 'dashboard.openInvoices.label',\n '{{count}} open invoice · {{amount}} outstanding',\n {\n count: openInvoiceCount,\n amount: formatCurrency(openInvoiceTotal, spend.currency),\n }\n )}\n </span>\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-status-warning-text\" />\n </button>\n )}\n\n <MobileSection title={tr('dashboard.quickActions.title', 'Quick actions')}>\n <div className=\"grid grid-cols-2 gap-3\">\n {quickActions.map((qa) => (\n <button\n key={qa.id}\n type=\"button\"\n onClick={() => navigateTo(qa.path)}\n className=\"flex min-h-20 flex-col items-start justify-between gap-2 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left active:bg-bg-sunken\"\n >\n <span className=\"flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n {qa.icon}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">{qa.label}</span>\n </button>\n ))}\n </div>\n </MobileSection>\n </MobileScreen>\n );\n};\n"],"mappings":";;;;;;;;;;;AAmDA,IAAM,IACJ,sJAEI,IAAU,uEAEH,KAA6C,EACxD,iBACA,UACA,aACA,mBACA,cACA,sBACA,qBACA,qBACA,oBACI;CACJ,IAAM,IAAK,EAAM,GAEX,IAAoF;EACxF;GACE,IAAI;GACJ,OAAO,EAAG,8BAA8B,kBAAkB;GAC1D,MAAM,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;GACjC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,gCAAgC,OAAO;GACjD,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;GAClC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,kCAAkC,SAAS;GACrD,MAAM,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;GACtC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,iCAAiC,QAAQ;GACnD,MAAM,kBAAC,GAAD,EAAK,WAAU,UAAW,CAAA;GAChC,MAAM;EACR;CACF;CAEA,OACE,kBAAC,GAAD;EACE,QAAO;EACP,OAAO,EAAG,mBAAmB,UAAU;EACvC,SACE,IACI,EAAG,6BAA6B,gBAAgB,EAAE,MAAM,EAAa,CAAC,IACtE,KAAA;EAEN,MACE,kBAAC,OAAD,EAAA,UAAA;GACE,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,+BAA+B,uBAAuB;GACzD,CAAA;GACH,kBAAC,KAAD;IAAG,WAAU;IAA8B,eAAY;cAAvD,CACE,kBAAC,QAAD;KAAM,WAAU;eAAY,EAAe,EAAM,SAAS,EAAM,QAAQ;IAAQ,CAAA,GAChF,kBAAC,QAAD;KAAM,WAAU;eACb,EAAG,6BAA6B,QAAQ;IACrC,CAAA,CACL;;GACH,kBAAC,KAAD;IAAG,WAAU;c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D,EAAY,WAAU,4CAA6C,CAAA,CAC7D;;GAGV,kBAAC,GAAD;IAAe,OAAO,EAAG,gCAAgC,eAAe;cACtE,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAa,KAAK,MACjB,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe,EAAW,EAAG,IAAI;MACjC,WAAU;gBAJZ,CAME,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAG;MACA,CAAA,GACN,kBAAC,QAAD;OAAM,WAAU;iBAAyC,EAAG;MAAY,CAAA,CAClE;QATD,EAAG,EASF,CACT;IACE,CAAA;GACQ,CAAA;EACH;;AAElB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SubRelationship } from '../../types';
|
|
3
|
+
|
|
4
|
+
interface MobileRelationshipListProps {
|
|
5
|
+
items: SubRelationship[];
|
|
6
|
+
navigateTo: (relativePath: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const MobileRelationshipList: FC<MobileRelationshipListProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MobileRelationshipList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobileRelationshipList.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAkCf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqCnD,UAAU,2BAA2B;IACnC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA4IlE,CAAC"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { formatCurrency as t, formatIntervalSuffix as n } from "../../utils/formatters.js";
|
|
3
|
+
import { StatusBadge as r } from "../StatusBadge.js";
|
|
4
|
+
import { useTr as i } from "../../hooks/useTr.js";
|
|
5
|
+
import { useCancelRelationship as a, useTransitionRelationship as o } from "../../hooks/useSubscriberBotApi.js";
|
|
6
|
+
import { daysUntil as s, isSwipeTrailingClick as c, quickActionsFor as l, renewalCountdown as u, swipeClickDeadline as d, swipeOffset as f, swipeSettlesOpen as p } from "../../utils/portfolio.js";
|
|
7
|
+
import { RelationshipGlyph as m } from "./RelationshipGlyph.js";
|
|
8
|
+
import { useRef as h, useState as g } from "react";
|
|
9
|
+
import { Ban as _, ChevronRight as v, MoreHorizontal as y, Pause as b, Play as x } from "lucide-react";
|
|
10
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
11
|
+
import { AlertDialog as T, AlertDialogAction as E, AlertDialogCancel as D, AlertDialogContent as O, AlertDialogDescription as k, AlertDialogFooter as A, AlertDialogHeader as j, AlertDialogTitle as M, BottomSheet as N, BottomSheetContent as P, BottomSheetDescription as F, BottomSheetHeader as I, BottomSheetTitle as L } from "@burdenoff/fe-libs/ui";
|
|
12
|
+
//#region src/subscriberbot/components/mobile/MobileRelationshipList.tsx
|
|
13
|
+
var R = 84, z = 8, B = {
|
|
14
|
+
activate: {
|
|
15
|
+
key: "relationships.detail.actions.activate",
|
|
16
|
+
fallback: "Activate",
|
|
17
|
+
icon: x,
|
|
18
|
+
tone: "bg-status-success-bg-subtle text-status-success-text"
|
|
19
|
+
},
|
|
20
|
+
resume: {
|
|
21
|
+
key: "mobile.relationships.resume",
|
|
22
|
+
fallback: "Resume",
|
|
23
|
+
icon: x,
|
|
24
|
+
tone: "bg-status-success-bg-subtle text-status-success-text"
|
|
25
|
+
},
|
|
26
|
+
pause: {
|
|
27
|
+
key: "relationships.detail.actions.pause",
|
|
28
|
+
fallback: "Pause",
|
|
29
|
+
icon: b,
|
|
30
|
+
tone: "bg-status-warning-bg-subtle text-status-warning-text"
|
|
31
|
+
},
|
|
32
|
+
cancel: {
|
|
33
|
+
key: "relationships.detail.actions.cancel",
|
|
34
|
+
fallback: "Cancel",
|
|
35
|
+
icon: _,
|
|
36
|
+
tone: "bg-status-error-bg-subtle text-status-error-text"
|
|
37
|
+
}
|
|
38
|
+
}, V = ({ items: r, navigateTo: s }) => {
|
|
39
|
+
let c = i(), u = o(), d = a(), [f, p] = g(null), [m, h] = g(null), [_, y] = g(null), [b, x] = g(null), R = u.isPending || d.isPending, z = (e) => x(e instanceof Error ? e.message : c("mobile.relationships.actionFailed", "That action could not be completed.")), V = (e, t) => {
|
|
40
|
+
if (p(null), h(null), x(null), t.destructive) {
|
|
41
|
+
y(e);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
u.mutate({
|
|
45
|
+
id: e.id,
|
|
46
|
+
status: t.target
|
|
47
|
+
}, { onError: z });
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
50
|
+
b && /* @__PURE__ */ C("div", {
|
|
51
|
+
role: "alert",
|
|
52
|
+
className: "mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
53
|
+
children: b
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ C("ul", {
|
|
56
|
+
className: "mt-4 space-y-3",
|
|
57
|
+
"data-testid": "sb-mobile-relationship-list",
|
|
58
|
+
children: r.map((e) => /* @__PURE__ */ C(H, {
|
|
59
|
+
relationship: e,
|
|
60
|
+
open: f === e.id,
|
|
61
|
+
busy: R,
|
|
62
|
+
onOpenChange: (t) => p(t ? e.id : null),
|
|
63
|
+
onSelect: () => s(`/relationships/${e.id}`),
|
|
64
|
+
onMore: () => {
|
|
65
|
+
p(null), h(e);
|
|
66
|
+
},
|
|
67
|
+
onAction: (t) => V(e, t)
|
|
68
|
+
}, e.id))
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ C(N, {
|
|
71
|
+
open: m != null,
|
|
72
|
+
onOpenChange: (e) => !e && h(null),
|
|
73
|
+
children: /* @__PURE__ */ C(P, {
|
|
74
|
+
"data-testid": "sb-mobile-relationship-actions",
|
|
75
|
+
children: m && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ w(I, { children: [/* @__PURE__ */ C(L, { children: m.label }), /* @__PURE__ */ w(F, { children: [t(m.amount, m.currency), n(m.interval)] })] }), /* @__PURE__ */ w("div", {
|
|
76
|
+
className: "flex flex-col gap-2 py-2",
|
|
77
|
+
children: [/* @__PURE__ */ w("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
className: "flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-left text-sm font-medium text-text-primary active:bg-bg-sunken",
|
|
80
|
+
onClick: () => {
|
|
81
|
+
let e = m.id;
|
|
82
|
+
h(null), s(`/relationships/${e}`);
|
|
83
|
+
},
|
|
84
|
+
children: [c("mobile.relationships.viewDetails", "View details"), /* @__PURE__ */ C(v, { className: "h-4 w-4 text-text-secondary" })]
|
|
85
|
+
}), l(m.status).map((t) => {
|
|
86
|
+
let n = B[t.id], r = n.icon;
|
|
87
|
+
return /* @__PURE__ */ w("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
disabled: R,
|
|
90
|
+
className: e("flex min-h-12 items-center gap-3 rounded-xl px-4 text-left text-sm font-medium disabled:opacity-50", n.tone),
|
|
91
|
+
onClick: () => V(m, t),
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ C(r, { className: "h-4 w-4" }),
|
|
94
|
+
" ",
|
|
95
|
+
c(n.key, n.fallback)
|
|
96
|
+
]
|
|
97
|
+
}, t.id);
|
|
98
|
+
})]
|
|
99
|
+
})] })
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ C(T, {
|
|
103
|
+
open: _ != null,
|
|
104
|
+
onOpenChange: (e) => !e && y(null),
|
|
105
|
+
children: /* @__PURE__ */ w(O, { children: [/* @__PURE__ */ w(j, { children: [/* @__PURE__ */ C(M, { children: c("mobile.relationships.cancelTitle", "Cancel {{label}}?", { label: _?.label ?? "" }) }), /* @__PURE__ */ C(k, { children: c("mobile.relationships.cancelDescription", "This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.") })] }), /* @__PURE__ */ w(A, { children: [/* @__PURE__ */ C(D, { children: c("mobile.relationships.keep", "Keep it") }), /* @__PURE__ */ C(E, {
|
|
106
|
+
onClick: () => {
|
|
107
|
+
if (!_) return;
|
|
108
|
+
let e = _.id;
|
|
109
|
+
y(null), d.mutate(e, { onError: z });
|
|
110
|
+
},
|
|
111
|
+
children: c("mobile.relationships.confirmCancel", "Cancel relationship")
|
|
112
|
+
})] })] })
|
|
113
|
+
})
|
|
114
|
+
] });
|
|
115
|
+
}, H = ({ relationship: a, open: o, busy: _, onOpenChange: v, onSelect: b, onMore: x, onAction: S }) => {
|
|
116
|
+
let T = i(), E = l(a.status), D = E.length * R, [O, k] = g(null), A = h(null), j = h(0), M = O ?? (o ? -D : 0), N = s(a.renewsAt), P = N != null && (a.status === "ACTIVE" || a.status === "TRIAL") ? u(N) : null, F = (e) => {
|
|
117
|
+
D === 0 || e.pointerType === "mouse" || (A.current = {
|
|
118
|
+
x: e.clientX,
|
|
119
|
+
y: e.clientY,
|
|
120
|
+
swiping: !1,
|
|
121
|
+
moved: !1
|
|
122
|
+
});
|
|
123
|
+
}, I = (e) => {
|
|
124
|
+
let t = A.current;
|
|
125
|
+
if (!t) return;
|
|
126
|
+
let n = e.clientX - t.x, r = e.clientY - t.y;
|
|
127
|
+
if (!t.swiping) {
|
|
128
|
+
if (Math.abs(r) > z && Math.abs(r) > Math.abs(n)) {
|
|
129
|
+
A.current = null;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (Math.abs(n) < z) return;
|
|
133
|
+
t.swiping = !0, e.currentTarget.setPointerCapture(e.pointerId);
|
|
134
|
+
}
|
|
135
|
+
t.moved = !0, k(f(n, o, D));
|
|
136
|
+
}, L = () => {
|
|
137
|
+
let e = A.current;
|
|
138
|
+
A.current = null, e?.swiping && O != null && v(p(O, D)), k(null), e?.moved && (j.current = d(Date.now()));
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ w("li", {
|
|
141
|
+
className: "relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken",
|
|
142
|
+
"data-testid": "sb-mobile-relationship-row",
|
|
143
|
+
"data-relationship-id": a.id,
|
|
144
|
+
children: [E.length > 0 && /* @__PURE__ */ C("div", {
|
|
145
|
+
className: "absolute inset-y-0 right-0 flex",
|
|
146
|
+
style: { width: D },
|
|
147
|
+
"aria-hidden": !o,
|
|
148
|
+
children: E.map((t) => {
|
|
149
|
+
let n = B[t.id], r = n.icon;
|
|
150
|
+
return /* @__PURE__ */ w("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
tabIndex: o ? 0 : -1,
|
|
153
|
+
disabled: _,
|
|
154
|
+
onClick: () => S(t),
|
|
155
|
+
className: e("flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50", n.tone),
|
|
156
|
+
style: { width: R },
|
|
157
|
+
children: [/* @__PURE__ */ C(r, { className: "h-5 w-5" }), T(n.key, n.fallback)]
|
|
158
|
+
}, t.id);
|
|
159
|
+
})
|
|
160
|
+
}), /* @__PURE__ */ w("div", {
|
|
161
|
+
className: e("relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4", O == null && "transition-transform duration-200 ease-out"),
|
|
162
|
+
style: { transform: `translateX(${M}px)` },
|
|
163
|
+
onPointerDown: F,
|
|
164
|
+
onPointerMove: I,
|
|
165
|
+
onPointerUp: L,
|
|
166
|
+
onPointerCancel: L,
|
|
167
|
+
onClickCapture: (e) => {
|
|
168
|
+
c(Date.now(), j.current) && (j.current = 0, e.preventDefault(), e.stopPropagation());
|
|
169
|
+
},
|
|
170
|
+
children: [/* @__PURE__ */ w("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
onClick: () => {
|
|
173
|
+
if (o) {
|
|
174
|
+
v(!1);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
b();
|
|
178
|
+
},
|
|
179
|
+
className: "flex min-w-0 flex-1 items-center gap-3 text-left",
|
|
180
|
+
children: [/* @__PURE__ */ C(m, { kind: a.kind }), /* @__PURE__ */ w("span", {
|
|
181
|
+
className: "min-w-0 flex-1",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ C("span", {
|
|
184
|
+
className: "block truncate font-semibold text-text-primary",
|
|
185
|
+
children: a.label
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ w("span", {
|
|
188
|
+
className: "block text-base tabular-nums text-text-primary",
|
|
189
|
+
children: [t(a.amount, a.currency), /* @__PURE__ */ C("span", {
|
|
190
|
+
className: "text-sm text-text-secondary",
|
|
191
|
+
children: n(a.interval)
|
|
192
|
+
})]
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ w("span", {
|
|
195
|
+
className: "mt-0.5 flex items-center gap-2",
|
|
196
|
+
children: [/* @__PURE__ */ C(r, { status: a.status }), P && /* @__PURE__ */ C("span", {
|
|
197
|
+
className: e("truncate text-xs", P.tone === "later" ? "text-text-secondary" : "text-status-warning-text"),
|
|
198
|
+
children: T(P.key, P.fallback, P.params)
|
|
199
|
+
})]
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
})]
|
|
203
|
+
}), /* @__PURE__ */ C("button", {
|
|
204
|
+
type: "button",
|
|
205
|
+
onClick: x,
|
|
206
|
+
"aria-label": T("mobile.relationships.moreActions", "More actions for {{label}}", { label: a.label }),
|
|
207
|
+
className: "flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken",
|
|
208
|
+
"data-testid": "sb-mobile-relationship-more",
|
|
209
|
+
children: /* @__PURE__ */ C(y, { className: "h-5 w-5" })
|
|
210
|
+
})]
|
|
211
|
+
})]
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
//#endregion
|
|
215
|
+
export { V as MobileRelationshipList };
|
|
216
|
+
|
|
217
|
+
//# sourceMappingURL=MobileRelationshipList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobileRelationshipList.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"sourcesContent":["/**\n * Mobile relationship list\n * @module subscriberbot/components/mobile\n *\n * Card rows for phone widths. Each row opens the relationship on tap, reveals\n * its lifecycle actions on a left swipe, and offers the same actions through\n * an overflow (⋯) button that opens a bottom sheet — so the actions stay\n * reachable without the gesture (keyboard, screen readers, desktop browsers\n * resized to phone width). Actions are filtered through the svc state machine\n * (`quickActionsFor`); cancelling asks for confirmation first.\n */\n\nimport {\n useRef,\n useState,\n type FC,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n} from 'react';\nimport { Ban, ChevronRight, MoreHorizontal, Pause, Play, type LucideIcon } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n BottomSheet,\n BottomSheetContent,\n BottomSheetDescription,\n BottomSheetHeader,\n BottomSheetTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../StatusBadge';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { useCancelRelationship, useTransitionRelationship } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatIntervalSuffix } from '../../utils/formatters';\nimport {\n daysUntil,\n isSwipeTrailingClick,\n quickActionsFor,\n renewalCountdown,\n swipeClickDeadline,\n swipeOffset,\n swipeSettlesOpen,\n type QuickAction,\n type QuickActionId,\n} from '../../utils/portfolio';\nimport type { SubRelationship } from '../../types';\n\n/** Width of one revealed action button. */\nconst ACTION_WIDTH = 84;\n/** Horizontal travel before a touch counts as a swipe rather than a tap/scroll. */\nconst SWIPE_SLOP = 8;\n\nconst ACTION_META: Record<\n QuickActionId,\n { key: string; fallback: string; icon: LucideIcon; tone: string }\n> = {\n activate: {\n key: 'relationships.detail.actions.activate',\n fallback: 'Activate',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n resume: {\n key: 'mobile.relationships.resume',\n fallback: 'Resume',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n pause: {\n key: 'relationships.detail.actions.pause',\n fallback: 'Pause',\n icon: Pause,\n tone: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n cancel: {\n key: 'relationships.detail.actions.cancel',\n fallback: 'Cancel',\n icon: Ban,\n tone: 'bg-status-error-bg-subtle text-status-error-text',\n },\n};\n\ninterface MobileRelationshipListProps {\n items: SubRelationship[];\n navigateTo: (relativePath: string) => void;\n}\n\nexport const MobileRelationshipList: FC<MobileRelationshipListProps> = ({ items, navigateTo }) => {\n const tr = useTr();\n const transition = useTransitionRelationship();\n const cancel = useCancelRelationship();\n const [openRowId, setOpenRowId] = useState<string | null>(null);\n const [sheetFor, setSheetFor] = useState<SubRelationship | null>(null);\n const [confirmCancel, setConfirmCancel] = useState<SubRelationship | null>(null);\n const [error, setError] = useState<string | null>(null);\n const busy = transition.isPending || cancel.isPending;\n\n const onError = (e: unknown) =>\n setError(\n e instanceof Error\n ? e.message\n : tr('mobile.relationships.actionFailed', 'That action could not be completed.')\n );\n\n const run = (relationship: SubRelationship, action: QuickAction) => {\n setOpenRowId(null);\n setSheetFor(null);\n setError(null);\n if (action.destructive) {\n setConfirmCancel(relationship);\n return;\n }\n transition.mutate({ id: relationship.id, status: action.target }, { onError });\n };\n\n const confirmCancellation = () => {\n if (!confirmCancel) return;\n const id = confirmCancel.id;\n setConfirmCancel(null);\n cancel.mutate(id, { onError });\n };\n\n return (\n <>\n {error && (\n <div\n role=\"alert\"\n className=\"mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {error}\n </div>\n )}\n\n <ul className=\"mt-4 space-y-3\" data-testid=\"sb-mobile-relationship-list\">\n {items.map((r) => (\n <SwipeRow\n key={r.id}\n relationship={r}\n open={openRowId === r.id}\n busy={busy}\n onOpenChange={(open) => setOpenRowId(open ? r.id : null)}\n onSelect={() => navigateTo(`/relationships/${r.id}`)}\n onMore={() => {\n setOpenRowId(null);\n setSheetFor(r);\n }}\n onAction={(action) => run(r, action)}\n />\n ))}\n </ul>\n\n <BottomSheet open={sheetFor != null} onOpenChange={(open) => !open && setSheetFor(null)}>\n <BottomSheetContent data-testid=\"sb-mobile-relationship-actions\">\n {sheetFor && (\n <>\n <BottomSheetHeader>\n <BottomSheetTitle>{sheetFor.label}</BottomSheetTitle>\n <BottomSheetDescription>\n {formatCurrency(sheetFor.amount, sheetFor.currency)}\n {formatIntervalSuffix(sheetFor.interval)}\n </BottomSheetDescription>\n </BottomSheetHeader>\n <div className=\"flex flex-col gap-2 py-2\">\n <button\n type=\"button\"\n className=\"flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-left text-sm font-medium text-text-primary active:bg-bg-sunken\"\n onClick={() => {\n const id = sheetFor.id;\n setSheetFor(null);\n navigateTo(`/relationships/${id}`);\n }}\n >\n {tr('mobile.relationships.viewDetails', 'View details')}\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </button>\n {quickActionsFor(sheetFor.status).map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n disabled={busy}\n className={cn(\n 'flex min-h-12 items-center gap-3 rounded-xl px-4 text-left text-sm font-medium disabled:opacity-50',\n meta.tone\n )}\n onClick={() => run(sheetFor, action)}\n >\n <Icon className=\"h-4 w-4\" /> {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n </>\n )}\n </BottomSheetContent>\n </BottomSheet>\n\n <AlertDialog\n open={confirmCancel != null}\n onOpenChange={(open) => !open && setConfirmCancel(null)}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr('mobile.relationships.cancelTitle', 'Cancel {{label}}?', {\n label: confirmCancel?.label ?? '',\n })}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n 'mobile.relationships.cancelDescription',\n 'This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.'\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>{tr('mobile.relationships.keep', 'Keep it')}</AlertDialogCancel>\n <AlertDialogAction onClick={confirmCancellation}>\n {tr('mobile.relationships.confirmCancel', 'Cancel relationship')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n};\n\ninterface SwipeRowProps {\n relationship: SubRelationship;\n open: boolean;\n busy: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: () => void;\n onMore: () => void;\n onAction: (action: QuickAction) => void;\n}\n\nconst SwipeRow: FC<SwipeRowProps> = ({\n relationship: r,\n open,\n busy,\n onOpenChange,\n onSelect,\n onMore,\n onAction,\n}) => {\n const tr = useTr();\n const actions = quickActionsFor(r.status);\n const revealWidth = actions.length * ACTION_WIDTH;\n const [dragOffset, setDragOffset] = useState<number | null>(null);\n const gesture = useRef<{ x: number; y: number; swiping: boolean; moved: boolean } | null>(null);\n\n // A swipe ends with a synthetic click. While the pointer is captured that\n // click targets the capturing card element rather than the inner button,\n // so it is swallowed in the card's capture phase, and only within a short\n // window after the gesture — a later deliberate tap always goes through,\n // and a cancelled swipe (which dispatches no click) leaves nothing pending.\n const swipeClickUntil = useRef(0);\n\n const offset = dragOffset ?? (open ? -revealWidth : 0);\n const days = daysUntil(r.renewsAt);\n const countdown =\n days != null && (r.status === 'ACTIVE' || r.status === 'TRIAL') ? renewalCountdown(days) : null;\n\n const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (revealWidth === 0 || e.pointerType === 'mouse') return;\n gesture.current = { x: e.clientX, y: e.clientY, swiping: false, moved: false };\n };\n\n const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {\n const g = gesture.current;\n if (!g) return;\n const dx = e.clientX - g.x;\n const dy = e.clientY - g.y;\n if (!g.swiping) {\n if (Math.abs(dy) > SWIPE_SLOP && Math.abs(dy) > Math.abs(dx)) {\n // Vertical scroll — let the page have it.\n gesture.current = null;\n return;\n }\n if (Math.abs(dx) < SWIPE_SLOP) return;\n g.swiping = true;\n e.currentTarget.setPointerCapture(e.pointerId);\n }\n g.moved = true;\n setDragOffset(swipeOffset(dx, open, revealWidth));\n };\n\n const endGesture = () => {\n const g = gesture.current;\n gesture.current = null;\n if (g?.swiping && dragOffset != null) {\n onOpenChange(swipeSettlesOpen(dragOffset, revealWidth));\n }\n setDragOffset(null);\n if (g?.moved) swipeClickUntil.current = swipeClickDeadline(Date.now());\n };\n\n const onClickCapture = (e: ReactMouseEvent<HTMLDivElement>) => {\n if (!isSwipeTrailingClick(Date.now(), swipeClickUntil.current)) return;\n swipeClickUntil.current = 0;\n e.preventDefault();\n e.stopPropagation();\n };\n\n const handleSelect = () => {\n if (open) {\n onOpenChange(false);\n return;\n }\n onSelect();\n };\n\n return (\n <li\n className=\"relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-row\"\n data-relationship-id={r.id}\n >\n {/* Action tray, revealed under the card by a left swipe. Hidden from\n assistive tech and the tab order while closed — the ⋯ sheet is the\n accessible path to the same actions. */}\n {actions.length > 0 && (\n <div\n className=\"absolute inset-y-0 right-0 flex\"\n style={{ width: revealWidth }}\n aria-hidden={!open}\n >\n {actions.map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n tabIndex={open ? 0 : -1}\n disabled={busy}\n onClick={() => onAction(action)}\n className={cn(\n 'flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50',\n meta.tone\n )}\n style={{ width: ACTION_WIDTH }}\n >\n <Icon className=\"h-5 w-5\" />\n {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n )}\n\n <div\n className={cn(\n 'relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4',\n dragOffset == null && 'transition-transform duration-200 ease-out'\n )}\n style={{ transform: `translateX(${offset}px)` }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onClickCapture={onClickCapture}\n >\n <button\n type=\"button\"\n onClick={handleSelect}\n className=\"flex min-w-0 flex-1 items-center gap-3 text-left\"\n >\n <RelationshipGlyph kind={r.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">{r.label}</span>\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n <span className=\"text-sm text-text-secondary\">\n {formatIntervalSuffix(r.interval)}\n </span>\n </span>\n <span className=\"mt-0.5 flex items-center gap-2\">\n <StatusBadge status={r.status} />\n {countdown && (\n <span\n className={cn(\n 'truncate text-xs',\n countdown.tone === 'later' ? 'text-text-secondary' : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={onMore}\n aria-label={tr('mobile.relationships.moreActions', 'More actions for {{label}}', {\n label: r.label,\n })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-more\"\n >\n <MoreHorizontal className=\"h-5 w-5\" />\n </button>\n </div>\n </li>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAuDA,IAAM,IAAe,IAEf,IAAa,GAEb,IAGF;CACF,UAAU;EACR,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAA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AAM;MACR,EAAa,EAAK;MAClB;KACF;KACA,EAAS;IACX;IAwDQ,WAAU;cAHZ,CAKE,kBAAC,GAAD,EAAmB,MAAM,EAAE,KAAO,CAAA,GAClC,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,QAAD;OAAM,WAAU;iBAAkD,EAAE;MAAY,CAAA;MAChF,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACG,EAAe,EAAE,QAAQ,EAAE,QAAQ,GACpC,kBAAC,QAAD;QAAM,WAAU;kBACb,EAAqB,EAAE,QAAQ;OAC5B,CAAA,CACF;;MACN,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACE,kBAAC,GAAD,EAAa,QAAQ,EAAE,OAAS,CAAA,GAC/B,KACC,kBAAC,QAAD;QACE,WAAW,EACT,oBACA,EAAU,SAAS,UAAU,wBAAwB,0BACvD;kBAEC,EAAG,EAAU,KAAK,EAAU,UAAU,EAAU,MAAM;OACnD,CAAA,CAEJ;;KACF;MACA;OACR,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAG,oCAAoC,8BAA8B,EAC/E,OAAO,EAAE,MACX,CAAC;IACD,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;GAC/B,CAAA,CACL;IACH;;AAER"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MobileScreenProps {
|
|
4
|
+
title: string;
|
|
5
|
+
/** Small line above the title (e.g. the greeting). */
|
|
6
|
+
eyebrow?: ReactNode;
|
|
7
|
+
/** Optional hero content under the title (e.g. the recurring-spend figure). */
|
|
8
|
+
hero?: ReactNode;
|
|
9
|
+
/** Optional trailing control in the hero (e.g. an add button). */
|
|
10
|
+
action?: ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Stable hook for Playwright and the assistant page context. */
|
|
14
|
+
testId?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const MobileScreen: FC<MobileScreenProps>;
|
|
17
|
+
interface MobileSectionProps {
|
|
18
|
+
title: string;
|
|
19
|
+
action?: ReactNode;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/** A titled group on the mobile sheet ("Upcoming renewals", "Needs action"). */
|
|
24
|
+
export declare const MobileSection: FC<MobileSectionProps>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=MobileScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobileScreen.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3C,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAsB9C,CAAC;AAEF,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gFAAgF;AAChF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAQhD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/subscriberbot/components/mobile/MobileScreen.tsx
|
|
4
|
+
var r = ({ title: r, eyebrow: i, hero: a, action: o, children: s, className: c, testId: l }) => /* @__PURE__ */ n("div", {
|
|
5
|
+
className: e("flex min-h-full flex-col", c),
|
|
6
|
+
"data-testid": l,
|
|
7
|
+
children: [/* @__PURE__ */ n("header", {
|
|
8
|
+
className: "bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text",
|
|
9
|
+
children: [/* @__PURE__ */ n("div", {
|
|
10
|
+
className: "flex items-start justify-between gap-3",
|
|
11
|
+
children: [/* @__PURE__ */ n("div", {
|
|
12
|
+
className: "min-w-0",
|
|
13
|
+
children: [i ? /* @__PURE__ */ t("p", {
|
|
14
|
+
className: "text-sm opacity-80",
|
|
15
|
+
children: i
|
|
16
|
+
}) : null, /* @__PURE__ */ t("h1", {
|
|
17
|
+
className: "text-2xl font-bold tracking-tight",
|
|
18
|
+
children: r
|
|
19
|
+
})]
|
|
20
|
+
}), o ? /* @__PURE__ */ t("div", {
|
|
21
|
+
className: "shrink-0",
|
|
22
|
+
children: o
|
|
23
|
+
}) : null]
|
|
24
|
+
}), a ? /* @__PURE__ */ t("div", {
|
|
25
|
+
className: "mt-4",
|
|
26
|
+
children: a
|
|
27
|
+
}) : null]
|
|
28
|
+
}), /* @__PURE__ */ t("div", {
|
|
29
|
+
className: "-mt-6 flex-1 rounded-t-3xl bg-bg-canvas px-4 pb-6 pt-5",
|
|
30
|
+
children: s
|
|
31
|
+
})]
|
|
32
|
+
}), i = ({ title: r, action: i, children: a, className: o }) => /* @__PURE__ */ n("section", {
|
|
33
|
+
className: e("mt-6 first:mt-0", o),
|
|
34
|
+
"aria-label": r,
|
|
35
|
+
children: [/* @__PURE__ */ n("div", {
|
|
36
|
+
className: "mb-3 flex items-center justify-between gap-3",
|
|
37
|
+
children: [/* @__PURE__ */ t("h2", {
|
|
38
|
+
className: "text-lg font-semibold text-text-primary",
|
|
39
|
+
children: r
|
|
40
|
+
}), i]
|
|
41
|
+
}), a]
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
export { r as MobileScreen, i as MobileSection };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=MobileScreen.js.map
|