@terreno/admin-frontend 0.31.0 → 56.0.0-beta.2
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/AdminShell.d.ts +5 -0
- package/dist/AdminShell.js +100 -31
- package/dist/AdminShell.js.map +1 -1
- package/dist/ConsentHistory.d.ts +9 -0
- package/dist/ConsentHistory.js +61 -0
- package/dist/ConsentHistory.js.map +1 -0
- package/dist/generateConsentHistoryPdf.d.ts +2 -0
- package/dist/generateConsentHistoryPdf.js +225 -0
- package/dist/generateConsentHistoryPdf.js.map +1 -0
- package/dist/generateConsentPdf.js +75 -28
- package/dist/generateConsentPdf.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/pdfUtils.d.ts +9 -0
- package/dist/pdfUtils.js +25 -0
- package/dist/pdfUtils.js.map +1 -0
- package/dist/useAdminBackgroundTask.js.map +1 -1
- package/dist/useConsentHistory.d.ts +63 -0
- package/dist/useConsentHistory.js +40 -0
- package/dist/useConsentHistory.js.map +1 -0
- package/package.json +11 -9
- package/src/AdminModelForm.test.tsx +1 -1
- package/src/AdminModelList.test.tsx +1 -1
- package/src/AdminModelTable.test.tsx +1 -1
- package/src/AdminPrimitiveArrayField.test.tsx +1 -1
- package/src/AdminScriptList.test.tsx +1 -1
- package/src/AdminShell.test.tsx +191 -0
- package/src/AdminShell.tsx +331 -144
- package/src/AdminVersionConfig.test.tsx +1 -1
- package/src/CheckboxListEditor.test.tsx +1 -1
- package/src/ConfigurationScreen.test.tsx +1 -1
- package/src/ConsentFormEditor.test.tsx +1 -1
- package/src/ConsentFormList.test.tsx +1 -1
- package/src/ConsentHistory.test.tsx +161 -0
- package/src/ConsentHistory.tsx +251 -0
- package/src/ConsentResponseViewer.test.tsx +1 -1
- package/src/DocumentStorageBrowser.test.tsx +1 -1
- package/src/LocaleContentEditor.test.tsx +1 -1
- package/src/generateConsentHistoryPdf.ts +259 -0
- package/src/generateConsentPdf.ts +96 -31
- package/src/index.tsx +3 -0
- package/src/isolated/AdminFieldRenderer.isolated.tsx +1 -1
- package/src/isolated/AdminNestedArrayField.isolated.tsx +1 -1
- package/src/isolated/AdminObjectPicker.isolated.tsx +1 -1
- package/src/isolated/AdminScriptRunModal.isolated.tsx +1 -1
- package/src/isolated/DocumentStorageBrowser.isolated.tsx +1 -1
- package/src/isolated/generateConsentPdf.isolated.ts +5 -0
- package/src/pdfUtils.ts +28 -0
- package/src/useAdminBackgroundTask.ts +1 -0
- package/src/useConsentHistory.test.ts +106 -0
- package/src/useConsentHistory.ts +94 -0
package/src/AdminShell.tsx
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {Box, Heading, Spinner, Text, useTheme} from "@terreno/ui";
|
|
1
|
+
import {Box, Heading, Icon, Spinner, Text, useTheme} from "@terreno/ui";
|
|
2
2
|
import type {Href} from "expo-router";
|
|
3
3
|
import {router} from "expo-router";
|
|
4
|
-
import React, {useCallback} from "react";
|
|
4
|
+
import React, {useCallback, useEffect, useState} from "react";
|
|
5
|
+
import {useWindowDimensions} from "react-native";
|
|
6
|
+
import {SafeAreaView} from "react-native-safe-area-context";
|
|
5
7
|
import {type AdminBreadcrumbSegment, AdminBreadcrumbs} from "./AdminBreadcrumbs";
|
|
6
8
|
import {groupAdminModelsByGroup} from "./adminShellNav";
|
|
7
9
|
import type {AdminApi, AdminCustomScreen, AdminModelConfig} from "./types";
|
|
@@ -11,6 +13,9 @@ import {useAdminConfig} from "./useAdminConfig";
|
|
|
11
13
|
/** Sidebar chrome: matches Flourish admin v2 prototype (`adminv2` HTML shell). */
|
|
12
14
|
export type AdminShellSidebarVariant = "clinical" | "colorful";
|
|
13
15
|
|
|
16
|
+
/** Viewport widths below this use the hamburger + drawer navigation. */
|
|
17
|
+
export const ADMIN_SHELL_MOBILE_BREAKPOINT = 768;
|
|
18
|
+
|
|
14
19
|
export interface AdminShellProps {
|
|
15
20
|
/** @deprecated Use `apiBase`/`routeBase`. */
|
|
16
21
|
baseUrl?: string;
|
|
@@ -54,12 +59,152 @@ const NavButton: React.FC<{
|
|
|
54
59
|
</Box>
|
|
55
60
|
);
|
|
56
61
|
|
|
62
|
+
interface AdminShellSidebarNavProps {
|
|
63
|
+
allCustomScreens: AdminCustomScreen[];
|
|
64
|
+
configurationPath?: string;
|
|
65
|
+
footer?: React.ReactNode;
|
|
66
|
+
grouped: ReturnType<typeof groupAdminModelsByGroup>;
|
|
67
|
+
navigate: (path: string) => void;
|
|
68
|
+
onNavigate?: () => void;
|
|
69
|
+
scripts: {name: string}[];
|
|
70
|
+
sidebarVariant: AdminShellSidebarVariant;
|
|
71
|
+
versionConfigPath: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const AdminShellSidebarNav: React.FC<AdminShellSidebarNavProps> = ({
|
|
75
|
+
allCustomScreens,
|
|
76
|
+
configurationPath,
|
|
77
|
+
footer,
|
|
78
|
+
grouped,
|
|
79
|
+
navigate,
|
|
80
|
+
onNavigate,
|
|
81
|
+
scripts,
|
|
82
|
+
sidebarVariant,
|
|
83
|
+
versionConfigPath,
|
|
84
|
+
}) => {
|
|
85
|
+
const sidebarIsColorful = sidebarVariant === "colorful";
|
|
86
|
+
const sectionLabelColor = sidebarIsColorful ? "inverted" : "secondaryDark";
|
|
87
|
+
|
|
88
|
+
const runNav = useCallback(
|
|
89
|
+
(action: () => void): void => {
|
|
90
|
+
action();
|
|
91
|
+
onNavigate?.();
|
|
92
|
+
},
|
|
93
|
+
[onNavigate]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<Box direction="column" flex="grow" gap={3} minHeight={0} overflow="scrollY">
|
|
99
|
+
<NavButton
|
|
100
|
+
label="Home"
|
|
101
|
+
onPress={() => {
|
|
102
|
+
runNav(() => {
|
|
103
|
+
navigate("/");
|
|
104
|
+
});
|
|
105
|
+
}}
|
|
106
|
+
sidebarVariant={sidebarVariant}
|
|
107
|
+
testID="admin-shell-nav-home"
|
|
108
|
+
/>
|
|
109
|
+
<Box direction="column" gap={1}>
|
|
110
|
+
<Text bold color={sectionLabelColor} size="sm">
|
|
111
|
+
Tools
|
|
112
|
+
</Text>
|
|
113
|
+
{scripts.length > 0 ? (
|
|
114
|
+
<NavButton
|
|
115
|
+
label="Scripts"
|
|
116
|
+
onPress={() => {
|
|
117
|
+
runNav(() => {
|
|
118
|
+
navigate("/__scripts");
|
|
119
|
+
});
|
|
120
|
+
}}
|
|
121
|
+
sidebarVariant={sidebarVariant}
|
|
122
|
+
testID="admin-shell-nav-scripts"
|
|
123
|
+
/>
|
|
124
|
+
) : null}
|
|
125
|
+
<NavButton
|
|
126
|
+
label="Version"
|
|
127
|
+
onPress={() => {
|
|
128
|
+
runNav(() => {
|
|
129
|
+
navigate(versionConfigPath);
|
|
130
|
+
});
|
|
131
|
+
}}
|
|
132
|
+
sidebarVariant={sidebarVariant}
|
|
133
|
+
testID="admin-shell-nav-version"
|
|
134
|
+
/>
|
|
135
|
+
</Box>
|
|
136
|
+
<Box direction="column" gap={1}>
|
|
137
|
+
<Text bold color={sectionLabelColor} size="sm">
|
|
138
|
+
Models
|
|
139
|
+
</Text>
|
|
140
|
+
{grouped.map(({group, models}) => (
|
|
141
|
+
<Box direction="column" gap={1} key={group}>
|
|
142
|
+
<Text bold color={sectionLabelColor} size="sm">
|
|
143
|
+
{group}
|
|
144
|
+
</Text>
|
|
145
|
+
{models.map((model) => (
|
|
146
|
+
<NavButton
|
|
147
|
+
key={model.name}
|
|
148
|
+
label={model.displayName}
|
|
149
|
+
onPress={() => {
|
|
150
|
+
runNav(() => {
|
|
151
|
+
navigate(`/${model.name}`);
|
|
152
|
+
});
|
|
153
|
+
}}
|
|
154
|
+
sidebarVariant={sidebarVariant}
|
|
155
|
+
testID={`admin-shell-nav-model-${model.name}`}
|
|
156
|
+
/>
|
|
157
|
+
))}
|
|
158
|
+
</Box>
|
|
159
|
+
))}
|
|
160
|
+
</Box>
|
|
161
|
+
{allCustomScreens.length > 0 ? (
|
|
162
|
+
<Box direction="column" gap={1}>
|
|
163
|
+
<Text bold color={sectionLabelColor} size="sm">
|
|
164
|
+
Screens
|
|
165
|
+
</Text>
|
|
166
|
+
{allCustomScreens.map((screen) => (
|
|
167
|
+
<NavButton
|
|
168
|
+
key={screen.name}
|
|
169
|
+
label={screen.displayName}
|
|
170
|
+
onPress={() => {
|
|
171
|
+
runNav(() => {
|
|
172
|
+
navigate(`/${screen.name}`);
|
|
173
|
+
});
|
|
174
|
+
}}
|
|
175
|
+
sidebarVariant={sidebarVariant}
|
|
176
|
+
testID={`admin-shell-nav-screen-${screen.name}`}
|
|
177
|
+
/>
|
|
178
|
+
))}
|
|
179
|
+
</Box>
|
|
180
|
+
) : null}
|
|
181
|
+
{configurationPath ? (
|
|
182
|
+
<NavButton
|
|
183
|
+
label="Configuration"
|
|
184
|
+
onPress={() => {
|
|
185
|
+
runNav(() => {
|
|
186
|
+
router.push(configurationPath as Href);
|
|
187
|
+
});
|
|
188
|
+
}}
|
|
189
|
+
sidebarVariant={sidebarVariant}
|
|
190
|
+
testID="admin-shell-nav-configuration"
|
|
191
|
+
/>
|
|
192
|
+
) : null}
|
|
193
|
+
</Box>
|
|
194
|
+
{footer ? <Box marginTop={4}>{footer}</Box> : null}
|
|
195
|
+
</>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
57
199
|
/**
|
|
58
200
|
* Admin UI v2 shell: grouped sidebar navigation, optional breadcrumbs, and main area.
|
|
59
201
|
*
|
|
60
202
|
* Intended for standalone admin SPA or embedded admin: pair with list/table/form screens
|
|
61
203
|
* as `children`. Fetches `/admin/config` once for the sidebar (Tools, grouped Models, Screens).
|
|
62
204
|
*
|
|
205
|
+
* Below {@link ADMIN_SHELL_MOBILE_BREAKPOINT}px, the fixed sidebar becomes a hamburger-triggered
|
|
206
|
+
* left slide-over drawer.
|
|
207
|
+
*
|
|
63
208
|
* For Expo Router admin roots, prefer {@link AdminShellLayout}: it wraps `children` in a flex
|
|
64
209
|
* main column so a nested `<Stack />` fills the area beside the sidebar without repeating layout
|
|
65
210
|
* boilerplate in each app.
|
|
@@ -79,6 +224,9 @@ export const AdminShell: React.FC<AdminShellProps> = ({
|
|
|
79
224
|
versionConfigPath = "/version-config",
|
|
80
225
|
}) => {
|
|
81
226
|
const {theme} = useTheme();
|
|
227
|
+
const {width: windowWidth} = useWindowDimensions();
|
|
228
|
+
const isMobileLayout = windowWidth < ADMIN_SHELL_MOBILE_BREAKPOINT;
|
|
229
|
+
const [isNavOpen, setIsNavOpen] = useState(false);
|
|
82
230
|
const {apiBase: resolvedApiBase, routeBase: resolvedRouteBase} = resolveAdminBases({
|
|
83
231
|
apiBase,
|
|
84
232
|
baseUrl,
|
|
@@ -98,6 +246,21 @@ export const AdminShell: React.FC<AdminShellProps> = ({
|
|
|
98
246
|
[resolvedRouteBase]
|
|
99
247
|
);
|
|
100
248
|
|
|
249
|
+
const closeNav = useCallback((): void => {
|
|
250
|
+
setIsNavOpen(false);
|
|
251
|
+
}, []);
|
|
252
|
+
|
|
253
|
+
const openNav = useCallback((): void => {
|
|
254
|
+
setIsNavOpen(true);
|
|
255
|
+
}, []);
|
|
256
|
+
|
|
257
|
+
// Close the mobile drawer when the viewport returns to desktop width.
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (!isMobileLayout && isNavOpen) {
|
|
260
|
+
setIsNavOpen(false);
|
|
261
|
+
}
|
|
262
|
+
}, [isMobileLayout, isNavOpen]);
|
|
263
|
+
|
|
101
264
|
if (isLoading) {
|
|
102
265
|
return (
|
|
103
266
|
<Box
|
|
@@ -126,171 +289,195 @@ export const AdminShell: React.FC<AdminShellProps> = ({
|
|
|
126
289
|
const grouped = groupAdminModelsByGroup(config.models as AdminModelConfig[]);
|
|
127
290
|
|
|
128
291
|
const sidebarIsColorful = sidebarVariant === "colorful";
|
|
129
|
-
const sectionLabelColor = sidebarIsColorful ? "inverted" : "secondaryDark";
|
|
130
|
-
|
|
131
292
|
const showTopBar = Boolean(headerActions) || Boolean(breadcrumbs && breadcrumbs.length > 0);
|
|
132
293
|
|
|
294
|
+
const sidebarNavProps: AdminShellSidebarNavProps = {
|
|
295
|
+
allCustomScreens,
|
|
296
|
+
configurationPath,
|
|
297
|
+
footer,
|
|
298
|
+
grouped,
|
|
299
|
+
navigate,
|
|
300
|
+
scripts,
|
|
301
|
+
sidebarVariant,
|
|
302
|
+
versionConfigPath,
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const sidebarChromeProps = {
|
|
306
|
+
border: sidebarIsColorful ? undefined : ("default" as const),
|
|
307
|
+
color: sidebarIsColorful ? ("secondaryDark" as const) : ("base" as const),
|
|
308
|
+
};
|
|
309
|
+
|
|
133
310
|
return (
|
|
134
|
-
<
|
|
311
|
+
<SafeAreaView edges={["top", "bottom"]} style={{flex: 1}}>
|
|
135
312
|
<Box
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
313
|
+
dangerouslySetInlineStyle={{
|
|
314
|
+
__style: {position: "relative"},
|
|
315
|
+
}}
|
|
316
|
+
direction="row"
|
|
317
|
+
flex="grow"
|
|
318
|
+
minHeight="100%"
|
|
319
|
+
testID="admin-shell"
|
|
143
320
|
>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<Text bold color={sectionLabelColor} size="sm">
|
|
158
|
-
Tools
|
|
159
|
-
</Text>
|
|
160
|
-
{scripts.length > 0 ? (
|
|
161
|
-
<NavButton
|
|
162
|
-
label="Scripts"
|
|
163
|
-
onPress={() => {
|
|
164
|
-
navigate("/__scripts");
|
|
165
|
-
}}
|
|
166
|
-
sidebarVariant={sidebarVariant}
|
|
167
|
-
testID="admin-shell-nav-scripts"
|
|
168
|
-
/>
|
|
169
|
-
) : null}
|
|
170
|
-
<NavButton
|
|
171
|
-
label="Version"
|
|
172
|
-
onPress={() => {
|
|
173
|
-
navigate(versionConfigPath);
|
|
174
|
-
}}
|
|
175
|
-
sidebarVariant={sidebarVariant}
|
|
176
|
-
testID="admin-shell-nav-version"
|
|
177
|
-
/>
|
|
321
|
+
{!isMobileLayout ? (
|
|
322
|
+
<Box
|
|
323
|
+
{...sidebarChromeProps}
|
|
324
|
+
direction="column"
|
|
325
|
+
gap={3}
|
|
326
|
+
padding={3}
|
|
327
|
+
testID="admin-shell-sidebar"
|
|
328
|
+
width={280}
|
|
329
|
+
>
|
|
330
|
+
<Heading {...(sidebarIsColorful ? {color: "inverted"} : {})} size="sm">
|
|
331
|
+
Admin
|
|
332
|
+
</Heading>
|
|
333
|
+
<AdminShellSidebarNav {...sidebarNavProps} />
|
|
178
334
|
</Box>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
335
|
+
) : null}
|
|
336
|
+
<Box
|
|
337
|
+
dangerouslySetInlineStyle={{
|
|
338
|
+
__style: {backgroundColor: theme.primitives.neutral050},
|
|
339
|
+
}}
|
|
340
|
+
direction="column"
|
|
341
|
+
flex="grow"
|
|
342
|
+
minWidth={0}
|
|
343
|
+
>
|
|
344
|
+
{isMobileLayout ? (
|
|
345
|
+
<Box
|
|
346
|
+
alignItems="center"
|
|
347
|
+
borderBottom="default"
|
|
348
|
+
color="base"
|
|
349
|
+
direction="row"
|
|
350
|
+
gap={2}
|
|
351
|
+
padding={2}
|
|
352
|
+
testID="admin-shell-mobile-header"
|
|
353
|
+
>
|
|
354
|
+
<Box
|
|
355
|
+
accessibilityHint="Opens the admin navigation menu"
|
|
356
|
+
accessibilityLabel="Open navigation menu"
|
|
357
|
+
onClick={openNav}
|
|
358
|
+
padding={1}
|
|
359
|
+
testID="admin-shell-menu-button"
|
|
360
|
+
>
|
|
361
|
+
<Icon color="primary" iconName="bars" size="md" />
|
|
199
362
|
</Box>
|
|
200
|
-
|
|
201
|
-
</Box>
|
|
202
|
-
{allCustomScreens.length > 0 ? (
|
|
203
|
-
<Box direction="column" gap={1}>
|
|
204
|
-
<Text bold color={sectionLabelColor} size="sm">
|
|
205
|
-
Screens
|
|
206
|
-
</Text>
|
|
207
|
-
{allCustomScreens.map((screen) => (
|
|
208
|
-
<NavButton
|
|
209
|
-
key={screen.name}
|
|
210
|
-
label={screen.displayName}
|
|
211
|
-
onPress={() => {
|
|
212
|
-
navigate(`/${screen.name}`);
|
|
213
|
-
}}
|
|
214
|
-
sidebarVariant={sidebarVariant}
|
|
215
|
-
testID={`admin-shell-nav-screen-${screen.name}`}
|
|
216
|
-
/>
|
|
217
|
-
))}
|
|
363
|
+
<Heading size="sm">Admin</Heading>
|
|
218
364
|
</Box>
|
|
219
365
|
) : null}
|
|
220
|
-
{
|
|
221
|
-
<
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
366
|
+
{showTopBar ? (
|
|
367
|
+
<Box
|
|
368
|
+
alignItems="center"
|
|
369
|
+
borderBottom="default"
|
|
370
|
+
color="base"
|
|
371
|
+
dangerouslySetInlineStyle={{
|
|
372
|
+
__style: {
|
|
373
|
+
paddingBottom: 12,
|
|
374
|
+
paddingLeft: 28,
|
|
375
|
+
paddingRight: 28,
|
|
376
|
+
paddingTop: 12,
|
|
377
|
+
},
|
|
225
378
|
}}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
379
|
+
direction="row"
|
|
380
|
+
justifyContent="between"
|
|
381
|
+
minWidth={0}
|
|
382
|
+
testID="admin-shell-top-bar"
|
|
383
|
+
>
|
|
384
|
+
<Box flex="grow" minWidth={0}>
|
|
385
|
+
{breadcrumbs && breadcrumbs.length > 0 ? (
|
|
386
|
+
<AdminBreadcrumbs segments={breadcrumbs} />
|
|
387
|
+
) : (
|
|
388
|
+
<Box />
|
|
389
|
+
)}
|
|
390
|
+
</Box>
|
|
391
|
+
{headerActions ? (
|
|
392
|
+
<Box flex="shrink" marginLeft={3}>
|
|
393
|
+
{headerActions}
|
|
394
|
+
</Box>
|
|
395
|
+
) : null}
|
|
396
|
+
</Box>
|
|
229
397
|
) : null}
|
|
230
|
-
</Box>
|
|
231
|
-
{footer ? <Box marginTop={4}>{footer}</Box> : null}
|
|
232
|
-
</Box>
|
|
233
|
-
<Box
|
|
234
|
-
dangerouslySetInlineStyle={{
|
|
235
|
-
__style: {backgroundColor: theme.primitives.neutral050},
|
|
236
|
-
}}
|
|
237
|
-
direction="column"
|
|
238
|
-
flex="grow"
|
|
239
|
-
minWidth={0}
|
|
240
|
-
>
|
|
241
|
-
{showTopBar ? (
|
|
242
398
|
<Box
|
|
243
|
-
alignItems="
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
paddingBottom: 12,
|
|
249
|
-
paddingLeft: 28,
|
|
250
|
-
paddingRight: 28,
|
|
251
|
-
paddingTop: 12,
|
|
252
|
-
},
|
|
253
|
-
}}
|
|
254
|
-
direction="row"
|
|
255
|
-
justifyContent="between"
|
|
256
|
-
minWidth={0}
|
|
257
|
-
testID="admin-shell-top-bar"
|
|
399
|
+
alignItems="stretch"
|
|
400
|
+
flex="grow"
|
|
401
|
+
minHeight={0}
|
|
402
|
+
testID="admin-shell-main"
|
|
403
|
+
width="100%"
|
|
258
404
|
>
|
|
259
|
-
<Box
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
405
|
+
<Box
|
|
406
|
+
alignSelf="center"
|
|
407
|
+
dangerouslySetInlineStyle={{
|
|
408
|
+
__style: {
|
|
409
|
+
boxSizing: "border-box",
|
|
410
|
+
maxWidth: 1280,
|
|
411
|
+
padding: "24px 28px 80px",
|
|
412
|
+
width: "100%",
|
|
413
|
+
},
|
|
414
|
+
}}
|
|
415
|
+
flex="grow"
|
|
416
|
+
minHeight={0}
|
|
417
|
+
width="100%"
|
|
418
|
+
>
|
|
419
|
+
<Box flex="grow" minHeight={0}>
|
|
420
|
+
{children}
|
|
269
421
|
</Box>
|
|
270
|
-
|
|
422
|
+
</Box>
|
|
271
423
|
</Box>
|
|
272
|
-
|
|
273
|
-
|
|
424
|
+
</Box>
|
|
425
|
+
{isMobileLayout && isNavOpen ? (
|
|
274
426
|
<Box
|
|
275
|
-
alignSelf="center"
|
|
276
427
|
dangerouslySetInlineStyle={{
|
|
277
428
|
__style: {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
429
|
+
bottom: 0,
|
|
430
|
+
left: 0,
|
|
431
|
+
position: "absolute",
|
|
432
|
+
right: 0,
|
|
433
|
+
top: 0,
|
|
434
|
+
zIndex: 1000,
|
|
282
435
|
},
|
|
283
436
|
}}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
width="100%"
|
|
437
|
+
direction="row"
|
|
438
|
+
testID="admin-shell-drawer"
|
|
287
439
|
>
|
|
288
|
-
<Box
|
|
289
|
-
{
|
|
440
|
+
<Box
|
|
441
|
+
{...sidebarChromeProps}
|
|
442
|
+
direction="column"
|
|
443
|
+
gap={3}
|
|
444
|
+
padding={3}
|
|
445
|
+
testID="admin-shell-drawer-panel"
|
|
446
|
+
width={280}
|
|
447
|
+
>
|
|
448
|
+
<Box alignItems="center" direction="row" justifyContent="between">
|
|
449
|
+
<Heading {...(sidebarIsColorful ? {color: "inverted"} : {})} size="sm">
|
|
450
|
+
Admin
|
|
451
|
+
</Heading>
|
|
452
|
+
<Box
|
|
453
|
+
accessibilityHint="Closes the admin navigation menu"
|
|
454
|
+
accessibilityLabel="Close navigation menu"
|
|
455
|
+
onClick={closeNav}
|
|
456
|
+
padding={1}
|
|
457
|
+
testID="admin-shell-drawer-close"
|
|
458
|
+
>
|
|
459
|
+
<Icon
|
|
460
|
+
color={sidebarIsColorful ? "inverted" : "primary"}
|
|
461
|
+
iconName="xmark"
|
|
462
|
+
size="md"
|
|
463
|
+
/>
|
|
464
|
+
</Box>
|
|
465
|
+
</Box>
|
|
466
|
+
<AdminShellSidebarNav {...sidebarNavProps} onNavigate={closeNav} />
|
|
290
467
|
</Box>
|
|
468
|
+
<Box
|
|
469
|
+
accessibilityHint="Dismisses the navigation menu"
|
|
470
|
+
accessibilityLabel="Dismiss navigation menu"
|
|
471
|
+
dangerouslySetInlineStyle={{
|
|
472
|
+
__style: {backgroundColor: "rgba(0, 0, 0, 0.45)", flex: 1},
|
|
473
|
+
}}
|
|
474
|
+
flex="grow"
|
|
475
|
+
onClick={closeNav}
|
|
476
|
+
testID="admin-shell-drawer-backdrop"
|
|
477
|
+
/>
|
|
291
478
|
</Box>
|
|
292
|
-
|
|
479
|
+
) : null}
|
|
293
480
|
</Box>
|
|
294
|
-
</
|
|
481
|
+
</SafeAreaView>
|
|
295
482
|
);
|
|
296
483
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
8
8
|
import type {AdminApi} from "./types";
|
|
9
9
|
|
|
10
10
|
const routerBack = mock(() => {});
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
8
8
|
import {CheckboxListEditor} from "./CheckboxListEditor";
|
|
9
9
|
|
|
10
10
|
const press = async (el: ReactTestInstance): Promise<void> => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
7
7
|
import type {AdminApi} from "./types";
|
|
8
8
|
|
|
9
9
|
interface QueryState<T> {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
8
8
|
import type {AdminApi} from "./types";
|
|
9
9
|
|
|
10
10
|
interface State {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
8
8
|
import type {AdminApi} from "./types";
|
|
9
9
|
|
|
10
10
|
interface ListState {
|