@adminide-stack/yantra-mobile 12.0.162-alpha.0 → 12.0.162-alpha.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/lib/components/CustomDrawer.js +70 -3
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +3 -1
- package/lib/config/env-config.js +4 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/credits/credits.js +151 -0
- package/lib/features/credits/credits.js.map +1 -0
- package/lib/features/credits/useLlmCredits.js +87 -0
- package/lib/features/credits/useLlmCredits.js.map +1 -0
- package/lib/features/design/surface/agentWriter.js +39 -0
- package/lib/features/design/surface/agentWriter.js.map +1 -0
- package/lib/features/design/surface/brandKit.js +9 -3
- package/lib/features/design/surface/brandKit.js.map +1 -1
- package/lib/features/design/surface/useBrandKitInUse.js.map +1 -1
- package/lib/features/design/surface/useDesignSurface.js +5 -39
- package/lib/features/design/surface/useDesignSurface.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +64 -23
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/brandKitMove.js +52 -0
- package/lib/features/webbuilder/brandKitMove.js.map +1 -0
- package/lib/features/webbuilder/codeToolbox.js +129 -0
- package/lib/features/webbuilder/codeToolbox.js.map +1 -0
- package/lib/features/webbuilder/components/CloudSheet.js +1451 -0
- package/lib/features/webbuilder/components/CloudSheet.js.map +1 -0
- package/lib/features/webbuilder/components/CodeActionsSheet.js +125 -0
- package/lib/features/webbuilder/components/CodeActionsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/CodeView.js +10 -3
- package/lib/features/webbuilder/components/CodeView.js.map +1 -1
- package/lib/features/webbuilder/components/Composer.js.map +1 -1
- package/lib/features/webbuilder/components/IntegrationsPanel.js +643 -0
- package/lib/features/webbuilder/components/IntegrationsPanel.js.map +1 -0
- package/lib/features/webbuilder/components/ProjectChat.js +57 -44
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/SecretsSheet.js +235 -0
- package/lib/features/webbuilder/components/SecretsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/StudioHome.js +38 -1
- package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
- package/lib/features/webbuilder/studioCatalog.js +4 -19
- package/lib/features/webbuilder/studioCatalog.js.map +1 -1
- package/lib/features/webbuilder/web/data/cloud.js +387 -0
- package/lib/features/webbuilder/web/data/cloud.js.map +1 -0
- package/lib/features/webbuilder/web/data/dataApi.js +227 -0
- package/lib/features/webbuilder/web/data/dataApi.js.map +1 -0
- package/lib/features/webbuilder/web/data/database.js +190 -0
- package/lib/features/webbuilder/web/data/database.js.map +1 -0
- package/lib/features/webbuilder/web/data/graphql.js +95 -0
- package/lib/features/webbuilder/web/data/graphql.js.map +1 -0
- package/lib/features/webbuilder/web/design/directions.js +343 -0
- package/lib/features/webbuilder/web/design/directions.js.map +1 -0
- package/lib/features/webbuilder/web/integrations/appToken.js +165 -0
- package/lib/features/webbuilder/web/integrations/appToken.js.map +1 -0
- package/lib/features/webbuilder/web/integrations/catalog.js +238 -0
- package/lib/features/webbuilder/web/integrations/catalog.js.map +1 -0
- package/lib/features/webbuilder/web/integrations/siteBilling.js +67 -0
- package/lib/features/webbuilder/web/integrations/siteBilling.js.map +1 -0
- package/lib/features/webbuilder/web/integrations/siteMail.js +190 -0
- package/lib/features/webbuilder/web/integrations/siteMail.js.map +1 -0
- package/lib/features/webbuilder/web/project/projectSettings.js +11 -0
- package/lib/features/webbuilder/web/project/projectSettings.js.map +1 -0
- package/lib/features/webbuilder/web/project/restorePoint.js +16 -0
- package/lib/features/webbuilder/web/project/restorePoint.js.map +1 -0
- package/lib/features/webbuilder/web/project/serverSettings.js +157 -0
- package/lib/features/webbuilder/web/project/serverSettings.js.map +1 -0
- package/lib/features/webbuilder/web/secrets/secrets.js +162 -0
- package/lib/features/webbuilder/web/secrets/secrets.js.map +1 -0
- package/lib/features/webbuilder/web/secrets/secretsApi.js +302 -0
- package/lib/features/webbuilder/web/secrets/secretsApi.js.map +1 -0
- package/lib/features/webbuilder/web/secrets/secretsStore.js +39 -0
- package/lib/features/webbuilder/web/secrets/secretsStore.js.map +1 -0
- package/lib/features/webbuilder/web/sharing/okResult.js +40 -0
- package/lib/features/webbuilder/web/sharing/okResult.js.map +1 -0
- package/lib/features/webbuilder/web/sharing/roles.js +3 -0
- package/lib/features/webbuilder/web/sharing/roles.js.map +1 -0
- package/lib/features/webbuilder/web/state/storageKeys.js +59 -0
- package/lib/features/webbuilder/web/state/storageKeys.js.map +1 -0
- package/lib/features/webbuilder/web/webServices.js +282 -0
- package/lib/features/webbuilder/web/webServices.js.map +1 -0
- package/lib/features/webbuilder/workflow.js +1 -1
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/routes.json +3 -1
- package/lib/screens/Account/AccountSheets.js +1049 -0
- package/lib/screens/Account/AccountSheets.js.map +1 -0
- package/lib/screens/Account/WorkspaceSection.js +271 -0
- package/lib/screens/Account/WorkspaceSection.js.map +1 -0
- package/lib/screens/Account/accountRules.js +103 -0
- package/lib/screens/Account/accountRules.js.map +1 -0
- package/lib/screens/Account/index.js +563 -259
- package/lib/screens/Account/index.js.map +1 -1
- package/lib/screens/Account/useAccountPreferences.js +87 -0
- package/lib/screens/Account/useAccountPreferences.js.map +1 -0
- package/lib/screens/WebBuilderNative/index.js +1 -1
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +122 -12
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/utils/authUserDisplay.js +1 -9
- package/lib/utils/authUserDisplay.js.map +1 -1
- package/package.json +4 -4
- package/lib/features/webbuilder/brandKitStorage.js +0 -69
- package/lib/features/webbuilder/brandKitStorage.js.map +0 -1
- package/lib/features/webbuilder/components/BrandKitSheet.js +0 -197
- package/lib/features/webbuilder/components/BrandKitSheet.js.map +0 -1
- package/lib/screens/Account/splitDisplayName.js +0 -15
- package/lib/screens/Account/splitDisplayName.js.map +0 -1
|
@@ -0,0 +1,1451 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useCallback,useEffect,useRef}from'react';import {StyleSheet,useWindowDimensions,View,Text,ScrollView,Linking,ActivityIndicator,TextInput,Alert,Clipboard}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Tap,DIM}from'../../inbox/components/Tap.js';import {OUTDATED_SERVER_MESSAGE}from'../web/data/graphql.js';import {hasProvisionedDatabase,ADD_DATABASE_REQUEST,mapTables,ROWS_PAGE_SIZE,formatRowEstimate,pageInfo,formatCell,mapUsers,mapMigrations}from'../web/data/database.js';import {cloudTabs,CLOUD_TAB_LABELS,rawRows,mapColumns,primaryKeyOf,insertableColumns,editText,rowKey,canEditCell,sqlResultLabel,mapHealth,groupLints,LINT_LEVEL_LABELS,lintFixRequest,indexAdviceRequest,mapAuthUsers,isBanned,mapFiles,mapBuckets,parentPrefix,joinPath,formatBytes,componentsOf,OPTIONAL_COMPONENTS,toggleComponent,buildCellUpdate,buildRowInsert,buildRowDelete,isEmailLike,BAN_CHOICES,isValidBucketName,studioPageUrl,mapSqlResult,isValidFileName,MAX_UPLOAD_BYTES}from'../web/data/cloud.js';import {PrimaryButton,Sheet}from'./ui.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
function failureText(r) {
|
|
21
|
+
if (r.ok) return "";
|
|
22
|
+
return r.outdated ? `${OUTDATED_SERVER_MESSAGE}.` : r.message || "The server couldn't do that right now.";
|
|
23
|
+
}
|
|
24
|
+
function shortDate(iso) {
|
|
25
|
+
if (!iso) return "-";
|
|
26
|
+
const d = new Date(iso);
|
|
27
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
28
|
+
return d.toLocaleString(void 0, {
|
|
29
|
+
dateStyle: "medium",
|
|
30
|
+
timeStyle: "short"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function confirm(title, message, label, onConfirm) {
|
|
34
|
+
Alert.alert(title, message, [{
|
|
35
|
+
text: "Cancel",
|
|
36
|
+
style: "cancel"
|
|
37
|
+
}, {
|
|
38
|
+
text: label,
|
|
39
|
+
style: "destructive",
|
|
40
|
+
onPress: onConfirm
|
|
41
|
+
}]);
|
|
42
|
+
}
|
|
43
|
+
function Line({
|
|
44
|
+
text,
|
|
45
|
+
tone,
|
|
46
|
+
theme
|
|
47
|
+
}) {
|
|
48
|
+
if (!text) return null;
|
|
49
|
+
return /* @__PURE__ */ jsx(View, { style: [styles.banner, {
|
|
50
|
+
backgroundColor: tone === "error" ? theme.critSoft : theme.accentSoft
|
|
51
|
+
}], children: /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
52
|
+
color: tone === "error" ? theme.crit : theme.ink
|
|
53
|
+
}], children: text }) });
|
|
54
|
+
}
|
|
55
|
+
function Empty({
|
|
56
|
+
text,
|
|
57
|
+
theme
|
|
58
|
+
}) {
|
|
59
|
+
if (!text) return null;
|
|
60
|
+
return /* @__PURE__ */ jsx(Text, { style: [styles.small, styles.empty, {
|
|
61
|
+
color: theme.muted
|
|
62
|
+
}], children: text });
|
|
63
|
+
}
|
|
64
|
+
function Loading({
|
|
65
|
+
theme
|
|
66
|
+
}) {
|
|
67
|
+
return /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent, style: styles.spin });
|
|
68
|
+
}
|
|
69
|
+
function IconButton({
|
|
70
|
+
icon,
|
|
71
|
+
label,
|
|
72
|
+
onPress,
|
|
73
|
+
disabled,
|
|
74
|
+
color,
|
|
75
|
+
theme
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx(Tap, { onPress: disabled ? void 0 : onPress, accessibilityRole: "button", accessibilityLabel: label, accessibilityState: {
|
|
78
|
+
disabled: Boolean(disabled)
|
|
79
|
+
}, hitSlop: 8, pressedStyle: DIM, style: [styles.iconBtn, disabled ? styles.off : null], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 19, color: color != null ? color : theme.muted }) });
|
|
80
|
+
}
|
|
81
|
+
function Pill({
|
|
82
|
+
label,
|
|
83
|
+
icon,
|
|
84
|
+
onPress,
|
|
85
|
+
disabled,
|
|
86
|
+
busy,
|
|
87
|
+
tone = "plain",
|
|
88
|
+
theme,
|
|
89
|
+
testID
|
|
90
|
+
}) {
|
|
91
|
+
let bg = theme.chip;
|
|
92
|
+
if (tone === "primary") bg = theme.accent;
|
|
93
|
+
else if (tone === "danger") bg = theme.crit;
|
|
94
|
+
const fg = tone === "plain" ? theme.ink : theme.screen;
|
|
95
|
+
let lead = null;
|
|
96
|
+
if (busy) lead = /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: fg });
|
|
97
|
+
else if (icon) lead = /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 15, color: fg });
|
|
98
|
+
return /* @__PURE__ */ jsxs(Tap, { onPress: disabled || busy ? void 0 : onPress, accessibilityRole: "button", accessibilityLabel: label, accessibilityState: {
|
|
99
|
+
disabled: Boolean(disabled),
|
|
100
|
+
busy: Boolean(busy)
|
|
101
|
+
}, pressedStyle: DIM, style: [styles.pill, {
|
|
102
|
+
backgroundColor: bg
|
|
103
|
+
}, disabled ? styles.off : null], testID, children: [
|
|
104
|
+
lead,
|
|
105
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.pillLabel, {
|
|
106
|
+
color: fg
|
|
107
|
+
}], children: label })
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
function Field({
|
|
111
|
+
value,
|
|
112
|
+
onChangeText,
|
|
113
|
+
placeholder,
|
|
114
|
+
label,
|
|
115
|
+
theme,
|
|
116
|
+
mono,
|
|
117
|
+
multiline,
|
|
118
|
+
keyboardType
|
|
119
|
+
}) {
|
|
120
|
+
return /* @__PURE__ */ jsx(TextInput, { value, onChangeText, placeholder, placeholderTextColor: theme.faint, autoCapitalize: "none", autoCorrect: false, spellCheck: false, multiline, keyboardType, accessibilityLabel: label, style: [styles.input, mono ? styles.mono : null, multiline ? styles.multiline : null, {
|
|
121
|
+
color: theme.ink,
|
|
122
|
+
borderColor: theme.border,
|
|
123
|
+
backgroundColor: theme.screen
|
|
124
|
+
}] });
|
|
125
|
+
}
|
|
126
|
+
function Grid({
|
|
127
|
+
columns,
|
|
128
|
+
rows,
|
|
129
|
+
theme,
|
|
130
|
+
keyColumns = [],
|
|
131
|
+
lead,
|
|
132
|
+
onCell
|
|
133
|
+
}) {
|
|
134
|
+
return /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: true, children: /* @__PURE__ */ jsxs(View, { children: [
|
|
135
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.gridRow, {
|
|
136
|
+
backgroundColor: theme.chip
|
|
137
|
+
}], children: [
|
|
138
|
+
lead ? /* @__PURE__ */ jsx(View, { style: styles.leadCell }) : null,
|
|
139
|
+
columns.map((c) => /* @__PURE__ */ jsxs(Text, { style: [styles.cell, styles.th, styles.mono, {
|
|
140
|
+
color: theme.ink
|
|
141
|
+
}], numberOfLines: 1, children: [
|
|
142
|
+
c,
|
|
143
|
+
keyColumns.includes(c) ? /* @__PURE__ */ jsx(Text, { style: {
|
|
144
|
+
color: theme.muted
|
|
145
|
+
}, children: " key" }) : null
|
|
146
|
+
] }, c))
|
|
147
|
+
] }),
|
|
148
|
+
rows.map((r, i) => /* @__PURE__ */ jsxs(View, { style: [styles.gridRow, {
|
|
149
|
+
borderColor: theme.border
|
|
150
|
+
}], children: [
|
|
151
|
+
lead ? /* @__PURE__ */ jsx(View, { style: styles.leadCell, children: lead(i) }) : null,
|
|
152
|
+
r.cells.map((cell, j) => {
|
|
153
|
+
const text = /* @__PURE__ */ jsx(Text, { style: [styles.cell, {
|
|
154
|
+
color: cell.isNull ? theme.faint : theme.ink
|
|
155
|
+
}, cell.isNull ? styles.italic : null], numberOfLines: 2, children: cell.text });
|
|
156
|
+
return cell.editable && onCell ? /* @__PURE__ */ jsx(Tap, { onPress: () => onCell(i, columns[j]), accessibilityRole: "button", accessibilityLabel: `Edit ${columns[j]}`, pressedStyle: DIM, children: text }, columns[j]) : /* @__PURE__ */ jsx(View, { children: text }, columns[j]);
|
|
157
|
+
})
|
|
158
|
+
] }, r.key))
|
|
159
|
+
] }) });
|
|
160
|
+
}
|
|
161
|
+
function columnPlaceholder(c) {
|
|
162
|
+
if (c.hasDefault) return "default";
|
|
163
|
+
return c.notNull ? c.type : "NULL";
|
|
164
|
+
}
|
|
165
|
+
function DataTab({
|
|
166
|
+
channelId,
|
|
167
|
+
data,
|
|
168
|
+
theme
|
|
169
|
+
}) {
|
|
170
|
+
var _a;
|
|
171
|
+
const [tables, setTables] = useState(null);
|
|
172
|
+
const [table, setTable] = useState("");
|
|
173
|
+
const [offset, setOffset] = useState(0);
|
|
174
|
+
const [rows, setRows] = useState(null);
|
|
175
|
+
const [loading, setLoading] = useState(false);
|
|
176
|
+
const [error, setError] = useState(null);
|
|
177
|
+
const [notice, setNotice] = useState(null);
|
|
178
|
+
const [editing, setEditing] = useState(null);
|
|
179
|
+
const [adding, setAdding] = useState(null);
|
|
180
|
+
const [saving, setSaving] = useState(false);
|
|
181
|
+
const [editsUnavailable, setEditsUnavailable] = useState(null);
|
|
182
|
+
const [epoch, setEpoch] = useState(0);
|
|
183
|
+
const requestRef = useRef(0);
|
|
184
|
+
const loadTables = useCallback(async () => {
|
|
185
|
+
const id = ++requestRef.current;
|
|
186
|
+
setLoading(true);
|
|
187
|
+
const r = await data.database(channelId, "tables");
|
|
188
|
+
if (id !== requestRef.current) return;
|
|
189
|
+
setLoading(false);
|
|
190
|
+
if (!r.ok) {
|
|
191
|
+
setError(failureText(r));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
setError(null);
|
|
195
|
+
setTables(mapTables(r.value));
|
|
196
|
+
}, [channelId, data]);
|
|
197
|
+
const loadRows = useCallback(async () => {
|
|
198
|
+
if (!table) return;
|
|
199
|
+
const id = ++requestRef.current;
|
|
200
|
+
setLoading(true);
|
|
201
|
+
const r = await data.database(channelId, "rows", {
|
|
202
|
+
table,
|
|
203
|
+
offset,
|
|
204
|
+
limit: ROWS_PAGE_SIZE
|
|
205
|
+
});
|
|
206
|
+
if (id !== requestRef.current) return;
|
|
207
|
+
setLoading(false);
|
|
208
|
+
if (!r.ok) {
|
|
209
|
+
setError(failureText(r));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
setError(null);
|
|
213
|
+
const list = rawRows(r.value);
|
|
214
|
+
const meta = mapColumns(r.value);
|
|
215
|
+
const columns = meta.length ? meta.map((c) => c.name) : [];
|
|
216
|
+
for (const row of list) for (const k of Object.keys(row)) if (!columns.includes(k)) columns.push(k);
|
|
217
|
+
setRows({
|
|
218
|
+
table,
|
|
219
|
+
offset,
|
|
220
|
+
rows: list,
|
|
221
|
+
columns,
|
|
222
|
+
meta,
|
|
223
|
+
primaryKey: primaryKeyOf(r.value)
|
|
224
|
+
});
|
|
225
|
+
}, [channelId, data, table, offset]);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
setEditing(null);
|
|
228
|
+
setAdding(null);
|
|
229
|
+
(table ? loadRows() : loadTables()).catch(() => setLoading(false));
|
|
230
|
+
}, [table, loadRows, loadTables, epoch]);
|
|
231
|
+
const runMutation = async (input, done) => {
|
|
232
|
+
setSaving(true);
|
|
233
|
+
setError(null);
|
|
234
|
+
const r = await data.mutate(channelId, input).finally(() => setSaving(false));
|
|
235
|
+
if (!r.ok) {
|
|
236
|
+
if (r.outdated) setEditsUnavailable(failureText(r));
|
|
237
|
+
else setError(r.message || "The change wasn't saved.");
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
setNotice(done);
|
|
241
|
+
setEpoch((n) => n + 1);
|
|
242
|
+
return true;
|
|
243
|
+
};
|
|
244
|
+
const saveCell = async (setNull = false) => {
|
|
245
|
+
if (!rows || !editing) return;
|
|
246
|
+
const row = rows.rows[editing.row];
|
|
247
|
+
const input = row && buildCellUpdate(rows.table, row, editing.column, editing.text, rows.primaryKey, setNull);
|
|
248
|
+
if (!input) return;
|
|
249
|
+
if (await runMutation(input, "Saved.")) setEditing(null);
|
|
250
|
+
};
|
|
251
|
+
const saveNewRow = async () => {
|
|
252
|
+
if (!rows || !adding) return;
|
|
253
|
+
if (await runMutation(buildRowInsert(rows.table, adding, rows.meta), "Row added.")) setAdding(null);
|
|
254
|
+
};
|
|
255
|
+
const deleteRow = (i) => {
|
|
256
|
+
if (!rows) return;
|
|
257
|
+
const input = buildRowDelete(rows.table, rows.rows[i], rows.primaryKey);
|
|
258
|
+
if (!input) return;
|
|
259
|
+
confirm("Delete this row?", "This can't be undone.", "Delete row", () => {
|
|
260
|
+
runMutation(input, "Row deleted.").catch(() => void 0);
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
if (!table) {
|
|
264
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
265
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
266
|
+
loading && !tables ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
267
|
+
!loading && !(tables == null ? void 0 : tables.length) ? /* @__PURE__ */ jsx(Empty, { text: error ? "" : "No tables yet.", theme }) : null,
|
|
268
|
+
tables == null ? void 0 : tables.map((t) => /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
269
|
+
setRows(null);
|
|
270
|
+
setOffset(0);
|
|
271
|
+
setNotice(null);
|
|
272
|
+
setTable(t.name);
|
|
273
|
+
}, accessibilityRole: "button", accessibilityLabel: `Show rows of ${t.name}`, pressedStyle: DIM, style: [styles.listRow, {
|
|
274
|
+
borderColor: theme.border
|
|
275
|
+
}], children: [
|
|
276
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "table", size: 18, color: theme.muted }),
|
|
277
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.grow, styles.mono, {
|
|
278
|
+
color: theme.ink
|
|
279
|
+
}], numberOfLines: 1, children: t.name }),
|
|
280
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
281
|
+
color: theme.muted
|
|
282
|
+
}], children: formatRowEstimate(t.rowEstimate) }),
|
|
283
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-right", size: 18, color: theme.faint })
|
|
284
|
+
] }, t.name))
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
const editable = !editsUnavailable && Boolean(rows == null ? void 0 : rows.primaryKey.length);
|
|
288
|
+
const info = rows ? pageInfo(rows.offset, ROWS_PAGE_SIZE, rows.rows.length) : null;
|
|
289
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
290
|
+
/* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
291
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "arrow-left", label: "All tables", onPress: () => setTable(""), theme }),
|
|
292
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.grow, styles.mono, {
|
|
293
|
+
color: theme.ink
|
|
294
|
+
}], numberOfLines: 1, children: table }),
|
|
295
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
296
|
+
color: theme.muted
|
|
297
|
+
}], children: (_a = info == null ? void 0 : info.label) != null ? _a : "" }),
|
|
298
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "chevron-left", label: "Previous rows", onPress: () => info && setOffset(info.prevOffset), disabled: !(info == null ? void 0 : info.hasPrev) || loading, theme }),
|
|
299
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "chevron-right", label: "Next rows", onPress: () => info && setOffset(info.nextOffset), disabled: !(info == null ? void 0 : info.hasNext) || loading, theme }),
|
|
300
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "refresh", label: "Refresh rows", onPress: () => setEpoch((n) => n + 1), disabled: loading, theme })
|
|
301
|
+
] }),
|
|
302
|
+
editable && !adding ? /* @__PURE__ */ jsx(Pill, { label: "Add row", icon: "plus", onPress: () => setAdding({}), disabled: saving, theme }) : null,
|
|
303
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
304
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
305
|
+
rows && !rows.primaryKey.length && rows.rows.length ? /* @__PURE__ */ jsx(Line, { text: "This table has no primary key, so its rows can't be edited here.", tone: "info", theme }) : null,
|
|
306
|
+
editsUnavailable ? /* @__PURE__ */ jsx(Line, { text: `Editing rows: ${editsUnavailable}`, tone: "info", theme }) : null,
|
|
307
|
+
editing ? /* @__PURE__ */ jsxs(View, { style: [styles.form, {
|
|
308
|
+
borderColor: theme.border,
|
|
309
|
+
backgroundColor: theme.chip
|
|
310
|
+
}], children: [
|
|
311
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.mono, {
|
|
312
|
+
color: theme.muted
|
|
313
|
+
}], children: editing.column }),
|
|
314
|
+
/* @__PURE__ */ jsx(Field, { value: editing.text, onChangeText: (text) => setEditing(__spreadProps(__spreadValues({}, editing), {
|
|
315
|
+
text
|
|
316
|
+
})), label: "Cell value", theme, multiline: true }),
|
|
317
|
+
/* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
|
|
318
|
+
/* @__PURE__ */ jsx(Pill, { label: "Cancel", onPress: () => setEditing(null), disabled: saving, theme }),
|
|
319
|
+
/* @__PURE__ */ jsx(Pill, { label: "Set to NULL", onPress: () => {
|
|
320
|
+
saveCell(true).catch(() => void 0);
|
|
321
|
+
}, disabled: saving, theme }),
|
|
322
|
+
/* @__PURE__ */ jsx(Pill, { label: "Save", tone: "primary", busy: saving, onPress: () => {
|
|
323
|
+
saveCell().catch(() => void 0);
|
|
324
|
+
}, theme })
|
|
325
|
+
] })
|
|
326
|
+
] }) : null,
|
|
327
|
+
adding && rows ? /* @__PURE__ */ jsxs(View, { style: [styles.form, {
|
|
328
|
+
borderColor: theme.border,
|
|
329
|
+
backgroundColor: theme.chip
|
|
330
|
+
}], children: [
|
|
331
|
+
insertableColumns(rows.meta).map((c) => {
|
|
332
|
+
var _a2;
|
|
333
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.formRow, children: [
|
|
334
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.small, styles.mono, styles.formLabel, {
|
|
335
|
+
color: theme.muted
|
|
336
|
+
}], numberOfLines: 1, children: [
|
|
337
|
+
c.name,
|
|
338
|
+
c.notNull && !c.hasDefault ? /* @__PURE__ */ jsx(Text, { style: {
|
|
339
|
+
color: theme.crit
|
|
340
|
+
}, children: " *" }) : null
|
|
341
|
+
] }),
|
|
342
|
+
/* @__PURE__ */ jsx(View, { style: styles.grow, children: /* @__PURE__ */ jsx(Field, { value: (_a2 = adding[c.name]) != null ? _a2 : "", onChangeText: (v) => setAdding(__spreadProps(__spreadValues({}, adding), {
|
|
343
|
+
[c.name]: v
|
|
344
|
+
})), placeholder: columnPlaceholder(c), label: c.name, theme }) })
|
|
345
|
+
] }, c.name);
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
|
|
348
|
+
/* @__PURE__ */ jsx(Pill, { label: "Cancel", onPress: () => setAdding(null), disabled: saving, theme }),
|
|
349
|
+
/* @__PURE__ */ jsx(Pill, { label: "Add row", icon: "plus", tone: "primary", busy: saving, onPress: () => {
|
|
350
|
+
saveNewRow().catch(() => void 0);
|
|
351
|
+
}, theme, testID: "webbuilder-cloud-add-row" })
|
|
352
|
+
] })
|
|
353
|
+
] }) : null,
|
|
354
|
+
!rows ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
355
|
+
rows && !rows.rows.length ? /* @__PURE__ */ jsx(Empty, { text: "No rows on this page.", theme }) : null,
|
|
356
|
+
(rows == null ? void 0 : rows.rows.length) ? /* @__PURE__ */ jsx(Grid, { columns: rows.columns, keyColumns: rows.primaryKey, theme, rows: rows.rows.map((row, i) => ({
|
|
357
|
+
key: JSON.stringify(rowKey(row, rows.primaryKey)) + i,
|
|
358
|
+
cells: rows.columns.map((c) => {
|
|
359
|
+
const cell = formatCell(row[c]);
|
|
360
|
+
return {
|
|
361
|
+
text: cell.text,
|
|
362
|
+
isNull: cell.isNull,
|
|
363
|
+
editable: editable && canEditCell(row, c, rows.meta, rows.primaryKey)
|
|
364
|
+
};
|
|
365
|
+
})
|
|
366
|
+
})), lead: editable ? (i) => /* @__PURE__ */ jsx(IconButton, { icon: "trash-can-outline", label: "Delete row", onPress: () => deleteRow(i), disabled: saving || !rowKey(rows.rows[i], rows.primaryKey), theme }) : void 0, onCell: (i, column) => {
|
|
367
|
+
if (!saving) setEditing({
|
|
368
|
+
row: i,
|
|
369
|
+
column,
|
|
370
|
+
text: editText(rows.rows[i][column])
|
|
371
|
+
});
|
|
372
|
+
} }) : null
|
|
373
|
+
] });
|
|
374
|
+
}
|
|
375
|
+
function SqlTab({
|
|
376
|
+
channelId,
|
|
377
|
+
data,
|
|
378
|
+
theme
|
|
379
|
+
}) {
|
|
380
|
+
const [sql, setSql] = useState("select * from information_schema.tables where table_schema = 'public';");
|
|
381
|
+
const [mode, setMode] = useState("read");
|
|
382
|
+
const [running, setRunning] = useState(false);
|
|
383
|
+
const [error, setError] = useState(null);
|
|
384
|
+
const [result, setResult] = useState(null);
|
|
385
|
+
const execute = async () => {
|
|
386
|
+
setRunning(true);
|
|
387
|
+
setError(null);
|
|
388
|
+
const r = await data.sql(channelId, sql, mode, mode === "write").finally(() => setRunning(false));
|
|
389
|
+
if (!r.ok) {
|
|
390
|
+
setError(failureText(r));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
setResult({
|
|
394
|
+
mode,
|
|
395
|
+
value: mapSqlResult(r.value)
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
const run = () => {
|
|
399
|
+
if (!sql.trim() || running) return;
|
|
400
|
+
if (mode === "write") {
|
|
401
|
+
confirm("Run with write access?", "It can change or delete data and can't be undone.", "Run and save", () => {
|
|
402
|
+
execute().catch(() => void 0);
|
|
403
|
+
});
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
execute().catch(() => void 0);
|
|
407
|
+
};
|
|
408
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
409
|
+
/* @__PURE__ */ jsx(Field, { value: sql, onChangeText: setSql, label: "SQL", theme, mono: true, multiline: true }),
|
|
410
|
+
/* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
411
|
+
["read", "write"].map((m) => /* @__PURE__ */ jsx(Tap, { onPress: () => setMode(m), accessibilityRole: "radio", accessibilityState: {
|
|
412
|
+
selected: mode === m
|
|
413
|
+
}, pressedStyle: DIM, style: [styles.segment, mode === m ? {
|
|
414
|
+
backgroundColor: theme.chip
|
|
415
|
+
} : null], children: /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
416
|
+
color: mode === m ? theme.ink : theme.muted,
|
|
417
|
+
fontWeight: "600"
|
|
418
|
+
}], children: m === "read" ? "Read only" : "Read & write" }) }, m)),
|
|
419
|
+
/* @__PURE__ */ jsx(View, { style: styles.grow }),
|
|
420
|
+
/* @__PURE__ */ jsx(Pill, { label: "Run", icon: "play", tone: "primary", busy: running, disabled: !sql.trim(), onPress: run, theme })
|
|
421
|
+
] }),
|
|
422
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
423
|
+
color: theme.muted
|
|
424
|
+
}], children: mode === "read" ? "Changes are rolled back." : "Changes are saved. Runs in one transaction." }),
|
|
425
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
426
|
+
!result ? /* @__PURE__ */ jsx(Empty, { text: "Results show here. Only the last statement that returns rows is shown.", theme }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
427
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
428
|
+
color: theme.muted
|
|
429
|
+
}], children: sqlResultLabel(result.value, result.mode) }),
|
|
430
|
+
result.value.rows.length ? /* @__PURE__ */ jsx(Grid, { columns: result.value.columns, theme, rows: result.value.rows.map((row, i) => ({
|
|
431
|
+
key: String(i),
|
|
432
|
+
cells: row.map((c) => ({
|
|
433
|
+
text: c.text,
|
|
434
|
+
isNull: c.isNull
|
|
435
|
+
}))
|
|
436
|
+
})) }) : null
|
|
437
|
+
] })
|
|
438
|
+
] });
|
|
439
|
+
}
|
|
440
|
+
function HealthTab({
|
|
441
|
+
channelId,
|
|
442
|
+
data,
|
|
443
|
+
busy,
|
|
444
|
+
onFixWithAi,
|
|
445
|
+
theme
|
|
446
|
+
}) {
|
|
447
|
+
const [report, setReport] = useState(null);
|
|
448
|
+
const [loading, setLoading] = useState(false);
|
|
449
|
+
const [error, setError] = useState(null);
|
|
450
|
+
const [notice, setNotice] = useState(null);
|
|
451
|
+
const load = useCallback(async () => {
|
|
452
|
+
setLoading(true);
|
|
453
|
+
const r = await data.health(channelId).finally(() => setLoading(false));
|
|
454
|
+
if (!r.ok) {
|
|
455
|
+
setError(failureText(r));
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
setError(null);
|
|
459
|
+
setReport(mapHealth(r.value));
|
|
460
|
+
}, [channelId, data]);
|
|
461
|
+
useEffect(() => {
|
|
462
|
+
load().catch(() => void 0);
|
|
463
|
+
}, [load]);
|
|
464
|
+
const fix = (text) => {
|
|
465
|
+
if (!text || !onFixWithAi) return;
|
|
466
|
+
if (onFixWithAi(text)) setNotice("Asked the AI to fix it. Run the checks again when it has finished.");
|
|
467
|
+
else setError("Could not start the request. Wait for the AI to finish, then try again.");
|
|
468
|
+
};
|
|
469
|
+
let summary = "Database checks";
|
|
470
|
+
if (report) summary = `${report.lints.length} finding${report.lints.length === 1 ? "" : "s"}`;
|
|
471
|
+
if (report == null ? void 0 : report.cached) summary += ` \xB7 from ${shortDate(report.checkedAt)} (checks run at most every 30 seconds)`;
|
|
472
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
473
|
+
/* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
474
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.grow, {
|
|
475
|
+
color: theme.muted
|
|
476
|
+
}], children: summary }),
|
|
477
|
+
/* @__PURE__ */ jsx(Pill, { label: "Run checks", icon: "refresh", busy: loading, onPress: () => {
|
|
478
|
+
load().catch(() => void 0);
|
|
479
|
+
}, theme })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
482
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
483
|
+
loading && !report ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
484
|
+
!loading && !report ? /* @__PURE__ */ jsx(Empty, { text: error ? "" : "No report yet.", theme }) : null,
|
|
485
|
+
report && !report.lints.length ? /* @__PURE__ */ jsx(Empty, { text: "No problems found.", theme }) : null,
|
|
486
|
+
report ? groupLints(report.lints).map((g) => /* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
487
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.heading, {
|
|
488
|
+
color: theme.ink
|
|
489
|
+
}], children: [
|
|
490
|
+
LINT_LEVEL_LABELS[g.level],
|
|
491
|
+
" (",
|
|
492
|
+
g.lints.length,
|
|
493
|
+
")"
|
|
494
|
+
] }),
|
|
495
|
+
g.lints.map((l) => {
|
|
496
|
+
const request = lintFixRequest(l);
|
|
497
|
+
let dot = theme.muted;
|
|
498
|
+
if (l.level === "error") dot = theme.crit;
|
|
499
|
+
else if (l.level === "warn") dot = theme.warn;
|
|
500
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.card, {
|
|
501
|
+
borderColor: theme.border
|
|
502
|
+
}], children: [
|
|
503
|
+
/* @__PURE__ */ jsx(View, { style: [styles.dot, {
|
|
504
|
+
backgroundColor: dot
|
|
505
|
+
}] }),
|
|
506
|
+
/* @__PURE__ */ jsxs(View, { style: styles.grow, children: [
|
|
507
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.body, {
|
|
508
|
+
color: theme.ink
|
|
509
|
+
}], children: [
|
|
510
|
+
l.title,
|
|
511
|
+
l.table ? /* @__PURE__ */ jsxs(Text, { style: [styles.mono, {
|
|
512
|
+
color: theme.muted
|
|
513
|
+
}], children: [
|
|
514
|
+
" ",
|
|
515
|
+
l.table
|
|
516
|
+
] }) : null
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
519
|
+
color: theme.muted
|
|
520
|
+
}], children: l.detail }),
|
|
521
|
+
request && onFixWithAi ? /* @__PURE__ */ jsx(Pill, { label: "Fix with AI", icon: "creation", disabled: busy, onPress: () => fix(request), theme }) : null
|
|
522
|
+
] })
|
|
523
|
+
] }, l.key);
|
|
524
|
+
})
|
|
525
|
+
] }, g.level)) : null,
|
|
526
|
+
report ? /* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
527
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, {
|
|
528
|
+
color: theme.ink
|
|
529
|
+
}], children: "Slow queries" }),
|
|
530
|
+
report.slowQueries.length ? report.slowQueries.map((q, i) => /* @__PURE__ */ jsxs(View, { style: [styles.card, styles.column, {
|
|
531
|
+
borderColor: theme.border
|
|
532
|
+
}], children: [
|
|
533
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.mono, {
|
|
534
|
+
color: theme.ink
|
|
535
|
+
}], selectable: true, children: q.query }),
|
|
536
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
537
|
+
color: theme.muted
|
|
538
|
+
}], children: [
|
|
539
|
+
q.calls,
|
|
540
|
+
" calls \xB7 ",
|
|
541
|
+
q.meanMs,
|
|
542
|
+
" ms average \xB7 ",
|
|
543
|
+
q.totalMs,
|
|
544
|
+
" ms total"
|
|
545
|
+
] })
|
|
546
|
+
] }, i)) : /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
547
|
+
color: theme.muted
|
|
548
|
+
}], children: report.hints[0] || "No slow queries recorded yet." })
|
|
549
|
+
] }) : null,
|
|
550
|
+
(report == null ? void 0 : report.indexAdvice.length) ? /* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
551
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, {
|
|
552
|
+
color: theme.ink
|
|
553
|
+
}], children: "Index advice" }),
|
|
554
|
+
report.indexAdvice.map((a, i) => /* @__PURE__ */ jsxs(View, { style: [styles.card, styles.column, {
|
|
555
|
+
borderColor: theme.border
|
|
556
|
+
}], children: [
|
|
557
|
+
a.indexStatements.map((s) => /* @__PURE__ */ jsx(Text, { style: [styles.small, styles.mono, {
|
|
558
|
+
color: theme.ink
|
|
559
|
+
}], selectable: true, children: s }, s)),
|
|
560
|
+
a.totalCostBefore > 0 && a.totalCostAfter > 0 && a.totalCostAfter < a.totalCostBefore ? /* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
561
|
+
color: theme.muted
|
|
562
|
+
}], children: [
|
|
563
|
+
"About ",
|
|
564
|
+
Math.max(2, Math.round(a.totalCostBefore / a.totalCostAfter)),
|
|
565
|
+
"\xD7 faster for this query"
|
|
566
|
+
] }) : null,
|
|
567
|
+
onFixWithAi ? /* @__PURE__ */ jsx(Pill, { label: "Add with AI", icon: "creation", disabled: busy, onPress: () => fix(indexAdviceRequest(a)), theme }) : null
|
|
568
|
+
] }, i))
|
|
569
|
+
] }) : null,
|
|
570
|
+
(report == null ? void 0 : report.skipped.length) ? /* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
571
|
+
color: theme.muted
|
|
572
|
+
}], children: [
|
|
573
|
+
"Some checks could not run: ",
|
|
574
|
+
report.skipped.join(", "),
|
|
575
|
+
"."
|
|
576
|
+
] }) : null
|
|
577
|
+
] });
|
|
578
|
+
}
|
|
579
|
+
const USERS_PER_PAGE = 50;
|
|
580
|
+
function UsersTab({
|
|
581
|
+
channelId,
|
|
582
|
+
data,
|
|
583
|
+
theme
|
|
584
|
+
}) {
|
|
585
|
+
const [users, setUsers] = useState(null);
|
|
586
|
+
const [legacy, setLegacy] = useState(false);
|
|
587
|
+
const [page, setPage] = useState(1);
|
|
588
|
+
const [hasMore, setHasMore] = useState(false);
|
|
589
|
+
const [loading, setLoading] = useState(false);
|
|
590
|
+
const [working, setWorking] = useState(false);
|
|
591
|
+
const [error, setError] = useState(null);
|
|
592
|
+
const [notice, setNotice] = useState(null);
|
|
593
|
+
const [inviteEmail, setInviteEmail] = useState("");
|
|
594
|
+
const [epoch, setEpoch] = useState(0);
|
|
595
|
+
const load = useCallback(async () => {
|
|
596
|
+
setLoading(true);
|
|
597
|
+
const r = await data.authUsers(channelId, {
|
|
598
|
+
action: "list",
|
|
599
|
+
page,
|
|
600
|
+
perPage: USERS_PER_PAGE
|
|
601
|
+
});
|
|
602
|
+
if (!r.ok && r.outdated) {
|
|
603
|
+
const old = await data.database(channelId, "users");
|
|
604
|
+
setLoading(false);
|
|
605
|
+
if (!old.ok) {
|
|
606
|
+
setError(failureText(old));
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
setLegacy(true);
|
|
610
|
+
setUsers(mapUsers(old.value).map((u) => ({
|
|
611
|
+
id: u.id,
|
|
612
|
+
email: u.email,
|
|
613
|
+
phone: "",
|
|
614
|
+
createdAt: u.createdAt,
|
|
615
|
+
lastSignInAt: u.lastSignInAt,
|
|
616
|
+
bannedUntil: null,
|
|
617
|
+
confirmedAt: u.emailConfirmedAt
|
|
618
|
+
})));
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
setLoading(false);
|
|
622
|
+
if (!r.ok) {
|
|
623
|
+
setError(failureText(r));
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
setError(null);
|
|
627
|
+
const list = mapAuthUsers(r.value);
|
|
628
|
+
setUsers(list);
|
|
629
|
+
setHasMore(list.length >= USERS_PER_PAGE);
|
|
630
|
+
}, [channelId, data, page]);
|
|
631
|
+
useEffect(() => {
|
|
632
|
+
load().catch(() => setLoading(false));
|
|
633
|
+
}, [load, epoch]);
|
|
634
|
+
const act = async (input, done) => {
|
|
635
|
+
setWorking(true);
|
|
636
|
+
setError(null);
|
|
637
|
+
const r = await data.authUsers(channelId, input).finally(() => setWorking(false));
|
|
638
|
+
if (!r.ok) {
|
|
639
|
+
setError(failureText(r));
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
setNotice(done);
|
|
643
|
+
setEpoch((n) => n + 1);
|
|
644
|
+
return true;
|
|
645
|
+
};
|
|
646
|
+
const invite = async () => {
|
|
647
|
+
const email = inviteEmail.trim();
|
|
648
|
+
if (!isEmailLike(email)) {
|
|
649
|
+
setError("Enter a valid email address.");
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
if (await act({
|
|
653
|
+
action: "invite",
|
|
654
|
+
email
|
|
655
|
+
}, `Invitation sent to ${email}.`)) setInviteEmail("");
|
|
656
|
+
};
|
|
657
|
+
const ban = (u) => {
|
|
658
|
+
Alert.alert(`Ban ${u.email || "this user"}?`, "They can't sign in until the ban ends.", [...BAN_CHOICES.map((c) => ({
|
|
659
|
+
text: c.label,
|
|
660
|
+
onPress: () => {
|
|
661
|
+
act({
|
|
662
|
+
action: "ban",
|
|
663
|
+
id: u.id,
|
|
664
|
+
hours: c.hours
|
|
665
|
+
}, "User banned.").catch(() => void 0);
|
|
666
|
+
}
|
|
667
|
+
})), {
|
|
668
|
+
text: "Cancel",
|
|
669
|
+
style: "cancel"
|
|
670
|
+
}]);
|
|
671
|
+
};
|
|
672
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
673
|
+
!legacy ? /* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
674
|
+
/* @__PURE__ */ jsx(View, { style: styles.grow, children: /* @__PURE__ */ jsx(Field, { value: inviteEmail, onChangeText: setInviteEmail, placeholder: "email@example.com", label: "Email to invite", keyboardType: "email-address", theme }) }),
|
|
675
|
+
/* @__PURE__ */ jsx(Pill, { label: "Invite", icon: "email-outline", tone: "primary", busy: working, disabled: !inviteEmail.trim(), onPress: () => {
|
|
676
|
+
invite().catch(() => void 0);
|
|
677
|
+
}, theme }),
|
|
678
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "refresh", label: "Refresh users", onPress: () => setEpoch((n) => n + 1), disabled: loading, theme })
|
|
679
|
+
] }) : /* @__PURE__ */ jsx(Line, { text: "Managing users needs the latest server. Showing a read-only list.", tone: "info", theme }),
|
|
680
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
681
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
682
|
+
loading && !users ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
683
|
+
!loading && !(users == null ? void 0 : users.length) ? /* @__PURE__ */ jsx(Empty, { text: error ? "" : "No one has signed up yet.", theme }) : null,
|
|
684
|
+
users == null ? void 0 : users.map((u) => {
|
|
685
|
+
const banned = isBanned(u);
|
|
686
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.listRow, {
|
|
687
|
+
borderColor: theme.border
|
|
688
|
+
}], children: [
|
|
689
|
+
/* @__PURE__ */ jsxs(View, { style: styles.grow, children: [
|
|
690
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.body, {
|
|
691
|
+
color: theme.ink
|
|
692
|
+
}], numberOfLines: 1, children: u.email || u.phone || u.id }),
|
|
693
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
694
|
+
color: theme.muted
|
|
695
|
+
}], children: [
|
|
696
|
+
"Joined ",
|
|
697
|
+
shortDate(u.createdAt),
|
|
698
|
+
" \xB7 last sign-in",
|
|
699
|
+
" ",
|
|
700
|
+
u.lastSignInAt ? shortDate(u.lastSignInAt) : "never"
|
|
701
|
+
] }),
|
|
702
|
+
!u.confirmedAt ? /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
703
|
+
color: theme.muted
|
|
704
|
+
}], children: "unconfirmed" }) : null,
|
|
705
|
+
banned ? /* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
706
|
+
color: theme.crit
|
|
707
|
+
}], children: [
|
|
708
|
+
"banned until ",
|
|
709
|
+
shortDate(u.bannedUntil)
|
|
710
|
+
] }) : null
|
|
711
|
+
] }),
|
|
712
|
+
!legacy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
713
|
+
banned ? /* @__PURE__ */ jsx(Pill, { label: "Unban", disabled: working, onPress: () => {
|
|
714
|
+
act({
|
|
715
|
+
action: "unban",
|
|
716
|
+
id: u.id
|
|
717
|
+
}, "User unbanned.").catch(() => void 0);
|
|
718
|
+
}, theme }) : /* @__PURE__ */ jsx(Pill, { label: "Ban\u2026", disabled: working, onPress: () => ban(u), theme }),
|
|
719
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "trash-can-outline", label: "Delete user", disabled: working, color: theme.crit, onPress: () => confirm(`Delete ${u.email || "this user"}?`, "They lose their account and can't sign in.", "Delete user", () => {
|
|
720
|
+
act({
|
|
721
|
+
action: "delete",
|
|
722
|
+
id: u.id,
|
|
723
|
+
confirm: true
|
|
724
|
+
}, "User deleted.").catch(() => void 0);
|
|
725
|
+
}), theme })
|
|
726
|
+
] }) : null
|
|
727
|
+
] }, u.id || u.email);
|
|
728
|
+
}),
|
|
729
|
+
!legacy && (page > 1 || hasMore) ? /* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
730
|
+
/* @__PURE__ */ jsx(View, { style: styles.grow }),
|
|
731
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
732
|
+
color: theme.muted
|
|
733
|
+
}], children: [
|
|
734
|
+
"Page ",
|
|
735
|
+
page
|
|
736
|
+
] }),
|
|
737
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "chevron-left", label: "Previous users", onPress: () => setPage((p) => Math.max(1, p - 1)), disabled: page <= 1 || loading, theme }),
|
|
738
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "chevron-right", label: "Next users", onPress: () => setPage((p) => p + 1), disabled: !hasMore || loading, theme })
|
|
739
|
+
] }) : null
|
|
740
|
+
] });
|
|
741
|
+
}
|
|
742
|
+
async function pickUpload() {
|
|
743
|
+
var _a, _b;
|
|
744
|
+
let picker;
|
|
745
|
+
let fs;
|
|
746
|
+
try {
|
|
747
|
+
picker = require("expo-document-picker");
|
|
748
|
+
fs = require("expo-file-system");
|
|
749
|
+
} catch (e) {
|
|
750
|
+
throw new Error("The file picker is not included in this app build.");
|
|
751
|
+
}
|
|
752
|
+
const result = await picker.getDocumentAsync({
|
|
753
|
+
multiple: false,
|
|
754
|
+
copyToCacheDirectory: true
|
|
755
|
+
});
|
|
756
|
+
const asset = result.canceled ? null : (_a = result.assets) == null ? void 0 : _a[0];
|
|
757
|
+
if (!asset) return null;
|
|
758
|
+
const name = asset.name || "file";
|
|
759
|
+
if (!isValidFileName(name)) throw new Error("That file name can\u2019t be used.");
|
|
760
|
+
if (typeof asset.size === "number" && asset.size > MAX_UPLOAD_BYTES) throw new Error("Files can be 10 MB at most.");
|
|
761
|
+
let base64;
|
|
762
|
+
try {
|
|
763
|
+
base64 = await fs.readAsStringAsync(asset.uri, {
|
|
764
|
+
encoding: fs.EncodingType.Base64
|
|
765
|
+
});
|
|
766
|
+
} catch (e) {
|
|
767
|
+
throw new Error("Could not read the file.");
|
|
768
|
+
}
|
|
769
|
+
return {
|
|
770
|
+
name,
|
|
771
|
+
size: (_b = asset.size) != null ? _b : null,
|
|
772
|
+
type: asset.mimeType || void 0,
|
|
773
|
+
base64
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function StorageTab({
|
|
777
|
+
channelId,
|
|
778
|
+
data,
|
|
779
|
+
theme
|
|
780
|
+
}) {
|
|
781
|
+
const [buckets, setBuckets] = useState(null);
|
|
782
|
+
const [bucket, setBucket] = useState("");
|
|
783
|
+
const [prefix, setPrefix] = useState("");
|
|
784
|
+
const [files, setFiles] = useState(null);
|
|
785
|
+
const [loading, setLoading] = useState(false);
|
|
786
|
+
const [working, setWorking] = useState(false);
|
|
787
|
+
const [error, setError] = useState(null);
|
|
788
|
+
const [notice, setNotice] = useState(null);
|
|
789
|
+
const [newBucket, setNewBucket] = useState(null);
|
|
790
|
+
const [epoch, setEpoch] = useState(0);
|
|
791
|
+
const load = useCallback(async () => {
|
|
792
|
+
setLoading(true);
|
|
793
|
+
const r = bucket ? await data.storage(channelId, {
|
|
794
|
+
action: "listFiles",
|
|
795
|
+
bucket,
|
|
796
|
+
prefix,
|
|
797
|
+
limit: 100
|
|
798
|
+
}) : await data.storage(channelId, {
|
|
799
|
+
action: "listBuckets"
|
|
800
|
+
});
|
|
801
|
+
setLoading(false);
|
|
802
|
+
if (!r.ok) {
|
|
803
|
+
setError(failureText(r));
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
setError(null);
|
|
807
|
+
if (bucket) setFiles(mapFiles(r.value));
|
|
808
|
+
else setBuckets(mapBuckets(r.value));
|
|
809
|
+
}, [channelId, data, bucket, prefix]);
|
|
810
|
+
useEffect(() => {
|
|
811
|
+
load().catch(() => setLoading(false));
|
|
812
|
+
}, [load, epoch]);
|
|
813
|
+
const call = async (input, done) => {
|
|
814
|
+
var _a;
|
|
815
|
+
setWorking(true);
|
|
816
|
+
setError(null);
|
|
817
|
+
const r = await data.storage(channelId, input).finally(() => setWorking(false));
|
|
818
|
+
if (!r.ok) {
|
|
819
|
+
setError(failureText(r));
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
if (done) setNotice(done);
|
|
823
|
+
return (_a = r.value) != null ? _a : true;
|
|
824
|
+
};
|
|
825
|
+
const createBucket = async () => {
|
|
826
|
+
if (!newBucket) return;
|
|
827
|
+
const name = newBucket.name.trim();
|
|
828
|
+
if (!isValidBucketName(name)) {
|
|
829
|
+
setError('Bucket names use letters, digits, "-", "_" and "." (63 at most).');
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (await call({
|
|
833
|
+
action: "createBucket",
|
|
834
|
+
name,
|
|
835
|
+
public: newBucket.public
|
|
836
|
+
}, `Bucket ${name} created.`)) {
|
|
837
|
+
setNewBucket(null);
|
|
838
|
+
setEpoch((n) => n + 1);
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
const upload = async () => {
|
|
842
|
+
setError(null);
|
|
843
|
+
let file;
|
|
844
|
+
try {
|
|
845
|
+
file = await pickUpload();
|
|
846
|
+
} catch (err) {
|
|
847
|
+
setError(err instanceof Error ? err.message : "Could not read the file.");
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
if (!file) return;
|
|
851
|
+
const input = {
|
|
852
|
+
action: "upload",
|
|
853
|
+
bucket,
|
|
854
|
+
path: joinPath(prefix, file.name),
|
|
855
|
+
contentBase64: file.base64,
|
|
856
|
+
contentType: file.type
|
|
857
|
+
};
|
|
858
|
+
if (await call(input, `Uploaded ${file.name}.`)) setEpoch((n) => n + 1);
|
|
859
|
+
};
|
|
860
|
+
const copyLink = async (f) => {
|
|
861
|
+
const value = await call({
|
|
862
|
+
action: "signedUrl",
|
|
863
|
+
bucket,
|
|
864
|
+
path: joinPath(prefix, f.name),
|
|
865
|
+
expiresIn: 3600
|
|
866
|
+
}, null);
|
|
867
|
+
const url = value && typeof value === "object" ? String(value.url || "") : "";
|
|
868
|
+
if (!url) return;
|
|
869
|
+
try {
|
|
870
|
+
Clipboard.setString(url);
|
|
871
|
+
setNotice("Signed link copied (valid for 1 hour).");
|
|
872
|
+
} catch (e) {
|
|
873
|
+
setNotice(`Signed link (valid for 1 hour): ${url}`);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const deleteFile = (f) => confirm(`Delete ${f.name}?`, "This can't be undone.", "Delete file", () => {
|
|
877
|
+
call({
|
|
878
|
+
action: "delete",
|
|
879
|
+
bucket,
|
|
880
|
+
paths: [joinPath(prefix, f.name)],
|
|
881
|
+
confirm: true
|
|
882
|
+
}, `Deleted ${f.name}.`).then((ok) => {
|
|
883
|
+
if (ok) setEpoch((n) => n + 1);
|
|
884
|
+
}).catch(() => void 0);
|
|
885
|
+
});
|
|
886
|
+
if (!bucket) {
|
|
887
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
888
|
+
/* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
889
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.grow, {
|
|
890
|
+
color: theme.muted
|
|
891
|
+
}], children: "Buckets" }),
|
|
892
|
+
/* @__PURE__ */ jsx(Pill, { label: "New bucket", icon: "folder-plus-outline", disabled: working, onPress: () => setNewBucket({
|
|
893
|
+
name: "",
|
|
894
|
+
public: false
|
|
895
|
+
}), theme }),
|
|
896
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "refresh", label: "Refresh buckets", onPress: () => setEpoch((n) => n + 1), disabled: loading, theme })
|
|
897
|
+
] }),
|
|
898
|
+
newBucket ? /* @__PURE__ */ jsxs(View, { style: [styles.form, {
|
|
899
|
+
borderColor: theme.border,
|
|
900
|
+
backgroundColor: theme.chip
|
|
901
|
+
}], children: [
|
|
902
|
+
/* @__PURE__ */ jsx(Field, { value: newBucket.name, onChangeText: (name) => setNewBucket(__spreadProps(__spreadValues({}, newBucket), {
|
|
903
|
+
name
|
|
904
|
+
})), placeholder: "bucket-name", label: "Bucket name", theme, mono: true }),
|
|
905
|
+
/* @__PURE__ */ jsxs(Tap, { onPress: () => setNewBucket(__spreadProps(__spreadValues({}, newBucket), {
|
|
906
|
+
public: !newBucket.public
|
|
907
|
+
})), accessibilityRole: "checkbox", accessibilityState: {
|
|
908
|
+
checked: newBucket.public
|
|
909
|
+
}, pressedStyle: DIM, style: styles.check, children: [
|
|
910
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: newBucket.public ? "checkbox-marked" : "checkbox-blank-outline", size: 20, color: newBucket.public ? theme.accent : theme.muted }),
|
|
911
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.body, {
|
|
912
|
+
color: theme.ink
|
|
913
|
+
}], children: "Public" })
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
|
|
916
|
+
/* @__PURE__ */ jsx(Pill, { label: "Cancel", onPress: () => setNewBucket(null), theme }),
|
|
917
|
+
/* @__PURE__ */ jsx(Pill, { label: "Create", tone: "primary", busy: working, disabled: !newBucket.name.trim(), onPress: () => {
|
|
918
|
+
createBucket().catch(() => void 0);
|
|
919
|
+
}, theme })
|
|
920
|
+
] })
|
|
921
|
+
] }) : null,
|
|
922
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
923
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
924
|
+
loading && !buckets ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
925
|
+
!loading && !(buckets == null ? void 0 : buckets.length) ? /* @__PURE__ */ jsx(Empty, { text: error ? "" : "No buckets yet.", theme }) : null,
|
|
926
|
+
buckets == null ? void 0 : buckets.map((b) => /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
927
|
+
setFiles(null);
|
|
928
|
+
setPrefix("");
|
|
929
|
+
setNotice(null);
|
|
930
|
+
setBucket(b.id);
|
|
931
|
+
}, accessibilityRole: "button", accessibilityLabel: `Open ${b.name}`, pressedStyle: DIM, style: [styles.listRow, {
|
|
932
|
+
borderColor: theme.border
|
|
933
|
+
}], children: [
|
|
934
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "folder-outline", size: 18, color: theme.muted }),
|
|
935
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.grow, styles.mono, {
|
|
936
|
+
color: theme.ink
|
|
937
|
+
}], numberOfLines: 1, children: b.name }),
|
|
938
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
939
|
+
color: theme.muted
|
|
940
|
+
}], children: b.public ? "public" : "private" })
|
|
941
|
+
] }, b.id))
|
|
942
|
+
] });
|
|
943
|
+
}
|
|
944
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
945
|
+
/* @__PURE__ */ jsxs(View, { style: styles.bar, children: [
|
|
946
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "arrow-left", label: prefix ? "Up one folder" : "All buckets", onPress: () => {
|
|
947
|
+
setFiles(null);
|
|
948
|
+
if (prefix) setPrefix(parentPrefix(prefix));
|
|
949
|
+
else setBucket("");
|
|
950
|
+
}, theme }),
|
|
951
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.grow, styles.mono, {
|
|
952
|
+
color: theme.ink
|
|
953
|
+
}], numberOfLines: 1, children: [
|
|
954
|
+
bucket,
|
|
955
|
+
"/",
|
|
956
|
+
prefix
|
|
957
|
+
] }),
|
|
958
|
+
/* @__PURE__ */ jsx(Pill, { label: "Upload", icon: "upload", busy: working, onPress: () => {
|
|
959
|
+
upload().catch(() => void 0);
|
|
960
|
+
}, theme }),
|
|
961
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "refresh", label: "Refresh files", onPress: () => setEpoch((n) => n + 1), disabled: loading, theme })
|
|
962
|
+
] }),
|
|
963
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
964
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
965
|
+
loading && !files ? /* @__PURE__ */ jsx(Loading, { theme }) : null,
|
|
966
|
+
!loading && !(files == null ? void 0 : files.length) ? /* @__PURE__ */ jsx(Empty, { text: error ? "" : "No files here yet.", theme }) : null,
|
|
967
|
+
files == null ? void 0 : files.map((f) => f.folder ? /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
968
|
+
setFiles(null);
|
|
969
|
+
setPrefix(`${joinPath(prefix, f.name)}/`);
|
|
970
|
+
}, accessibilityRole: "button", accessibilityLabel: `Open folder ${f.name}`, pressedStyle: DIM, style: [styles.listRow, {
|
|
971
|
+
borderColor: theme.border
|
|
972
|
+
}], children: [
|
|
973
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "folder-outline", size: 18, color: theme.muted }),
|
|
974
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.grow, styles.body, {
|
|
975
|
+
color: theme.ink
|
|
976
|
+
}], numberOfLines: 1, children: f.name }),
|
|
977
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-right", size: 18, color: theme.faint })
|
|
978
|
+
] }, f.name) : /* @__PURE__ */ jsxs(View, { style: [styles.listRow, {
|
|
979
|
+
borderColor: theme.border
|
|
980
|
+
}], children: [
|
|
981
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "file-outline", size: 18, color: theme.muted }),
|
|
982
|
+
/* @__PURE__ */ jsxs(View, { style: styles.grow, children: [
|
|
983
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.mono, {
|
|
984
|
+
color: theme.ink
|
|
985
|
+
}], numberOfLines: 1, children: f.name }),
|
|
986
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
987
|
+
color: theme.muted
|
|
988
|
+
}], children: [
|
|
989
|
+
formatBytes(f.size),
|
|
990
|
+
" \xB7 ",
|
|
991
|
+
shortDate(f.updatedAt)
|
|
992
|
+
] })
|
|
993
|
+
] }),
|
|
994
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "link-variant", label: "Copy signed link", disabled: working, onPress: () => {
|
|
995
|
+
copyLink(f).catch(() => void 0);
|
|
996
|
+
}, theme }),
|
|
997
|
+
/* @__PURE__ */ jsx(IconButton, { icon: "trash-can-outline", label: "Delete file", disabled: working, color: theme.crit, onPress: () => deleteFile(f), theme })
|
|
998
|
+
] }, f.name))
|
|
999
|
+
] });
|
|
1000
|
+
}
|
|
1001
|
+
function SettingsTab({
|
|
1002
|
+
channelId,
|
|
1003
|
+
data,
|
|
1004
|
+
components,
|
|
1005
|
+
onComponentsSaved,
|
|
1006
|
+
theme
|
|
1007
|
+
}) {
|
|
1008
|
+
const recorded = componentsOf(components);
|
|
1009
|
+
const [chosen, setChosen] = useState(recorded != null ? recorded : []);
|
|
1010
|
+
const [saving, setSaving] = useState(false);
|
|
1011
|
+
const [studioBusy, setStudioBusy] = useState(false);
|
|
1012
|
+
const [error, setError] = useState(null);
|
|
1013
|
+
const [notice, setNotice] = useState(null);
|
|
1014
|
+
const [pageLink, setPageLink] = useState(null);
|
|
1015
|
+
const [migrations, setMigrations] = useState(null);
|
|
1016
|
+
useEffect(() => {
|
|
1017
|
+
var _a;
|
|
1018
|
+
return setChosen((_a = componentsOf(components)) != null ? _a : []);
|
|
1019
|
+
}, [components]);
|
|
1020
|
+
useEffect(() => {
|
|
1021
|
+
let cancelled = false;
|
|
1022
|
+
data.database(channelId, "migrations").then((r) => {
|
|
1023
|
+
if (!cancelled) setMigrations(r.ok ? mapMigrations(r.value) : []);
|
|
1024
|
+
}).catch(() => void 0);
|
|
1025
|
+
return () => {
|
|
1026
|
+
cancelled = true;
|
|
1027
|
+
};
|
|
1028
|
+
}, [channelId, data]);
|
|
1029
|
+
const dirty = JSON.stringify(chosen) !== JSON.stringify(recorded != null ? recorded : []);
|
|
1030
|
+
const saveComponents = async () => {
|
|
1031
|
+
setSaving(true);
|
|
1032
|
+
setError(null);
|
|
1033
|
+
const r = await data.components(channelId, chosen).finally(() => setSaving(false));
|
|
1034
|
+
if (!r.ok) {
|
|
1035
|
+
setError(failureText(r));
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
setNotice("Saved. The database turns the services on or off in a minute or two.");
|
|
1039
|
+
onComponentsSaved();
|
|
1040
|
+
};
|
|
1041
|
+
const openStudio = async (page) => {
|
|
1042
|
+
if (studioBusy) return;
|
|
1043
|
+
setStudioBusy(true);
|
|
1044
|
+
setError(null);
|
|
1045
|
+
setPageLink(null);
|
|
1046
|
+
try {
|
|
1047
|
+
const r = await data.studioLink(channelId, page);
|
|
1048
|
+
if (!r.ok || !r.value) {
|
|
1049
|
+
setError(failureText(r));
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
await Linking.openURL(r.value);
|
|
1053
|
+
const deep = page ? studioPageUrl(r.value, page) : null;
|
|
1054
|
+
if (deep) setPageLink({
|
|
1055
|
+
label: page === "logs" ? "Open the logs" : `Open ${page}`,
|
|
1056
|
+
url: deep
|
|
1057
|
+
});
|
|
1058
|
+
} catch (e) {
|
|
1059
|
+
setError("Couldn't open Studio.");
|
|
1060
|
+
} finally {
|
|
1061
|
+
setStudioBusy(false);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
const logsOn = (recorded != null ? recorded : []).includes("analytics");
|
|
1065
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.tab, children: [
|
|
1066
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
1067
|
+
/* @__PURE__ */ jsx(Line, { text: notice, tone: "info", theme }),
|
|
1068
|
+
/* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
1069
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, {
|
|
1070
|
+
color: theme.ink
|
|
1071
|
+
}], children: "Supabase Studio" }),
|
|
1072
|
+
/* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
|
|
1073
|
+
/* @__PURE__ */ jsx(Pill, { label: "Open Studio", icon: "open-in-new", busy: studioBusy, onPress: () => {
|
|
1074
|
+
openStudio().catch(() => void 0);
|
|
1075
|
+
}, theme }),
|
|
1076
|
+
/* @__PURE__ */ jsx(Pill, { label: "Open logs", icon: "text-box-outline", disabled: studioBusy, onPress: () => {
|
|
1077
|
+
openStudio("logs").catch(() => void 0);
|
|
1078
|
+
}, theme })
|
|
1079
|
+
] }),
|
|
1080
|
+
pageLink ? /* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
1081
|
+
color: theme.muted
|
|
1082
|
+
}], children: [
|
|
1083
|
+
"Studio is opening and signing you in. Once it has loaded,",
|
|
1084
|
+
" ",
|
|
1085
|
+
/* @__PURE__ */ jsx(Text, { style: {
|
|
1086
|
+
color: theme.accent,
|
|
1087
|
+
fontWeight: "600"
|
|
1088
|
+
}, onPress: () => {
|
|
1089
|
+
Linking.openURL(pageLink.url).catch(() => void 0);
|
|
1090
|
+
}, children: pageLink.label.toLowerCase() }),
|
|
1091
|
+
" ",
|
|
1092
|
+
"(or tap Logs in Studio's sidebar).",
|
|
1093
|
+
!logsOn ? ' Logs stay empty until "Logs (analytics)" is on below.' : ""
|
|
1094
|
+
] }) : null
|
|
1095
|
+
] }),
|
|
1096
|
+
/* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
1097
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, {
|
|
1098
|
+
color: theme.ink
|
|
1099
|
+
}], children: "Database features" }),
|
|
1100
|
+
recorded === null ? /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
1101
|
+
color: theme.muted
|
|
1102
|
+
}], children: "Not changed from here yet: the database runs its standard set (data, auth, storage, Studio)." }) : null,
|
|
1103
|
+
OPTIONAL_COMPONENTS.map((c) => {
|
|
1104
|
+
const on = chosen.includes(c.id);
|
|
1105
|
+
return /* @__PURE__ */ jsxs(Tap, { onPress: saving ? void 0 : () => setChosen((cur) => toggleComponent(cur, c.id, !on)), accessibilityRole: "checkbox", accessibilityState: {
|
|
1106
|
+
checked: on
|
|
1107
|
+
}, pressedStyle: DIM, style: styles.check, children: [
|
|
1108
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: on ? "checkbox-marked" : "checkbox-blank-outline", size: 20, color: on ? theme.accent : theme.muted }),
|
|
1109
|
+
/* @__PURE__ */ jsxs(View, { style: styles.grow, children: [
|
|
1110
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.body, {
|
|
1111
|
+
color: theme.ink
|
|
1112
|
+
}], children: c.label }),
|
|
1113
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
1114
|
+
color: theme.muted
|
|
1115
|
+
}], children: c.detail })
|
|
1116
|
+
] })
|
|
1117
|
+
] }, c.id);
|
|
1118
|
+
}),
|
|
1119
|
+
/* @__PURE__ */ jsx(Pill, { label: "Save features", tone: "primary", busy: saving, disabled: !dirty, onPress: () => {
|
|
1120
|
+
saveComponents().catch(() => void 0);
|
|
1121
|
+
}, theme })
|
|
1122
|
+
] }),
|
|
1123
|
+
/* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
1124
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, {
|
|
1125
|
+
color: theme.ink
|
|
1126
|
+
}], children: "Migrations" }),
|
|
1127
|
+
!migrations ? /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
1128
|
+
color: theme.muted
|
|
1129
|
+
}], children: "Loading\u2026" }) : null,
|
|
1130
|
+
migrations && !migrations.length ? /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
1131
|
+
color: theme.muted
|
|
1132
|
+
}], children: "No migrations applied yet." }) : null,
|
|
1133
|
+
migrations == null ? void 0 : migrations.map((m) => /* @__PURE__ */ jsxs(View, { style: styles.migration, children: [
|
|
1134
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.mono, {
|
|
1135
|
+
color: theme.muted
|
|
1136
|
+
}], children: m.version }),
|
|
1137
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.grow, {
|
|
1138
|
+
color: theme.ink
|
|
1139
|
+
}], numberOfLines: 1, children: m.name || "-" }),
|
|
1140
|
+
m.appliedAt ? /* @__PURE__ */ jsx(Text, { style: [styles.small, {
|
|
1141
|
+
color: theme.muted
|
|
1142
|
+
}], children: shortDate(m.appliedAt) }) : null
|
|
1143
|
+
] }, `${m.version}-${m.name}`))
|
|
1144
|
+
] })
|
|
1145
|
+
] });
|
|
1146
|
+
}
|
|
1147
|
+
function CloudSheet({
|
|
1148
|
+
visible,
|
|
1149
|
+
channelId,
|
|
1150
|
+
data,
|
|
1151
|
+
busy,
|
|
1152
|
+
onRequest,
|
|
1153
|
+
onClose,
|
|
1154
|
+
theme
|
|
1155
|
+
}) {
|
|
1156
|
+
const {
|
|
1157
|
+
height
|
|
1158
|
+
} = useWindowDimensions();
|
|
1159
|
+
const [settings, setSettings] = useState(null);
|
|
1160
|
+
const [settingsLoading, setSettingsLoading] = useState(false);
|
|
1161
|
+
const [outdated, setOutdated] = useState(false);
|
|
1162
|
+
const [settingsError, setSettingsError] = useState(null);
|
|
1163
|
+
const [tab, setTab] = useState("data");
|
|
1164
|
+
const [adding, setAdding] = useState(false);
|
|
1165
|
+
const [error, setError] = useState(null);
|
|
1166
|
+
const loadSettings = useCallback(() => {
|
|
1167
|
+
if (!channelId) return;
|
|
1168
|
+
setSettingsLoading(true);
|
|
1169
|
+
data.getSettings(channelId).then((r) => {
|
|
1170
|
+
var _a;
|
|
1171
|
+
setOutdated(Boolean(!r.ok && r.outdated));
|
|
1172
|
+
setSettingsError(r.ok || r.outdated ? null : failureText(r));
|
|
1173
|
+
if (r.ok) setSettings((_a = r.value) != null ? _a : null);
|
|
1174
|
+
}).catch(() => setSettingsError("Couldn't read this project's database.")).finally(() => setSettingsLoading(false));
|
|
1175
|
+
}, [channelId, data]);
|
|
1176
|
+
useEffect(() => {
|
|
1177
|
+
if (!visible) return;
|
|
1178
|
+
setError(null);
|
|
1179
|
+
setSettings(null);
|
|
1180
|
+
loadSettings();
|
|
1181
|
+
}, [visible, loadSettings]);
|
|
1182
|
+
const db = settings == null ? void 0 : settings.database;
|
|
1183
|
+
const sharedPrefix = (db == null ? void 0 : db.shared) ? db.tablePrefix || null : null;
|
|
1184
|
+
const tabs = cloudTabs(null, {
|
|
1185
|
+
shared: Boolean(sharedPrefix)
|
|
1186
|
+
});
|
|
1187
|
+
const provisioned = hasProvisionedDatabase(settings);
|
|
1188
|
+
useEffect(() => {
|
|
1189
|
+
if (!tabs.includes(tab)) setTab(tabs[0]);
|
|
1190
|
+
}, [tabs, tab]);
|
|
1191
|
+
const sawBusy = useRef(false);
|
|
1192
|
+
useEffect(() => {
|
|
1193
|
+
if (!adding) return void 0;
|
|
1194
|
+
if (busy) sawBusy.current = true;
|
|
1195
|
+
if (provisioned || sawBusy.current && !busy) {
|
|
1196
|
+
setAdding(false);
|
|
1197
|
+
if (!provisioned) loadSettings();
|
|
1198
|
+
return void 0;
|
|
1199
|
+
}
|
|
1200
|
+
if (sawBusy.current) return void 0;
|
|
1201
|
+
const t = setTimeout(() => setAdding(false), 15e3);
|
|
1202
|
+
return () => clearTimeout(t);
|
|
1203
|
+
}, [adding, busy, provisioned, loadSettings]);
|
|
1204
|
+
const addDatabase = () => {
|
|
1205
|
+
if (busy || adding) return;
|
|
1206
|
+
setError(null);
|
|
1207
|
+
if (onRequest(ADD_DATABASE_REQUEST)) {
|
|
1208
|
+
sawBusy.current = false;
|
|
1209
|
+
setAdding(true);
|
|
1210
|
+
} else setError("Could not start the request. Wait for the AI to finish, then try again.");
|
|
1211
|
+
};
|
|
1212
|
+
const fixWithAi = (text) => onRequest(text);
|
|
1213
|
+
let body;
|
|
1214
|
+
if (!channelId) {
|
|
1215
|
+
body = /* @__PURE__ */ jsx(Empty, { text: "Open a project first.", theme });
|
|
1216
|
+
} else if (outdated && !provisioned) {
|
|
1217
|
+
body = /* @__PURE__ */ jsx(Empty, { text: `${OUTDATED_SERVER_MESSAGE}.`, theme });
|
|
1218
|
+
} else if (settingsLoading && !settings) {
|
|
1219
|
+
body = /* @__PURE__ */ jsx(Loading, { theme });
|
|
1220
|
+
} else if (!provisioned) {
|
|
1221
|
+
body = /* @__PURE__ */ jsxs(View, { style: styles.emptyState, children: [
|
|
1222
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "database-outline", size: 30, color: theme.muted }),
|
|
1223
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.heading, styles.center, {
|
|
1224
|
+
color: theme.ink
|
|
1225
|
+
}], children: adding ? "The AI is adding a database\u2026" : "This app doesn't have a database yet" }),
|
|
1226
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.small, styles.center, {
|
|
1227
|
+
color: theme.muted
|
|
1228
|
+
}], children: adding ? "It sets up the tables and connects the pages to them. This fills in when it has finished." : "Add one when the app needs to save things, like sign-ups, orders, bookings or comments. The AI sets up the tables and connects the pages to them." }),
|
|
1229
|
+
/* @__PURE__ */ jsx(Line, { text: settingsError, tone: "error", theme }),
|
|
1230
|
+
/* @__PURE__ */ jsx(PrimaryButton, { label: adding ? "Adding a database\u2026" : "Add a database", icon: "plus", onPress: addDatabase, theme, busy: adding, disabled: busy, testID: "webbuilder-cloud-add-database" }),
|
|
1231
|
+
busy && !adding ? /* @__PURE__ */ jsx(Text, { style: [styles.small, styles.center, {
|
|
1232
|
+
color: theme.muted
|
|
1233
|
+
}], children: "Wait for the AI to finish." }) : null
|
|
1234
|
+
] });
|
|
1235
|
+
} else {
|
|
1236
|
+
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1237
|
+
/* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.tabs, children: tabs.map((t) => /* @__PURE__ */ jsx(Tap, { onPress: () => setTab(t), accessibilityRole: "tab", accessibilityState: {
|
|
1238
|
+
selected: tab === t
|
|
1239
|
+
}, pressedStyle: DIM, style: [styles.tabChip, {
|
|
1240
|
+
backgroundColor: tab === t ? theme.ink : theme.chip
|
|
1241
|
+
}], testID: `webbuilder-cloud-tab-${t}`, children: /* @__PURE__ */ jsx(Text, { style: [styles.tabLabel, {
|
|
1242
|
+
color: tab === t ? theme.screen : theme.ink
|
|
1243
|
+
}], children: CLOUD_TAB_LABELS[t] }) }, t)) }),
|
|
1244
|
+
sharedPrefix ? /* @__PURE__ */ jsxs(Text, { style: [styles.small, {
|
|
1245
|
+
color: theme.muted
|
|
1246
|
+
}], children: [
|
|
1247
|
+
"This site shares its database with other sites: you see its own tables (they start with",
|
|
1248
|
+
" ",
|
|
1249
|
+
/* @__PURE__ */ jsx(Text, { style: styles.mono, children: sharedPrefix }),
|
|
1250
|
+
"). SQL, accounts, storage and health need a database of its own."
|
|
1251
|
+
] }) : null,
|
|
1252
|
+
/* @__PURE__ */ jsxs(ScrollView, { style: styles.grow, contentContainerStyle: styles.scrollBody, keyboardShouldPersistTaps: "handled", children: [
|
|
1253
|
+
tab === "data" ? /* @__PURE__ */ jsx(DataTab, { channelId, data, theme }) : null,
|
|
1254
|
+
tab === "sql" ? /* @__PURE__ */ jsx(SqlTab, { channelId, data, theme }) : null,
|
|
1255
|
+
tab === "health" ? /* @__PURE__ */ jsx(HealthTab, { channelId, data, busy, onFixWithAi: fixWithAi, theme }) : null,
|
|
1256
|
+
tab === "users" ? /* @__PURE__ */ jsx(UsersTab, { channelId, data, theme }) : null,
|
|
1257
|
+
tab === "storage" ? /* @__PURE__ */ jsx(StorageTab, { channelId, data, theme }) : null,
|
|
1258
|
+
tab === "settings" ? /* @__PURE__ */ jsx(SettingsTab, { channelId, data, components: db == null ? void 0 : db.components, onComponentsSaved: loadSettings, theme }) : null
|
|
1259
|
+
] })
|
|
1260
|
+
] });
|
|
1261
|
+
}
|
|
1262
|
+
return /* @__PURE__ */ jsx(Sheet, { visible, title: "Cloud", onClose, theme, testID: "webbuilder-cloud", children: /* @__PURE__ */ jsxs(View, { style: [styles.root, {
|
|
1263
|
+
height: Math.round(height * 0.72)
|
|
1264
|
+
}], children: [
|
|
1265
|
+
/* @__PURE__ */ jsx(Line, { text: error, tone: "error", theme }),
|
|
1266
|
+
body
|
|
1267
|
+
] }) });
|
|
1268
|
+
}
|
|
1269
|
+
const styles = StyleSheet.create({
|
|
1270
|
+
root: {
|
|
1271
|
+
gap: 10
|
|
1272
|
+
},
|
|
1273
|
+
grow: {
|
|
1274
|
+
flex: 1
|
|
1275
|
+
},
|
|
1276
|
+
scrollBody: {
|
|
1277
|
+
paddingBottom: 24
|
|
1278
|
+
},
|
|
1279
|
+
tab: {
|
|
1280
|
+
gap: 10
|
|
1281
|
+
},
|
|
1282
|
+
tabs: {
|
|
1283
|
+
gap: 6,
|
|
1284
|
+
paddingBottom: 2
|
|
1285
|
+
},
|
|
1286
|
+
tabChip: {
|
|
1287
|
+
paddingHorizontal: 14,
|
|
1288
|
+
paddingVertical: 7,
|
|
1289
|
+
borderRadius: 999
|
|
1290
|
+
},
|
|
1291
|
+
tabLabel: {
|
|
1292
|
+
fontSize: 14,
|
|
1293
|
+
fontWeight: "600"
|
|
1294
|
+
},
|
|
1295
|
+
bar: {
|
|
1296
|
+
flexDirection: "row",
|
|
1297
|
+
alignItems: "center",
|
|
1298
|
+
gap: 8
|
|
1299
|
+
},
|
|
1300
|
+
small: {
|
|
1301
|
+
fontSize: 13,
|
|
1302
|
+
lineHeight: 18
|
|
1303
|
+
},
|
|
1304
|
+
body: {
|
|
1305
|
+
fontSize: 15
|
|
1306
|
+
},
|
|
1307
|
+
heading: {
|
|
1308
|
+
fontSize: 15,
|
|
1309
|
+
fontWeight: "700"
|
|
1310
|
+
},
|
|
1311
|
+
mono: {
|
|
1312
|
+
fontFamily: "Menlo",
|
|
1313
|
+
fontSize: 13
|
|
1314
|
+
},
|
|
1315
|
+
italic: {
|
|
1316
|
+
fontStyle: "italic"
|
|
1317
|
+
},
|
|
1318
|
+
center: {
|
|
1319
|
+
textAlign: "center"
|
|
1320
|
+
},
|
|
1321
|
+
empty: {
|
|
1322
|
+
textAlign: "center",
|
|
1323
|
+
paddingVertical: 24
|
|
1324
|
+
},
|
|
1325
|
+
spin: {
|
|
1326
|
+
paddingVertical: 20
|
|
1327
|
+
},
|
|
1328
|
+
banner: {
|
|
1329
|
+
borderRadius: 10,
|
|
1330
|
+
paddingHorizontal: 12,
|
|
1331
|
+
paddingVertical: 8
|
|
1332
|
+
},
|
|
1333
|
+
listRow: {
|
|
1334
|
+
flexDirection: "row",
|
|
1335
|
+
alignItems: "center",
|
|
1336
|
+
gap: 10,
|
|
1337
|
+
paddingVertical: 11,
|
|
1338
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1339
|
+
},
|
|
1340
|
+
iconBtn: {
|
|
1341
|
+
padding: 4
|
|
1342
|
+
},
|
|
1343
|
+
off: {
|
|
1344
|
+
opacity: 0.4
|
|
1345
|
+
},
|
|
1346
|
+
pill: {
|
|
1347
|
+
flexDirection: "row",
|
|
1348
|
+
alignItems: "center",
|
|
1349
|
+
alignSelf: "flex-start",
|
|
1350
|
+
gap: 6,
|
|
1351
|
+
paddingHorizontal: 12,
|
|
1352
|
+
paddingVertical: 8,
|
|
1353
|
+
borderRadius: 999
|
|
1354
|
+
},
|
|
1355
|
+
pillLabel: {
|
|
1356
|
+
fontSize: 13,
|
|
1357
|
+
fontWeight: "600"
|
|
1358
|
+
},
|
|
1359
|
+
input: {
|
|
1360
|
+
borderWidth: 1,
|
|
1361
|
+
borderRadius: 10,
|
|
1362
|
+
paddingHorizontal: 12,
|
|
1363
|
+
paddingVertical: 10,
|
|
1364
|
+
fontSize: 15
|
|
1365
|
+
},
|
|
1366
|
+
multiline: {
|
|
1367
|
+
minHeight: 110,
|
|
1368
|
+
textAlignVertical: "top"
|
|
1369
|
+
},
|
|
1370
|
+
form: {
|
|
1371
|
+
gap: 8,
|
|
1372
|
+
padding: 12,
|
|
1373
|
+
borderRadius: 12,
|
|
1374
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
1375
|
+
},
|
|
1376
|
+
formRow: {
|
|
1377
|
+
flexDirection: "row",
|
|
1378
|
+
alignItems: "center",
|
|
1379
|
+
gap: 8
|
|
1380
|
+
},
|
|
1381
|
+
formLabel: {
|
|
1382
|
+
width: 96
|
|
1383
|
+
},
|
|
1384
|
+
actions: {
|
|
1385
|
+
flexDirection: "row",
|
|
1386
|
+
flexWrap: "wrap",
|
|
1387
|
+
gap: 8,
|
|
1388
|
+
justifyContent: "flex-end"
|
|
1389
|
+
},
|
|
1390
|
+
segment: {
|
|
1391
|
+
paddingHorizontal: 10,
|
|
1392
|
+
paddingVertical: 6,
|
|
1393
|
+
borderRadius: 8
|
|
1394
|
+
},
|
|
1395
|
+
gridRow: {
|
|
1396
|
+
flexDirection: "row",
|
|
1397
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1398
|
+
},
|
|
1399
|
+
leadCell: {
|
|
1400
|
+
width: 36,
|
|
1401
|
+
alignItems: "center",
|
|
1402
|
+
justifyContent: "center"
|
|
1403
|
+
},
|
|
1404
|
+
cell: {
|
|
1405
|
+
width: 150,
|
|
1406
|
+
paddingHorizontal: 8,
|
|
1407
|
+
paddingVertical: 8,
|
|
1408
|
+
fontSize: 13
|
|
1409
|
+
},
|
|
1410
|
+
th: {
|
|
1411
|
+
fontWeight: "700"
|
|
1412
|
+
},
|
|
1413
|
+
section: {
|
|
1414
|
+
gap: 8,
|
|
1415
|
+
paddingTop: 6
|
|
1416
|
+
},
|
|
1417
|
+
card: {
|
|
1418
|
+
flexDirection: "row",
|
|
1419
|
+
gap: 10,
|
|
1420
|
+
padding: 10,
|
|
1421
|
+
borderRadius: 10,
|
|
1422
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
1423
|
+
},
|
|
1424
|
+
column: {
|
|
1425
|
+
flexDirection: "column"
|
|
1426
|
+
},
|
|
1427
|
+
dot: {
|
|
1428
|
+
width: 8,
|
|
1429
|
+
height: 8,
|
|
1430
|
+
borderRadius: 4,
|
|
1431
|
+
marginTop: 6
|
|
1432
|
+
},
|
|
1433
|
+
check: {
|
|
1434
|
+
flexDirection: "row",
|
|
1435
|
+
alignItems: "flex-start",
|
|
1436
|
+
gap: 10,
|
|
1437
|
+
paddingVertical: 6
|
|
1438
|
+
},
|
|
1439
|
+
migration: {
|
|
1440
|
+
flexDirection: "row",
|
|
1441
|
+
alignItems: "baseline",
|
|
1442
|
+
gap: 8,
|
|
1443
|
+
paddingVertical: 2
|
|
1444
|
+
},
|
|
1445
|
+
emptyState: {
|
|
1446
|
+
alignItems: "center",
|
|
1447
|
+
gap: 10,
|
|
1448
|
+
paddingVertical: 24,
|
|
1449
|
+
paddingHorizontal: 8
|
|
1450
|
+
}
|
|
1451
|
+
});export{CloudSheet};//# sourceMappingURL=CloudSheet.js.map
|