@olenbetong/synergi-react 4.2.3 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/chrome/AppShell/index.tsx +29 -29
- package/src/chrome/openReport.ts +34 -34
- package/src/colorScheme.ts +81 -81
- package/src/components/DateNavigator/index.tsx +186 -186
- package/src/components/FilePond.tsx +312 -312
- package/src/components/ImageEditor/ImageEditor.tsx +348 -348
- package/src/components/ImageEditor/index.ts +9 -9
- package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
- package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
- package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +405 -405
- package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
- package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
- package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
- package/src/components/ImageEditor/useActiveTool.ts +21 -21
- package/src/components/ImageEditor/useEdgeDetection.ts +319 -319
- package/src/components/ImageEditor/useImageHistory.ts +197 -197
- package/src/components/ImageEditor/useOpenCV.ts +184 -184
- package/src/components/LinkedCardList/index.scss +95 -95
- package/src/components/MergeProgressDialog/index.tsx +249 -249
- package/src/components/PageBanner/index.tsx +80 -80
- package/src/components/PdfViewer/PdfViewer.tsx +158 -158
- package/src/components/ProgressBar/index.scss +96 -96
- package/src/components/SplitContainer/index.tsx +333 -333
- package/src/components/Toolbar/index.tsx +232 -232
- package/src/designsystemet-web-types.d.ts +24 -24
- package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
- package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
- package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
- package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
- package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
- package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
- package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
- package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
- package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
- package/src/elements/ElementLookup.tsx +123 -123
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoder.ts +32 -32
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/dbr.ts +118 -118
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/native.ts +103 -103
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/zxing.ts +95 -95
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders.test.ts +118 -118
- package/src/elements/ElementLookupDialog/BarcodeScanner/duplicateFilter.ts +21 -21
- package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +90 -90
- package/src/elements/ElementLookupDialog/BarcodeScanner/useScanner.ts +280 -280
- package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
- package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
- package/src/elements/ElementLookupDialog/index.tsx +226 -226
- package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
- package/src/elements/ProjectSelect.tsx +130 -130
- package/src/elements/index.ts +15 -15
- package/src/filter/index.ts +34 -34
- package/src/i18n.ts +13 -13
- package/src/index.ts +77 -77
- package/src/mui/MuiThemeProvider.tsx +174 -174
- package/src/mui/index.ts +1 -1
- package/src/test/setup.ts +8 -8
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
import { Box, Button, DialogActions, LinearProgress, Link, Typography } from "@mui/material";
|
|
2
|
-
import { ResponsiveDialog } from "@olenbetong/appframe-mui";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { getLocalizedString } from "../../i18n.js";
|
|
5
|
-
|
|
6
|
-
export type MergeProgressDialogProps = {
|
|
7
|
-
open: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
/** Called once when the dialog opens; should return the merger ID for the start route */
|
|
10
|
-
getMergerId: () => Promise<string | number>;
|
|
11
|
-
mergeType?: "pdf" | "zip";
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type MergePhase =
|
|
15
|
-
| { kind: "preparing" }
|
|
16
|
-
| { kind: "processing"; completed: number; total: number; currentFile: string; startedAt: number }
|
|
17
|
-
| { kind: "completed"; jobId: string; fileName: string }
|
|
18
|
-
| { kind: "failed"; error: string };
|
|
19
|
-
|
|
20
|
-
function formatRemaining(ms: number) {
|
|
21
|
-
if (ms < 60_000) return `~${Math.ceil(ms / 1000)}s`;
|
|
22
|
-
let mins = Math.floor(ms / 60_000);
|
|
23
|
-
let secs = Math.ceil((ms % 60_000) / 1000);
|
|
24
|
-
return secs > 0 ? `~${mins}m ${secs}s` : `~${mins}m`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function MergeProgressDialog({ open, onClose, getMergerId, mergeType = "pdf" }: MergeProgressDialogProps) {
|
|
28
|
-
let [phase, setPhase] = useState<MergePhase>({ kind: "preparing" });
|
|
29
|
-
let [now, setNow] = useState(Date.now);
|
|
30
|
-
let esRef = useRef<EventSource | null>(null);
|
|
31
|
-
let doneRef = useRef(false);
|
|
32
|
-
|
|
33
|
-
// Tick every second while processing to recompute the time estimate
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (phase.kind !== "processing") return;
|
|
36
|
-
let timer = setInterval(() => setNow(Date.now()), 1000);
|
|
37
|
-
return () => clearInterval(timer);
|
|
38
|
-
}, [phase.kind]);
|
|
39
|
-
|
|
40
|
-
// Start the merge job each time the dialog opens
|
|
41
|
-
// oxlint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs on open change
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!open) return;
|
|
44
|
-
|
|
45
|
-
setPhase({ kind: "preparing" });
|
|
46
|
-
doneRef.current = false;
|
|
47
|
-
|
|
48
|
-
let cancelled = false;
|
|
49
|
-
let es: EventSource | null = null;
|
|
50
|
-
|
|
51
|
-
async function start() {
|
|
52
|
-
try {
|
|
53
|
-
let mergerId = await getMergerId();
|
|
54
|
-
if (cancelled) return;
|
|
55
|
-
|
|
56
|
-
let response = await fetch(`/api/ob/merger/start/${mergerId}/${mergeType}`, { method: "POST" });
|
|
57
|
-
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
58
|
-
let { jobId } = await response.json();
|
|
59
|
-
if (cancelled) return;
|
|
60
|
-
|
|
61
|
-
es = new EventSource(`/api/ob/merger/events/${jobId}`);
|
|
62
|
-
esRef.current = es;
|
|
63
|
-
|
|
64
|
-
es.addEventListener("progress", (e) => {
|
|
65
|
-
let d = JSON.parse((e as MessageEvent).data);
|
|
66
|
-
setPhase((prev) => ({
|
|
67
|
-
kind: "processing",
|
|
68
|
-
completed: d.completed,
|
|
69
|
-
total: d.total,
|
|
70
|
-
currentFile: d.currentFile ?? "",
|
|
71
|
-
startedAt: prev.kind === "processing" ? prev.startedAt : Date.now(),
|
|
72
|
-
}));
|
|
73
|
-
setNow(Date.now());
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
es.addEventListener("done", (e) => {
|
|
77
|
-
doneRef.current = true;
|
|
78
|
-
es?.close();
|
|
79
|
-
let d = JSON.parse((e as MessageEvent).data);
|
|
80
|
-
setPhase({ kind: "completed", jobId, fileName: d.fileName ?? "" });
|
|
81
|
-
window.open(`/api/ob/merger/download/${jobId}`);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Catches both server-sent "event: error" and connection errors.
|
|
85
|
-
// After a "done" event the server closes the stream, which also fires error —
|
|
86
|
-
// doneRef guards against treating that as a failure.
|
|
87
|
-
es.addEventListener("error", (e) => {
|
|
88
|
-
if (doneRef.current) return;
|
|
89
|
-
es?.close();
|
|
90
|
-
let message = getLocalizedString("Unknown error");
|
|
91
|
-
let data = (e as MessageEvent).data;
|
|
92
|
-
if (data) {
|
|
93
|
-
try {
|
|
94
|
-
message = JSON.parse(data).message ?? message;
|
|
95
|
-
} catch {}
|
|
96
|
-
}
|
|
97
|
-
setPhase({ kind: "failed", error: message });
|
|
98
|
-
});
|
|
99
|
-
} catch (err: unknown) {
|
|
100
|
-
if (!cancelled) {
|
|
101
|
-
setPhase({ kind: "failed", error: (err as Error)?.message ?? String(err) });
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
start();
|
|
107
|
-
|
|
108
|
-
return () => {
|
|
109
|
-
cancelled = true;
|
|
110
|
-
es?.close();
|
|
111
|
-
esRef.current = null;
|
|
112
|
-
};
|
|
113
|
-
}, [open]);
|
|
114
|
-
|
|
115
|
-
function handleClose() {
|
|
116
|
-
esRef.current?.close();
|
|
117
|
-
esRef.current = null;
|
|
118
|
-
onClose();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let pct = 0;
|
|
122
|
-
let remaining: string | null = null;
|
|
123
|
-
|
|
124
|
-
if (phase.kind === "processing" && phase.total > 0) {
|
|
125
|
-
pct = Math.round((phase.completed / phase.total) * 100);
|
|
126
|
-
if (phase.completed > 0) {
|
|
127
|
-
let elapsed = now - phase.startedAt;
|
|
128
|
-
let msPerFile = elapsed / phase.completed;
|
|
129
|
-
let remainingMs = msPerFile * (phase.total - phase.completed);
|
|
130
|
-
remaining = formatRemaining(remainingMs);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
let title =
|
|
135
|
-
phase.kind === "completed"
|
|
136
|
-
? getLocalizedString("Merge complete")
|
|
137
|
-
: phase.kind === "failed"
|
|
138
|
-
? getLocalizedString("Merge failed")
|
|
139
|
-
: getLocalizedString("Merging drawings");
|
|
140
|
-
|
|
141
|
-
let canClose = phase.kind === "completed" || phase.kind === "failed";
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<ResponsiveDialog
|
|
145
|
-
open={open}
|
|
146
|
-
onClose={canClose ? handleClose : undefined}
|
|
147
|
-
title={title}
|
|
148
|
-
maxWidth="sm"
|
|
149
|
-
fullWidth
|
|
150
|
-
slotProps={{
|
|
151
|
-
transition: {
|
|
152
|
-
mountOnEnter: true,
|
|
153
|
-
unmountOnExit: true,
|
|
154
|
-
},
|
|
155
|
-
}}
|
|
156
|
-
>
|
|
157
|
-
<Box sx={{ px: 3, pb: 1 }}>
|
|
158
|
-
{(phase.kind === "preparing" || phase.kind === "processing") && (
|
|
159
|
-
<LinearProgress
|
|
160
|
-
variant={phase.kind === "preparing" || phase.total === 0 ? "indeterminate" : "determinate"}
|
|
161
|
-
value={pct}
|
|
162
|
-
sx={{ mb: 1.5 }}
|
|
163
|
-
/>
|
|
164
|
-
)}
|
|
165
|
-
|
|
166
|
-
{phase.kind === "preparing" && (
|
|
167
|
-
<Typography
|
|
168
|
-
variant="body2"
|
|
169
|
-
sx={{
|
|
170
|
-
color: "text.secondary",
|
|
171
|
-
}}
|
|
172
|
-
>
|
|
173
|
-
{getLocalizedString("Starting merge job…")}
|
|
174
|
-
</Typography>
|
|
175
|
-
)}
|
|
176
|
-
|
|
177
|
-
{phase.kind === "processing" && (
|
|
178
|
-
<>
|
|
179
|
-
<Typography variant="body2">
|
|
180
|
-
{phase.completed} / {phase.total} {getLocalizedString("files")}
|
|
181
|
-
{remaining && (
|
|
182
|
-
<Typography
|
|
183
|
-
component="span"
|
|
184
|
-
variant="body2"
|
|
185
|
-
sx={{
|
|
186
|
-
color: "text.secondary",
|
|
187
|
-
}}
|
|
188
|
-
>
|
|
189
|
-
{" "}
|
|
190
|
-
— {remaining}
|
|
191
|
-
</Typography>
|
|
192
|
-
)}
|
|
193
|
-
</Typography>
|
|
194
|
-
{phase.currentFile && (
|
|
195
|
-
<Typography
|
|
196
|
-
variant="body2"
|
|
197
|
-
noWrap
|
|
198
|
-
title={phase.currentFile}
|
|
199
|
-
sx={{
|
|
200
|
-
color: "text.secondary",
|
|
201
|
-
mt: 0.5,
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
{phase.currentFile}
|
|
205
|
-
</Typography>
|
|
206
|
-
)}
|
|
207
|
-
</>
|
|
208
|
-
)}
|
|
209
|
-
|
|
210
|
-
{phase.kind === "completed" && (
|
|
211
|
-
<>
|
|
212
|
-
<Typography
|
|
213
|
-
variant="body2"
|
|
214
|
-
sx={{
|
|
215
|
-
color: "success.main",
|
|
216
|
-
}}
|
|
217
|
-
>
|
|
218
|
-
{getLocalizedString("Download started. You can close this dialog.")}
|
|
219
|
-
</Typography>
|
|
220
|
-
<Typography
|
|
221
|
-
variant="body2"
|
|
222
|
-
sx={{
|
|
223
|
-
color: "text.secondary",
|
|
224
|
-
mt: 1,
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
{getLocalizedString("If the file did not open automatically, ")}{" "}
|
|
228
|
-
<Link href={`/api/ob/merger/download/${phase.jobId}`} target="_blank" rel="noopener noreferrer">
|
|
229
|
-
{getLocalizedString("click here to open it")}
|
|
230
|
-
</Link>
|
|
231
|
-
.
|
|
232
|
-
</Typography>
|
|
233
|
-
</>
|
|
234
|
-
)}
|
|
235
|
-
|
|
236
|
-
{phase.kind === "failed" && (
|
|
237
|
-
<Typography variant="body2" color="error">
|
|
238
|
-
{phase.error}
|
|
239
|
-
</Typography>
|
|
240
|
-
)}
|
|
241
|
-
</Box>
|
|
242
|
-
<DialogActions>
|
|
243
|
-
<Button onClick={handleClose} disabled={!canClose}>
|
|
244
|
-
{getLocalizedString("Close")}
|
|
245
|
-
</Button>
|
|
246
|
-
</DialogActions>
|
|
247
|
-
</ResponsiveDialog>
|
|
248
|
-
);
|
|
249
|
-
}
|
|
1
|
+
import { Box, Button, DialogActions, LinearProgress, Link, Typography } from "@mui/material";
|
|
2
|
+
import { ResponsiveDialog } from "@olenbetong/appframe-mui";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
5
|
+
|
|
6
|
+
export type MergeProgressDialogProps = {
|
|
7
|
+
open: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/** Called once when the dialog opens; should return the merger ID for the start route */
|
|
10
|
+
getMergerId: () => Promise<string | number>;
|
|
11
|
+
mergeType?: "pdf" | "zip";
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type MergePhase =
|
|
15
|
+
| { kind: "preparing" }
|
|
16
|
+
| { kind: "processing"; completed: number; total: number; currentFile: string; startedAt: number }
|
|
17
|
+
| { kind: "completed"; jobId: string; fileName: string }
|
|
18
|
+
| { kind: "failed"; error: string };
|
|
19
|
+
|
|
20
|
+
function formatRemaining(ms: number) {
|
|
21
|
+
if (ms < 60_000) return `~${Math.ceil(ms / 1000)}s`;
|
|
22
|
+
let mins = Math.floor(ms / 60_000);
|
|
23
|
+
let secs = Math.ceil((ms % 60_000) / 1000);
|
|
24
|
+
return secs > 0 ? `~${mins}m ${secs}s` : `~${mins}m`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function MergeProgressDialog({ open, onClose, getMergerId, mergeType = "pdf" }: MergeProgressDialogProps) {
|
|
28
|
+
let [phase, setPhase] = useState<MergePhase>({ kind: "preparing" });
|
|
29
|
+
let [now, setNow] = useState(Date.now);
|
|
30
|
+
let esRef = useRef<EventSource | null>(null);
|
|
31
|
+
let doneRef = useRef(false);
|
|
32
|
+
|
|
33
|
+
// Tick every second while processing to recompute the time estimate
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (phase.kind !== "processing") return;
|
|
36
|
+
let timer = setInterval(() => setNow(Date.now()), 1000);
|
|
37
|
+
return () => clearInterval(timer);
|
|
38
|
+
}, [phase.kind]);
|
|
39
|
+
|
|
40
|
+
// Start the merge job each time the dialog opens
|
|
41
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs on open change
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!open) return;
|
|
44
|
+
|
|
45
|
+
setPhase({ kind: "preparing" });
|
|
46
|
+
doneRef.current = false;
|
|
47
|
+
|
|
48
|
+
let cancelled = false;
|
|
49
|
+
let es: EventSource | null = null;
|
|
50
|
+
|
|
51
|
+
async function start() {
|
|
52
|
+
try {
|
|
53
|
+
let mergerId = await getMergerId();
|
|
54
|
+
if (cancelled) return;
|
|
55
|
+
|
|
56
|
+
let response = await fetch(`/api/ob/merger/start/${mergerId}/${mergeType}`, { method: "POST" });
|
|
57
|
+
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
58
|
+
let { jobId } = await response.json();
|
|
59
|
+
if (cancelled) return;
|
|
60
|
+
|
|
61
|
+
es = new EventSource(`/api/ob/merger/events/${jobId}`);
|
|
62
|
+
esRef.current = es;
|
|
63
|
+
|
|
64
|
+
es.addEventListener("progress", (e) => {
|
|
65
|
+
let d = JSON.parse((e as MessageEvent).data);
|
|
66
|
+
setPhase((prev) => ({
|
|
67
|
+
kind: "processing",
|
|
68
|
+
completed: d.completed,
|
|
69
|
+
total: d.total,
|
|
70
|
+
currentFile: d.currentFile ?? "",
|
|
71
|
+
startedAt: prev.kind === "processing" ? prev.startedAt : Date.now(),
|
|
72
|
+
}));
|
|
73
|
+
setNow(Date.now());
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
es.addEventListener("done", (e) => {
|
|
77
|
+
doneRef.current = true;
|
|
78
|
+
es?.close();
|
|
79
|
+
let d = JSON.parse((e as MessageEvent).data);
|
|
80
|
+
setPhase({ kind: "completed", jobId, fileName: d.fileName ?? "" });
|
|
81
|
+
window.open(`/api/ob/merger/download/${jobId}`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Catches both server-sent "event: error" and connection errors.
|
|
85
|
+
// After a "done" event the server closes the stream, which also fires error —
|
|
86
|
+
// doneRef guards against treating that as a failure.
|
|
87
|
+
es.addEventListener("error", (e) => {
|
|
88
|
+
if (doneRef.current) return;
|
|
89
|
+
es?.close();
|
|
90
|
+
let message = getLocalizedString("Unknown error");
|
|
91
|
+
let data = (e as MessageEvent).data;
|
|
92
|
+
if (data) {
|
|
93
|
+
try {
|
|
94
|
+
message = JSON.parse(data).message ?? message;
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
setPhase({ kind: "failed", error: message });
|
|
98
|
+
});
|
|
99
|
+
} catch (err: unknown) {
|
|
100
|
+
if (!cancelled) {
|
|
101
|
+
setPhase({ kind: "failed", error: (err as Error)?.message ?? String(err) });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
start();
|
|
107
|
+
|
|
108
|
+
return () => {
|
|
109
|
+
cancelled = true;
|
|
110
|
+
es?.close();
|
|
111
|
+
esRef.current = null;
|
|
112
|
+
};
|
|
113
|
+
}, [open]);
|
|
114
|
+
|
|
115
|
+
function handleClose() {
|
|
116
|
+
esRef.current?.close();
|
|
117
|
+
esRef.current = null;
|
|
118
|
+
onClose();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let pct = 0;
|
|
122
|
+
let remaining: string | null = null;
|
|
123
|
+
|
|
124
|
+
if (phase.kind === "processing" && phase.total > 0) {
|
|
125
|
+
pct = Math.round((phase.completed / phase.total) * 100);
|
|
126
|
+
if (phase.completed > 0) {
|
|
127
|
+
let elapsed = now - phase.startedAt;
|
|
128
|
+
let msPerFile = elapsed / phase.completed;
|
|
129
|
+
let remainingMs = msPerFile * (phase.total - phase.completed);
|
|
130
|
+
remaining = formatRemaining(remainingMs);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let title =
|
|
135
|
+
phase.kind === "completed"
|
|
136
|
+
? getLocalizedString("Merge complete")
|
|
137
|
+
: phase.kind === "failed"
|
|
138
|
+
? getLocalizedString("Merge failed")
|
|
139
|
+
: getLocalizedString("Merging drawings");
|
|
140
|
+
|
|
141
|
+
let canClose = phase.kind === "completed" || phase.kind === "failed";
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<ResponsiveDialog
|
|
145
|
+
open={open}
|
|
146
|
+
onClose={canClose ? handleClose : undefined}
|
|
147
|
+
title={title}
|
|
148
|
+
maxWidth="sm"
|
|
149
|
+
fullWidth
|
|
150
|
+
slotProps={{
|
|
151
|
+
transition: {
|
|
152
|
+
mountOnEnter: true,
|
|
153
|
+
unmountOnExit: true,
|
|
154
|
+
},
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<Box sx={{ px: 3, pb: 1 }}>
|
|
158
|
+
{(phase.kind === "preparing" || phase.kind === "processing") && (
|
|
159
|
+
<LinearProgress
|
|
160
|
+
variant={phase.kind === "preparing" || phase.total === 0 ? "indeterminate" : "determinate"}
|
|
161
|
+
value={pct}
|
|
162
|
+
sx={{ mb: 1.5 }}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
|
|
166
|
+
{phase.kind === "preparing" && (
|
|
167
|
+
<Typography
|
|
168
|
+
variant="body2"
|
|
169
|
+
sx={{
|
|
170
|
+
color: "text.secondary",
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
{getLocalizedString("Starting merge job…")}
|
|
174
|
+
</Typography>
|
|
175
|
+
)}
|
|
176
|
+
|
|
177
|
+
{phase.kind === "processing" && (
|
|
178
|
+
<>
|
|
179
|
+
<Typography variant="body2">
|
|
180
|
+
{phase.completed} / {phase.total} {getLocalizedString("files")}
|
|
181
|
+
{remaining && (
|
|
182
|
+
<Typography
|
|
183
|
+
component="span"
|
|
184
|
+
variant="body2"
|
|
185
|
+
sx={{
|
|
186
|
+
color: "text.secondary",
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{" "}
|
|
190
|
+
— {remaining}
|
|
191
|
+
</Typography>
|
|
192
|
+
)}
|
|
193
|
+
</Typography>
|
|
194
|
+
{phase.currentFile && (
|
|
195
|
+
<Typography
|
|
196
|
+
variant="body2"
|
|
197
|
+
noWrap
|
|
198
|
+
title={phase.currentFile}
|
|
199
|
+
sx={{
|
|
200
|
+
color: "text.secondary",
|
|
201
|
+
mt: 0.5,
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
{phase.currentFile}
|
|
205
|
+
</Typography>
|
|
206
|
+
)}
|
|
207
|
+
</>
|
|
208
|
+
)}
|
|
209
|
+
|
|
210
|
+
{phase.kind === "completed" && (
|
|
211
|
+
<>
|
|
212
|
+
<Typography
|
|
213
|
+
variant="body2"
|
|
214
|
+
sx={{
|
|
215
|
+
color: "success.main",
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
{getLocalizedString("Download started. You can close this dialog.")}
|
|
219
|
+
</Typography>
|
|
220
|
+
<Typography
|
|
221
|
+
variant="body2"
|
|
222
|
+
sx={{
|
|
223
|
+
color: "text.secondary",
|
|
224
|
+
mt: 1,
|
|
225
|
+
}}
|
|
226
|
+
>
|
|
227
|
+
{getLocalizedString("If the file did not open automatically, ")}{" "}
|
|
228
|
+
<Link href={`/api/ob/merger/download/${phase.jobId}`} target="_blank" rel="noopener noreferrer">
|
|
229
|
+
{getLocalizedString("click here to open it")}
|
|
230
|
+
</Link>
|
|
231
|
+
.
|
|
232
|
+
</Typography>
|
|
233
|
+
</>
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
{phase.kind === "failed" && (
|
|
237
|
+
<Typography variant="body2" color="error">
|
|
238
|
+
{phase.error}
|
|
239
|
+
</Typography>
|
|
240
|
+
)}
|
|
241
|
+
</Box>
|
|
242
|
+
<DialogActions>
|
|
243
|
+
<Button onClick={handleClose} disabled={!canClose}>
|
|
244
|
+
{getLocalizedString("Close")}
|
|
245
|
+
</Button>
|
|
246
|
+
</DialogActions>
|
|
247
|
+
</ResponsiveDialog>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import "./index.scss";
|
|
2
|
-
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
export type PageBannerProps = React.HTMLProps<HTMLDivElement> & {
|
|
7
|
-
as?: "header" | "section" | "div";
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function PageBanner({ as, className, children, ...other }: PageBannerProps) {
|
|
11
|
-
const Component = as ? as : "section";
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Component className={clsx("ObPageBanner-root", className)} {...other}>
|
|
15
|
-
<div className="container px-0">
|
|
16
|
-
<div className={"ObPageBanner-pageBannerInner"}>{children}</div>
|
|
17
|
-
</div>
|
|
18
|
-
</Component>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type BannerImageProps = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
|
23
|
-
|
|
24
|
-
export const BannerImage = React.forwardRef<HTMLImageElement, BannerImageProps>(function BannerImage(
|
|
25
|
-
props: BannerImageProps,
|
|
26
|
-
ref,
|
|
27
|
-
) {
|
|
28
|
-
const { className, ...other } = props;
|
|
29
|
-
return <img ref={ref} className={clsx("ObPageBanner-bannerImage", className)} alt="" {...other} />;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export type TabListProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & {
|
|
33
|
-
as?: "ul" | "ol" | "nav" | "div" | "span";
|
|
34
|
-
sticky?: boolean;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export function TabList({ as, className, children, sticky, ...other }: TabListProps) {
|
|
38
|
-
const Component = as ? as : "nav";
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Component
|
|
42
|
-
className={clsx("ObPageBanner-pageBanner", "ObPageBanner-tabList", sticky && "sticky", className)}
|
|
43
|
-
{...other}
|
|
44
|
-
>
|
|
45
|
-
<div className="container px-0">
|
|
46
|
-
<div className={"ObPageBanner-tabListInner"}>{children}</div>
|
|
47
|
-
</div>
|
|
48
|
-
</Component>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type TabProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> &
|
|
53
|
-
Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel"> & {
|
|
54
|
-
active?: boolean;
|
|
55
|
-
as?: "a" | "li" | "div" | "span";
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export function Tab({ active, as, className, children, ...other }: TabProps) {
|
|
59
|
-
const Component = as ? as : "a";
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Component className={clsx("ObPageBanner-tab", active && "active", className)} {...other}>
|
|
63
|
-
{children}
|
|
64
|
-
</Component>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type TitleProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & {
|
|
69
|
-
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span" | "p";
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export function Title({ as, className, children, ...other }: TitleProps) {
|
|
73
|
-
const Component = as ? as : "h1";
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<Component className={clsx("ObPageBanner-bannerTitle", className)} {...other}>
|
|
77
|
-
{children}
|
|
78
|
-
</Component>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
export type PageBannerProps = React.HTMLProps<HTMLDivElement> & {
|
|
7
|
+
as?: "header" | "section" | "div";
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function PageBanner({ as, className, children, ...other }: PageBannerProps) {
|
|
11
|
+
const Component = as ? as : "section";
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Component className={clsx("ObPageBanner-root", className)} {...other}>
|
|
15
|
+
<div className="container px-0">
|
|
16
|
+
<div className={"ObPageBanner-pageBannerInner"}>{children}</div>
|
|
17
|
+
</div>
|
|
18
|
+
</Component>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type BannerImageProps = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
|
23
|
+
|
|
24
|
+
export const BannerImage = React.forwardRef<HTMLImageElement, BannerImageProps>(function BannerImage(
|
|
25
|
+
props: BannerImageProps,
|
|
26
|
+
ref,
|
|
27
|
+
) {
|
|
28
|
+
const { className, ...other } = props;
|
|
29
|
+
return <img ref={ref} className={clsx("ObPageBanner-bannerImage", className)} alt="" {...other} />;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type TabListProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & {
|
|
33
|
+
as?: "ul" | "ol" | "nav" | "div" | "span";
|
|
34
|
+
sticky?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function TabList({ as, className, children, sticky, ...other }: TabListProps) {
|
|
38
|
+
const Component = as ? as : "nav";
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Component
|
|
42
|
+
className={clsx("ObPageBanner-pageBanner", "ObPageBanner-tabList", sticky && "sticky", className)}
|
|
43
|
+
{...other}
|
|
44
|
+
>
|
|
45
|
+
<div className="container px-0">
|
|
46
|
+
<div className={"ObPageBanner-tabListInner"}>{children}</div>
|
|
47
|
+
</div>
|
|
48
|
+
</Component>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type TabProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> &
|
|
53
|
+
Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel"> & {
|
|
54
|
+
active?: boolean;
|
|
55
|
+
as?: "a" | "li" | "div" | "span";
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export function Tab({ active, as, className, children, ...other }: TabProps) {
|
|
59
|
+
const Component = as ? as : "a";
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Component className={clsx("ObPageBanner-tab", active && "active", className)} {...other}>
|
|
63
|
+
{children}
|
|
64
|
+
</Component>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type TitleProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & {
|
|
69
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span" | "p";
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export function Title({ as, className, children, ...other }: TitleProps) {
|
|
73
|
+
const Component = as ? as : "h1";
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Component className={clsx("ObPageBanner-bannerTitle", className)} {...other}>
|
|
77
|
+
{children}
|
|
78
|
+
</Component>
|
|
79
|
+
);
|
|
80
|
+
}
|