@haatlabs-core/templates 0.21.0 → 0.22.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/package.json +3 -3
- package/starter/apps/api/src/security-sweep.int.test.ts +18 -2
- package/starter/apps/api/src/seed-plans.int.test.ts +8 -1
- package/starter/apps/shopify-app/index.html +2 -0
- package/starter/apps/shopify-app/public/theme-boot.js +6 -0
- package/starter/packages/database/drizzle/0010_platform_vendorhaat.sql +5 -0
- package/starter/packages/database/drizzle/meta/0010_snapshot.json +2467 -0
- package/starter/packages/database/drizzle/meta/_journal.json +7 -0
- package/starter/packages/database/src/repositories/billing.int.test.ts +5 -4
- package/starter/packages/web-ui/src/App.test.tsx +90 -5
- package/starter/packages/web-ui/src/App.tsx +53 -27
- package/starter/packages/web-ui/src/components/Logo.tsx +6 -3
- package/starter/packages/web-ui/src/pages/HomePage.tsx +3 -3
- package/starter/packages/web-ui/src/pages/LoginPage.tsx +3 -1
- package/starter/packages/web-ui/src/styles.css +68 -53
- package/starter/packages/web-ui/src/testing/fake-client.ts +1 -0
|
@@ -319,8 +319,8 @@ describe('billing repository', () => {
|
|
|
319
319
|
});
|
|
320
320
|
const pro = (await billing.listPlans()).find((plan) => plan.code === 'pro');
|
|
321
321
|
expect(pro?.prices).toEqual([
|
|
322
|
-
{ provider: 'razorpay', currency: 'INR', amountMinor: 399900 },
|
|
323
|
-
{ provider: 'stripe', currency: 'USD', amountMinor: 4900 },
|
|
322
|
+
{ provider: 'razorpay', currency: 'INR', amountMinor: 399900, interval: 'MONTH' },
|
|
323
|
+
{ provider: 'stripe', currency: 'USD', amountMinor: 4900, interval: 'MONTH' },
|
|
324
324
|
]);
|
|
325
325
|
await expect(
|
|
326
326
|
systemBilling.setPrice('platinum', 'stripe', {
|
|
@@ -622,8 +622,8 @@ describe('billing repository', () => {
|
|
|
622
622
|
});
|
|
623
623
|
const pro = (await billing.listPlans()).find((plan) => plan.code === 'pro');
|
|
624
624
|
expect(pro?.prices).toEqual([
|
|
625
|
-
{ provider: 'razorpay', currency: 'INR', amountMinor: 449900 },
|
|
626
|
-
{ provider: 'stripe', currency: 'USD', amountMinor: 4900 },
|
|
625
|
+
{ provider: 'razorpay', currency: 'INR', amountMinor: 449900, interval: 'MONTH' },
|
|
626
|
+
{ provider: 'stripe', currency: 'USD', amountMinor: 4900, interval: 'MONTH' },
|
|
627
627
|
]);
|
|
628
628
|
});
|
|
629
629
|
|
|
@@ -722,6 +722,7 @@ describe('billing repository', () => {
|
|
|
722
722
|
priceRef: 'shopify_starter_monthly',
|
|
723
723
|
currency: 'USD',
|
|
724
724
|
amountMinor: 1900,
|
|
725
|
+
interval: 'MONTH',
|
|
725
726
|
planName: 'Starter',
|
|
726
727
|
});
|
|
727
728
|
expect(await firstPrice(systemBilling, 'free', 'shopify')).toBeNull();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
|
-
import { act, cleanup, render, screen } from '@testing-library/react';
|
|
2
|
+
import { act, cleanup, render, screen, within } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { ALL_FEATURES_ON } from '@@@name@@/contracts';
|
|
5
5
|
import type { MeResponse } from '@@@name@@/contracts';
|
|
@@ -32,6 +32,7 @@ const me: MeResponse = {
|
|
|
32
32
|
via: 'session',
|
|
33
33
|
csrfToken: 'csrf',
|
|
34
34
|
storeOnly: false,
|
|
35
|
+
organizationCount: 1,
|
|
35
36
|
features: ALL_FEATURES_ON,
|
|
36
37
|
};
|
|
37
38
|
#@if kindShopify
|
|
@@ -66,12 +67,28 @@ const renderApp = (client: ApiClient, url = '/'): void => {
|
|
|
66
67
|
};
|
|
67
68
|
#@end
|
|
68
69
|
|
|
70
|
+
/** Sign out from the sidebar's account menu, as on a computer. */
|
|
71
|
+
const signOut = async (user: ReturnType<typeof userEvent.setup>): Promise<void> => {
|
|
72
|
+
await user.click(await screen.findByRole('button', { name: /^Account: / }));
|
|
73
|
+
await user.click(screen.getByRole('menuitem', { name: 'Sign out' }));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** A phone or tablet: below the platform's 1024px breakpoint. */
|
|
77
|
+
const phoneWidth = (): void => {
|
|
78
|
+
window.matchMedia = vi.fn().mockImplementation((query: string) => ({
|
|
79
|
+
matches: query === '(max-width: 1023px)',
|
|
80
|
+
addEventListener: vi.fn(),
|
|
81
|
+
removeEventListener: vi.fn(),
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
|
|
69
85
|
beforeEach(() => {
|
|
70
86
|
vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
71
87
|
});
|
|
72
88
|
afterEach(() => {
|
|
73
89
|
cleanup();
|
|
74
90
|
vi.restoreAllMocks();
|
|
91
|
+
Reflect.deleteProperty(window, 'matchMedia');
|
|
75
92
|
});
|
|
76
93
|
|
|
77
94
|
describe('standalone app', () => {
|
|
@@ -188,7 +205,7 @@ describe('standalone app', () => {
|
|
|
188
205
|
const client = fakeClient({ me: meFn });
|
|
189
206
|
renderApp(client);
|
|
190
207
|
const user = userEvent.setup();
|
|
191
|
-
await user
|
|
208
|
+
await signOut(user);
|
|
192
209
|
expect(client.logout).toHaveBeenCalledTimes(1);
|
|
193
210
|
expect(await screen.findByRole('button', { name: 'Send me a code' })).toBeTruthy();
|
|
194
211
|
});
|
|
@@ -208,7 +225,7 @@ describe('standalone app', () => {
|
|
|
208
225
|
});
|
|
209
226
|
renderApp(client);
|
|
210
227
|
const user = userEvent.setup();
|
|
211
|
-
await user
|
|
228
|
+
await signOut(user);
|
|
212
229
|
expect(await screen.findByRole('button', { name: 'Send me a code' })).toBeTruthy();
|
|
213
230
|
expect(disable).toHaveBeenCalledTimes(1);
|
|
214
231
|
expect(client.logout).toHaveBeenCalledTimes(1);
|
|
@@ -233,7 +250,7 @@ describe('standalone app', () => {
|
|
|
233
250
|
const client = fakeClient({ me: meFn, logout: vi.fn().mockRejectedValue(unauthorized()) });
|
|
234
251
|
renderApp(client);
|
|
235
252
|
const user = userEvent.setup();
|
|
236
|
-
await user
|
|
253
|
+
await signOut(user);
|
|
237
254
|
expect(await screen.findByRole('button', { name: 'Send me a code' })).toBeTruthy();
|
|
238
255
|
});
|
|
239
256
|
|
|
@@ -243,7 +260,7 @@ describe('standalone app', () => {
|
|
|
243
260
|
});
|
|
244
261
|
renderApp(client);
|
|
245
262
|
const user = userEvent.setup();
|
|
246
|
-
await user
|
|
263
|
+
await signOut(user);
|
|
247
264
|
expect((await screen.findByRole('alert')).textContent).toBe('Boom');
|
|
248
265
|
});
|
|
249
266
|
|
|
@@ -300,6 +317,21 @@ describe('standalone app', () => {
|
|
|
300
317
|
expect(settings.notifications.preferences).toHaveBeenCalled();
|
|
301
318
|
});
|
|
302
319
|
|
|
320
|
+
it('has the bottom bar and Sign out under More below 1024px', async () => {
|
|
321
|
+
phoneWidth();
|
|
322
|
+
const client = fakeClient();
|
|
323
|
+
renderApp(client, '/home');
|
|
324
|
+
await screen.findByRole('heading', { name: 'Home' });
|
|
325
|
+
expect(document.querySelector('.hl-sidebar')).toBeNull();
|
|
326
|
+
const bar = screen.getByRole('navigation', { name: 'Main' });
|
|
327
|
+
expect(within(bar).getByRole('link', { name: 'Home' }).getAttribute('aria-current')).toBe(
|
|
328
|
+
'page',
|
|
329
|
+
);
|
|
330
|
+
await userEvent.click(within(bar).getByRole('button', { name: 'More' }));
|
|
331
|
+
await userEvent.click(screen.getByRole('button', { name: 'Sign out' }));
|
|
332
|
+
expect(client.logout).toHaveBeenCalled();
|
|
333
|
+
});
|
|
334
|
+
|
|
303
335
|
it('sends an address of a removed page to Home', async () => {
|
|
304
336
|
renderApp(fakeClient(), '/stores/7f2c1d5e-8a43-4b6f-9c1d-2e3f4a5b6c7d/products');
|
|
305
337
|
expect(await screen.findByRole('heading', { name: 'Home' })).toBeTruthy();
|
|
@@ -356,6 +388,59 @@ describe('embedded app', () => {
|
|
|
356
388
|
expect(await screen.findByRole('button', { name: 'Notifications' })).toBeTruthy();
|
|
357
389
|
});
|
|
358
390
|
|
|
391
|
+
it('has the bottom bar below 1024px, its links keeping Shopify’s query string', async () => {
|
|
392
|
+
phoneWidth();
|
|
393
|
+
// A page's own parameter (tab) stays behind; Shopify's go along.
|
|
394
|
+
embedded({}, '/home?host=abc&tab=x&shop=acme.myshopify.com&embedded=1');
|
|
395
|
+
await screen.findByRole('heading', { name: 'Home' });
|
|
396
|
+
const bar = screen.getByRole('navigation', { name: 'Main' });
|
|
397
|
+
expect(bar.classList.contains('hl-bottom-nav')).toBe(true);
|
|
398
|
+
const links = [...bar.querySelectorAll('a')];
|
|
399
|
+
const query = '?host=abc&shop=acme.myshopify.com&embedded=1';
|
|
400
|
+
expect(links.map((link) => link.getAttribute('href'))).toEqual([
|
|
401
|
+
`/home${query}`,
|
|
402
|
+
`/stores${query}`,
|
|
403
|
+
`/usage${query}`,
|
|
404
|
+
]);
|
|
405
|
+
expect(links[0]?.getAttribute('aria-current')).toBe('page');
|
|
406
|
+
// The bell stays; More has the theme switch and no Sign out.
|
|
407
|
+
expect(await screen.findByRole('button', { name: 'Notifications' })).toBeTruthy();
|
|
408
|
+
await userEvent.click(screen.getByRole('button', { name: 'More' }));
|
|
409
|
+
const sheet = screen.getByRole('dialog', { name: 'More' });
|
|
410
|
+
expect(within(sheet).getByRole('group', { name: 'Theme' })).toBeTruthy();
|
|
411
|
+
expect(within(sheet).queryByRole('button', { name: 'Sign out' })).toBeNull();
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it('keeps Shopify’s parameters, and only those, on the tabs too', async () => {
|
|
415
|
+
embedded({}, '/home?host=abc&tab=x&shop=acme.myshopify.com');
|
|
416
|
+
await screen.findByRole('heading', { name: 'Home' });
|
|
417
|
+
const links = [...screen.getByRole('navigation', { name: 'Main' }).querySelectorAll('a')];
|
|
418
|
+
expect(links.map((link) => link.getAttribute('href'))).toEqual([
|
|
419
|
+
'/home?host=abc&shop=acme.myshopify.com',
|
|
420
|
+
'/stores?host=abc&shop=acme.myshopify.com',
|
|
421
|
+
'/usage?host=abc&shop=acme.myshopify.com',
|
|
422
|
+
]);
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
it('switches to the dark theme from More, the bar and the sheet on the dark tokens', async () => {
|
|
426
|
+
phoneWidth();
|
|
427
|
+
embedded({}, '/home?host=abc');
|
|
428
|
+
await screen.findByRole('heading', { name: 'Home' });
|
|
429
|
+
const bar = screen.getByRole('navigation', { name: 'Main' });
|
|
430
|
+
expect(getComputedStyle(bar).getPropertyValue('--hl-surface')).toBe('#FFFFFF');
|
|
431
|
+
await userEvent.click(within(bar).getByRole('button', { name: 'More' }));
|
|
432
|
+
const sheet = screen.getByRole('dialog', { name: 'More' });
|
|
433
|
+
await userEvent.click(within(sheet).getByRole('button', { name: 'Dark theme' }));
|
|
434
|
+
try {
|
|
435
|
+
expect(document.documentElement.getAttribute('data-theme')).toBe('dark');
|
|
436
|
+
expect(getComputedStyle(bar).getPropertyValue('--hl-surface')).toBe('#1C1C21');
|
|
437
|
+
expect(getComputedStyle(sheet).getPropertyValue('--hl-text')).toBe('#F2F2F5');
|
|
438
|
+
} finally {
|
|
439
|
+
document.documentElement.removeAttribute('data-theme');
|
|
440
|
+
localStorage.clear();
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
359
444
|
it('marks the page so it is styled like Shopify admin, and the standalone one is not', async () => {
|
|
360
445
|
embedded({}, '/home');
|
|
361
446
|
await screen.findByRole('heading', { name: 'Home' });
|
|
@@ -21,13 +21,8 @@ import '@fontsource/jetbrains-mono/500.css';
|
|
|
21
21
|
import './styles.css';
|
|
22
22
|
import { ApiError } from './api-client';
|
|
23
23
|
import type { ApiClient } from './api-client';
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
NotificationBell,
|
|
27
|
-
createQueryClient,
|
|
28
|
-
isUnauthorized,
|
|
29
|
-
} from '@haatlabs-core/ui/client';
|
|
30
|
-
import { AppShell, ThemeStyles } from '@haatlabs-core/ui';
|
|
24
|
+
import { NotificationBell, createQueryClient, isUnauthorized } from '@haatlabs-core/ui/client';
|
|
25
|
+
import { AppShell, MobileNav, NavIcon, ThemeStyles, useNarrow } from '@haatlabs-core/ui';
|
|
31
26
|
import type { NavGroup } from '@haatlabs-core/ui';
|
|
32
27
|
import { Logo, LogoMark } from './components/Logo';
|
|
33
28
|
import { LoginPage } from './pages/LoginPage';
|
|
@@ -72,6 +67,21 @@ function Bell({ client }: { client: ApiClient }): ReactElement {
|
|
|
72
67
|
);
|
|
73
68
|
}
|
|
74
69
|
|
|
70
|
+
/** Shopify's own query parameters, which every page of the embedded app keeps. */
|
|
71
|
+
const SHOPIFY_PARAMS = ['host', 'shop', 'embedded'];
|
|
72
|
+
|
|
73
|
+
/** `search` cut down to Shopify's parameters ('' when it has none): a page's own stay behind. */
|
|
74
|
+
function shopifyQuery(search: string): string {
|
|
75
|
+
const all = new URLSearchParams(search);
|
|
76
|
+
const kept = new URLSearchParams();
|
|
77
|
+
for (const name of SHOPIFY_PARAMS) {
|
|
78
|
+
const value = all.get(name);
|
|
79
|
+
if (value !== null) kept.set(name, value);
|
|
80
|
+
}
|
|
81
|
+
const query = kept.toString();
|
|
82
|
+
return query ? `?${query}` : '';
|
|
83
|
+
}
|
|
84
|
+
|
|
75
85
|
function Shell({
|
|
76
86
|
client,
|
|
77
87
|
mode,
|
|
@@ -84,6 +94,8 @@ function Shell({
|
|
|
84
94
|
reload: () => void;
|
|
85
95
|
}): ReactElement {
|
|
86
96
|
const queryClient = useQueryClient();
|
|
97
|
+
const narrow = useNarrow();
|
|
98
|
+
const shopify = shopifyQuery(useLocation().search);
|
|
87
99
|
const me = useQuery({ queryKey: ME_KEY, queryFn: () => client.me(), retry: false });
|
|
88
100
|
const logout = useMutation({
|
|
89
101
|
mutationFn: () => signOut(client),
|
|
@@ -123,11 +135,12 @@ function Shell({
|
|
|
123
135
|
const nav: NavGroup[] = [
|
|
124
136
|
{
|
|
125
137
|
items: [
|
|
126
|
-
|
|
127
|
-
{ label: '
|
|
128
|
-
{ label: '
|
|
138
|
+
// The pages of the phone and tablet bottom bar (at most 4; the rest go under More).
|
|
139
|
+
{ label: 'Home', to: '/home', icon: <NavIcon name="home" />, bottom: true },
|
|
140
|
+
{ label: 'Stores', to: '/stores', icon: <NavIcon name="store" />, bottom: true },
|
|
141
|
+
{ label: 'Plan and usage', to: '/usage', icon: <NavIcon name="plan" />, bottom: true },
|
|
129
142
|
#@if standalone
|
|
130
|
-
{ label: 'Find images', to: '/find-images' },
|
|
143
|
+
{ label: 'Find images', to: '/find-images', icon: <NavIcon name="images" />, bottom: true },
|
|
131
144
|
#@end
|
|
132
145
|
],
|
|
133
146
|
},
|
|
@@ -177,24 +190,36 @@ function Shell({
|
|
|
177
190
|
<Route path="*" element={<RedirectTo pathname="/home" />} />
|
|
178
191
|
</Routes>
|
|
179
192
|
);
|
|
180
|
-
if (embedded)
|
|
193
|
+
if (embedded) {
|
|
181
194
|
// Shopify's own frame already names the app and the shop, and there is nobody to
|
|
182
|
-
// sign out: one quiet navigation, as Shopify's own pages have
|
|
195
|
+
// sign out: one quiet navigation, as Shopify's own pages have; below 1024px the
|
|
196
|
+
// platform's bottom bar. Both keep Shopify's `host`, `shop` and `embedded`, nothing else.
|
|
197
|
+
const embeddedNav: NavGroup[] = [
|
|
198
|
+
{
|
|
199
|
+
items: [
|
|
200
|
+
{ label: 'Home', to: '/home', icon: <NavIcon name="home" />, bottom: true },
|
|
201
|
+
{ label: 'Store', to: '/stores', icon: <NavIcon name="store" />, bottom: true },
|
|
202
|
+
{ label: 'Plan and usage', to: '/usage', icon: <NavIcon name="plan" />, bottom: true },
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
];
|
|
183
206
|
return (
|
|
184
207
|
<>
|
|
185
|
-
{/* The dashboard's theme is not rendered here; the bell's own rules are. */}
|
|
186
|
-
<style>{NOTIFICATIONS_CSS}</style>
|
|
187
208
|
<div className="embedded-nav">
|
|
188
|
-
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
209
|
+
{!narrow && (
|
|
210
|
+
<nav aria-label="Main" className="store-nav">
|
|
211
|
+
<NavLink to={{ pathname: '/home', search: shopify }}>Home</NavLink>
|
|
212
|
+
<NavLink to={{ pathname: '/stores', search: shopify }}>Store</NavLink>
|
|
213
|
+
<NavLink to={{ pathname: '/usage', search: shopify }}>Plan and usage</NavLink>
|
|
214
|
+
</nav>
|
|
215
|
+
)}
|
|
193
216
|
<Bell client={client} />
|
|
194
217
|
</div>
|
|
195
218
|
{routes}
|
|
219
|
+
{narrow && <MobileNav nav={embeddedNav} search={shopify} />}
|
|
196
220
|
</>
|
|
197
221
|
);
|
|
222
|
+
}
|
|
198
223
|
return (
|
|
199
224
|
<AppShell
|
|
200
225
|
brand={<Logo />}
|
|
@@ -248,14 +273,14 @@ export function App({
|
|
|
248
273
|
useEffect(() => {
|
|
249
274
|
document.title = BRAND;
|
|
250
275
|
}, []);
|
|
251
|
-
// Inside Shopify admin the pages take on its
|
|
276
|
+
// Inside Shopify admin the pages take on its compact layout (see "Inside Shopify admin" in
|
|
277
|
+
// styles.css); the colours are the dashboard theme's, light, dark or the system's, there too.
|
|
252
278
|
useEffect(() => {
|
|
253
279
|
document.documentElement.classList.toggle('embedded', mode === 'embedded');
|
|
254
280
|
}, [mode]);
|
|
255
281
|
return (
|
|
256
282
|
<QueryClientProvider client={queryClient}>
|
|
257
|
-
|
|
258
|
-
{mode !== 'embedded' && <ThemeStyles accent="indigo" />}
|
|
283
|
+
<ThemeStyles accent="indigo" />
|
|
259
284
|
<BrowserRouter>
|
|
260
285
|
<ScrollToTop />
|
|
261
286
|
<Shell
|
|
@@ -285,7 +310,7 @@ import './styles.css';
|
|
|
285
310
|
import { ApiError } from './api-client';
|
|
286
311
|
import type { ApiClient } from './api-client';
|
|
287
312
|
import { NotificationBell, createQueryClient, isUnauthorized } from '@haatlabs-core/ui/client';
|
|
288
|
-
import { AppShell, ThemeStyles } from '@haatlabs-core/ui';
|
|
313
|
+
import { AppShell, NavIcon, ThemeStyles } from '@haatlabs-core/ui';
|
|
289
314
|
import type { NavGroup } from '@haatlabs-core/ui';
|
|
290
315
|
import { Logo, LogoMark } from './components/Logo';
|
|
291
316
|
import { LoginPage } from './pages/LoginPage';
|
|
@@ -358,10 +383,11 @@ function Shell({ client, reload }: { client: ApiClient; reload: () => void }): R
|
|
|
358
383
|
const nav: NavGroup[] = [
|
|
359
384
|
{
|
|
360
385
|
items: [
|
|
361
|
-
|
|
362
|
-
{ label: '
|
|
386
|
+
// The pages of the phone and tablet bottom bar (at most 4; the rest go under More).
|
|
387
|
+
{ label: 'Home', to: '/home', icon: <NavIcon name="home" />, bottom: true },
|
|
388
|
+
{ label: 'Plan and usage', to: '/usage', icon: <NavIcon name="plan" />, bottom: true },
|
|
363
389
|
#@if standalone
|
|
364
|
-
{ label: 'Find images', to: '/find-images' },
|
|
390
|
+
{ label: 'Find images', to: '/find-images', icon: <NavIcon name="images" />, bottom: true },
|
|
365
391
|
#@end
|
|
366
392
|
],
|
|
367
393
|
},
|
|
@@ -16,7 +16,10 @@ const TILES: readonly (readonly [number, number])[] = [
|
|
|
16
16
|
const SIZE = { header: 24, panel: 30 } as const;
|
|
17
17
|
|
|
18
18
|
function Mark(props: { size: number; onDark: boolean; label?: string }): ReactElement {
|
|
19
|
-
|
|
19
|
+
// On the dashboard the mark follows the theme (dark tiles on light, light tiles on dark);
|
|
20
|
+
// on the sign-in panel it is always drawn for the dark ground.
|
|
21
|
+
const tile = props.onDark ? '#FFFFFF' : 'var(--hl-text, #15171C)';
|
|
22
|
+
const centre = props.onDark ? '#8FA6FF' : 'var(--hl-accent, #2447D6)';
|
|
20
23
|
const labelled = props.label
|
|
21
24
|
? { role: 'img', 'aria-label': props.label }
|
|
22
25
|
: { 'aria-hidden': true };
|
|
@@ -30,7 +33,7 @@ function Mark(props: { size: number; onDark: boolean; label?: string }): ReactEl
|
|
|
30
33
|
width={TILE}
|
|
31
34
|
height={TILE}
|
|
32
35
|
rx={2}
|
|
33
|
-
|
|
36
|
+
style={{ fill: tile }}
|
|
34
37
|
/>
|
|
35
38
|
))}
|
|
36
39
|
<rect
|
|
@@ -39,7 +42,7 @@ function Mark(props: { size: number; onDark: boolean; label?: string }): ReactEl
|
|
|
39
42
|
width={TILE}
|
|
40
43
|
height={TILE}
|
|
41
44
|
rx={2}
|
|
42
|
-
|
|
45
|
+
style={{ fill: centre }}
|
|
43
46
|
/>
|
|
44
47
|
</svg>
|
|
45
48
|
);
|
|
@@ -3,7 +3,7 @@ import type { ReactElement } from 'react';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Where a signed-in user lands. The app's own work begins here: replace this page with
|
|
6
|
-
* the first thing a merchant does, and add a line to the
|
|
6
|
+
* the first thing a merchant does, and add a line to the menu for each page after.
|
|
7
7
|
*/
|
|
8
8
|
export function HomePage({ organizationName }: { organizationName: string }): ReactElement {
|
|
9
9
|
return (
|
|
@@ -11,13 +11,13 @@ export function HomePage({ organizationName }: { organizationName: string }): Re
|
|
|
11
11
|
#@if kindShopify
|
|
12
12
|
<PageHeader
|
|
13
13
|
title="Home"
|
|
14
|
-
subtitle={`Signed in to @@Name@@ as ${organizationName}. Your stores and your plan are in the
|
|
14
|
+
subtitle={`Signed in to @@Name@@ as ${organizationName}. Your stores and your plan are in the menu.`}
|
|
15
15
|
/>
|
|
16
16
|
#@end
|
|
17
17
|
#@if !kindShopify
|
|
18
18
|
<PageHeader
|
|
19
19
|
title="Home"
|
|
20
|
-
subtitle={`Signed in to @@Name@@ as ${organizationName}. Your plan is in the
|
|
20
|
+
subtitle={`Signed in to @@Name@@ as ${organizationName}. Your plan is in the menu.`}
|
|
21
21
|
/>
|
|
22
22
|
#@end
|
|
23
23
|
</main>
|
|
@@ -5,12 +5,14 @@ import { LogoOnDark } from '../components/Logo';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Signing in has no password: a code is sent to the email, and giving it back signs the
|
|
8
|
-
* person in. The form is the platform's; what @@Name@@ is, beside it, is its own.
|
|
8
|
+
* person in. The form is the platform's; what @@Name@@ is, beside it, is its own. On a phone
|
|
9
|
+
* or tablet the panel gives way to a slim row, on the panel's dark ground, with the logo.
|
|
9
10
|
*/
|
|
10
11
|
export function LoginPage({ client }: { client: ApiClient }): ReactElement {
|
|
11
12
|
return (
|
|
12
13
|
<SignIn
|
|
13
14
|
client={client}
|
|
15
|
+
brand={<LogoOnDark />}
|
|
14
16
|
aside={
|
|
15
17
|
<section aria-label="About @@Name@@">
|
|
16
18
|
<LogoOnDark />
|
|
@@ -1121,7 +1121,10 @@ article.candidate ul {
|
|
|
1121
1121
|
border: 0;
|
|
1122
1122
|
background: transparent;
|
|
1123
1123
|
color: var(--ink);
|
|
1124
|
-
|
|
1124
|
+
cursor: pointer;
|
|
1125
|
+
}
|
|
1126
|
+
.auth button.link:hover {
|
|
1127
|
+
color: var(--accent);
|
|
1125
1128
|
}
|
|
1126
1129
|
|
|
1127
1130
|
/* --- Plan comparison --- */
|
|
@@ -1224,19 +1227,12 @@ table.compare tfoot button + button {
|
|
|
1224
1227
|
#@if !kindShopify
|
|
1225
1228
|
* The embedded app sits in its host's own frame, so it follows that frame's look rather
|
|
1226
1229
|
#@end
|
|
1227
|
-
* than the standalone dashboard's: system type at 13px,
|
|
1228
|
-
*
|
|
1229
|
-
* `embedded` class on the
|
|
1230
|
+
* than the standalone dashboard's: system type at 13px, compact controls and plain table
|
|
1231
|
+
* headings. Its colours are still the dashboard theme's tokens (`--hl-*`), so the theme
|
|
1232
|
+
* switch (light, dark or the system's) works here too. App sets the `embedded` class on the
|
|
1233
|
+
* root element.
|
|
1230
1234
|
*/
|
|
1231
1235
|
:root.embedded {
|
|
1232
|
-
--ground: #f1f1f1;
|
|
1233
|
-
--ink: #303030;
|
|
1234
|
-
--ink-soft: #4a4a4a;
|
|
1235
|
-
--muted: #616161;
|
|
1236
|
-
--line: #e3e3e3;
|
|
1237
|
-
--line-soft: #ebebeb;
|
|
1238
|
-
--control-line: #8a8a8a;
|
|
1239
|
-
--accent: #303030;
|
|
1240
1236
|
--high-ink: #0c5132;
|
|
1241
1237
|
--high-ground: #cdfee1;
|
|
1242
1238
|
--review-ink: #5e4200;
|
|
@@ -1251,10 +1247,35 @@ table.compare tfoot button + button {
|
|
|
1251
1247
|
Inter, -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
1252
1248
|
sans-serif;
|
|
1253
1249
|
--control: 28px;
|
|
1254
|
-
--card-shadow:
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1250
|
+
--card-shadow: 0 0 0 1px var(--hl-border), 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
1251
|
+
--button-shadow: 0 0 0 1px var(--hl-border) inset;
|
|
1252
|
+
}
|
|
1253
|
+
/* The status chips on the dark theme, chosen or the system's: dark grounds, light ink. */
|
|
1254
|
+
:root.embedded[data-theme="dark"] {
|
|
1255
|
+
--high-ink: #7ee2a8;
|
|
1256
|
+
--high-ground: #143323;
|
|
1257
|
+
--review-ink: #f5c871;
|
|
1258
|
+
--review-ground: #352a10;
|
|
1259
|
+
--neutral-ink: #c9ccd3;
|
|
1260
|
+
--neutral-ground: #2c2f36;
|
|
1261
|
+
--danger-ink: #ff9c8f;
|
|
1262
|
+
--danger-ground: #3f1a16;
|
|
1263
|
+
--info-ink: #9cc8ff;
|
|
1264
|
+
--info-ground: #142a40;
|
|
1265
|
+
}
|
|
1266
|
+
@media (prefers-color-scheme: dark) {
|
|
1267
|
+
:root.embedded:not([data-theme]) {
|
|
1268
|
+
--high-ink: #7ee2a8;
|
|
1269
|
+
--high-ground: #143323;
|
|
1270
|
+
--review-ink: #f5c871;
|
|
1271
|
+
--review-ground: #352a10;
|
|
1272
|
+
--neutral-ink: #c9ccd3;
|
|
1273
|
+
--neutral-ground: #2c2f36;
|
|
1274
|
+
--danger-ink: #ff9c8f;
|
|
1275
|
+
--danger-ground: #3f1a16;
|
|
1276
|
+
--info-ink: #9cc8ff;
|
|
1277
|
+
--info-ground: #142a40;
|
|
1278
|
+
}
|
|
1258
1279
|
}
|
|
1259
1280
|
.embedded body {
|
|
1260
1281
|
font-size: 13px;
|
|
@@ -1300,22 +1321,10 @@ table.compare tfoot button + button {
|
|
|
1300
1321
|
gap: 8px;
|
|
1301
1322
|
padding: 8px 16px 0;
|
|
1302
1323
|
}
|
|
1303
|
-
/*
|
|
1304
|
-
|
|
1305
|
-
.embedded .hl-notify
|
|
1306
|
-
|
|
1307
|
-
.embedded .hl-notify-prefs {
|
|
1308
|
-
--hl-surface: #ffffff;
|
|
1309
|
-
--hl-text: #303030;
|
|
1310
|
-
--hl-muted: #616161;
|
|
1311
|
-
--hl-border: #e3e3e3;
|
|
1312
|
-
--hl-faint: #ebebeb;
|
|
1313
|
-
--hl-accent: #303030;
|
|
1314
|
-
--hl-accent-text: #303030;
|
|
1315
|
-
--hl-on-accent: #ffffff;
|
|
1316
|
-
--hl-danger: #8e1f0b;
|
|
1317
|
-
--hl-radius-card: 12px;
|
|
1318
|
-
--hl-radius-control: 8px;
|
|
1324
|
+
/* Below 1024px the tabs give way to the bottom bar: the bell keeps the row's right end, and
|
|
1325
|
+
the page ends above the bar (under "Full width" below). */
|
|
1326
|
+
.embedded-nav .hl-notify {
|
|
1327
|
+
margin-left: auto;
|
|
1319
1328
|
}
|
|
1320
1329
|
.embedded-nav .store-nav {
|
|
1321
1330
|
margin: 0;
|
|
@@ -1330,10 +1339,12 @@ table.compare tfoot button + button {
|
|
|
1330
1339
|
font-weight: 550;
|
|
1331
1340
|
}
|
|
1332
1341
|
.embedded .store-nav a:hover {
|
|
1333
|
-
background:
|
|
1342
|
+
background: var(--hl-faint);
|
|
1343
|
+
color: var(--hl-text);
|
|
1334
1344
|
}
|
|
1335
1345
|
.embedded .store-nav a[aria-current='page'] {
|
|
1336
|
-
background:
|
|
1346
|
+
background: var(--hl-accent-soft);
|
|
1347
|
+
color: var(--hl-accent-text);
|
|
1337
1348
|
box-shadow: none;
|
|
1338
1349
|
font-weight: 650;
|
|
1339
1350
|
}
|
|
@@ -1351,6 +1362,13 @@ table.compare tfoot button + button {
|
|
|
1351
1362
|
padding: 8px 16px 32px;
|
|
1352
1363
|
gap: 8px;
|
|
1353
1364
|
}
|
|
1365
|
+
@media (max-width: 1023px) {
|
|
1366
|
+
.embedded main,
|
|
1367
|
+
.embedded main.narrow,
|
|
1368
|
+
.embedded main.medium {
|
|
1369
|
+
padding-bottom: calc(56px + 32px + env(safe-area-inset-bottom));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1354
1372
|
/*
|
|
1355
1373
|
* The page scrolls at the window's edge; a form page's content keeps a readable width,
|
|
1356
1374
|
#@if kindShopify
|
|
@@ -1401,31 +1419,28 @@ table.compare tfoot button + button {
|
|
|
1401
1419
|
}
|
|
1402
1420
|
.embedded button:hover:not(:disabled),
|
|
1403
1421
|
.embedded .button:hover {
|
|
1404
|
-
background:
|
|
1422
|
+
background: var(--hl-faint);
|
|
1405
1423
|
}
|
|
1406
1424
|
.embedded button:disabled {
|
|
1407
|
-
background:
|
|
1425
|
+
background: var(--hl-faint);
|
|
1408
1426
|
box-shadow: none;
|
|
1409
|
-
color:
|
|
1427
|
+
color: var(--hl-muted);
|
|
1410
1428
|
}
|
|
1411
1429
|
.embedded button.primary,
|
|
1412
1430
|
.embedded button[type='submit'] {
|
|
1413
|
-
background:
|
|
1414
|
-
box-shadow:
|
|
1415
|
-
|
|
1416
|
-
0 0 0 1px #303030 inset,
|
|
1417
|
-
0 0.5px 0 1.5px rgba(255, 255, 255, 0.25) inset;
|
|
1418
|
-
color: #ffffff;
|
|
1431
|
+
background: var(--hl-accent);
|
|
1432
|
+
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.25) inset;
|
|
1433
|
+
color: var(--hl-on-accent);
|
|
1419
1434
|
}
|
|
1420
1435
|
.embedded button.primary:hover:not(:disabled),
|
|
1421
1436
|
.embedded button[type='submit']:hover:not(:disabled) {
|
|
1422
|
-
background: #
|
|
1437
|
+
background: color-mix(in srgb, var(--hl-accent) 85%, #000000);
|
|
1423
1438
|
}
|
|
1424
1439
|
.embedded button.primary:disabled,
|
|
1425
1440
|
.embedded button[type='submit']:disabled {
|
|
1426
|
-
background:
|
|
1441
|
+
background: var(--hl-faint);
|
|
1427
1442
|
box-shadow: none;
|
|
1428
|
-
color:
|
|
1443
|
+
color: var(--hl-muted);
|
|
1429
1444
|
}
|
|
1430
1445
|
#@if kindShopify
|
|
1431
1446
|
/* Filters: Shopify's view tabs. */
|
|
@@ -1440,11 +1455,11 @@ table.compare tfoot button + button {
|
|
|
1440
1455
|
font-weight: 550;
|
|
1441
1456
|
}
|
|
1442
1457
|
.embedded button[aria-pressed]:hover {
|
|
1443
|
-
background:
|
|
1458
|
+
background: var(--hl-faint);
|
|
1444
1459
|
}
|
|
1445
1460
|
.embedded button[aria-pressed='true'] {
|
|
1446
|
-
background:
|
|
1447
|
-
color: var(--
|
|
1461
|
+
background: var(--hl-accent-soft);
|
|
1462
|
+
color: var(--hl-accent-text);
|
|
1448
1463
|
font-weight: 650;
|
|
1449
1464
|
}
|
|
1450
1465
|
.embedded input:not([type='radio'], [type='checkbox']),
|
|
@@ -1496,7 +1511,7 @@ table.compare tfoot button + button {
|
|
|
1496
1511
|
}
|
|
1497
1512
|
.embedded thead th {
|
|
1498
1513
|
padding: 8px 12px;
|
|
1499
|
-
background:
|
|
1514
|
+
background: var(--hl-sidebar);
|
|
1500
1515
|
font-size: 12px;
|
|
1501
1516
|
font-weight: 550;
|
|
1502
1517
|
text-transform: none;
|
|
@@ -1509,14 +1524,14 @@ table.compare tfoot button + button {
|
|
|
1509
1524
|
align-items: center;
|
|
1510
1525
|
}
|
|
1511
1526
|
.embedded tbody tr:hover {
|
|
1512
|
-
background:
|
|
1527
|
+
background: var(--hl-faint);
|
|
1513
1528
|
}
|
|
1514
1529
|
.embedded td img {
|
|
1515
1530
|
width: 40px;
|
|
1516
1531
|
height: 40px;
|
|
1517
1532
|
border: 1px solid var(--line);
|
|
1518
1533
|
border-radius: 8px;
|
|
1519
|
-
background:
|
|
1534
|
+
background: var(--hl-surface);
|
|
1520
1535
|
}
|
|
1521
1536
|
.embedded article.candidate {
|
|
1522
1537
|
border: 0;
|
|
@@ -1671,7 +1686,7 @@ table.compare tfoot button + button {
|
|
|
1671
1686
|
overflow: auto;
|
|
1672
1687
|
}
|
|
1673
1688
|
.embedded .board-column {
|
|
1674
|
-
background:
|
|
1689
|
+
background: var(--hl-faint);
|
|
1675
1690
|
}
|
|
1676
1691
|
.embedded .board-column h2 {
|
|
1677
1692
|
font-size: 13px;
|