Skip to content

Commit 36a54e5

Browse files
committed
style: apply prettier to ehtool traversal updates
1 parent c935a11 commit 36a54e5

4 files changed

Lines changed: 76 additions & 41 deletions

File tree

client/src/views/ehtool/DetectionWorkflow.js

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
582582
if (!frameKey.startsWith(prefix)) return;
583583
filmstripFrameCache.current.delete(frameKey);
584584
});
585-
filmstripFrameCacheOrder.current = filmstripFrameCacheOrder.current.filter(
586-
(frameKey) => !frameKey.startsWith(prefix),
587-
);
585+
filmstripFrameCacheOrder.current =
586+
filmstripFrameCacheOrder.current.filter(
587+
(frameKey) => !frameKey.startsWith(prefix),
588+
);
588589
}
589590
filmstripBatchCache.current.set(key, batch);
590591
touchCacheOrder(filmstripBatchCacheOrder.current, key);
@@ -596,9 +597,10 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
596597
if (!frameKey.startsWith(prefix)) return;
597598
filmstripFrameCache.current.delete(frameKey);
598599
});
599-
filmstripFrameCacheOrder.current = filmstripFrameCacheOrder.current.filter(
600-
(frameKey) => !frameKey.startsWith(prefix),
601-
);
600+
filmstripFrameCacheOrder.current =
601+
filmstripFrameCacheOrder.current.filter(
602+
(frameKey) => !frameKey.startsWith(prefix),
603+
);
602604
}
603605
};
604606

@@ -714,7 +716,10 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
714716
const frameHeight = Math.max(1, Math.floor(fullHeight / safeCount));
715717
const sourceY = Math.max(
716718
0,
717-
Math.min(safeIndex * frameHeight, Math.max(fullHeight - frameHeight, 0)),
719+
Math.min(
720+
safeIndex * frameHeight,
721+
Math.max(fullHeight - frameHeight, 0),
722+
),
718723
);
719724
const croppedBitmap = await createImageBitmap(
720725
blob,
@@ -916,9 +921,12 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
916921
zCount: Number(
917922
response?.headers?.["x-z-count"] ?? FILMSTRIP_BATCH_SIZE,
918923
),
919-
total: Number(response?.headers?.["x-total-layers"] ?? totalLayers ?? 0),
924+
total: Number(
925+
response?.headers?.["x-total-layers"] ?? totalLayers ?? 0,
926+
),
920927
axis: response?.headers?.["x-axis"] ?? axis,
921-
frameHeight: Number(response?.headers?.["x-frame-height"] ?? 0) || null,
928+
frameHeight:
929+
Number(response?.headers?.["x-frame-height"] ?? 0) || null,
922930
},
923931
};
924932
cacheFilmstripBatch(key, entry);
@@ -1640,16 +1648,19 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
16401648
if (scrubIdleRef.current) {
16411649
clearTimeout(scrubIdleRef.current);
16421650
}
1643-
previewDebounceRef.current = setTimeout(() => {
1644-
loadInstancePreview(activeInstanceId, nextIndex, axisToUse, {
1645-
maxDim: PREVIEW_MAX_DIM,
1646-
qualityLabel: `preview-${PREVIEW_MAX_DIM}`,
1647-
prefetchNeighbors: !isFastScrubRef.current,
1648-
prefetchDistance: isFastScrubRef.current ? 0 : 1,
1649-
imageOnly: true,
1650-
priority: 120,
1651-
});
1652-
}, isFastScrubRef.current ? 100 : 60);
1651+
previewDebounceRef.current = setTimeout(
1652+
() => {
1653+
loadInstancePreview(activeInstanceId, nextIndex, axisToUse, {
1654+
maxDim: PREVIEW_MAX_DIM,
1655+
qualityLabel: `preview-${PREVIEW_MAX_DIM}`,
1656+
prefetchNeighbors: !isFastScrubRef.current,
1657+
prefetchDistance: isFastScrubRef.current ? 0 : 1,
1658+
imageOnly: true,
1659+
priority: 120,
1660+
});
1661+
},
1662+
isFastScrubRef.current ? 100 : 60,
1663+
);
16531664

16541665
scrubIdleRef.current = setTimeout(() => {
16551666
if (!isScrubbingRef.current) return;
@@ -1788,7 +1799,9 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
17881799
mode: "overwrite_source",
17891800
create_backup: true,
17901801
});
1791-
message.success(`Source masks updated at ${response.data.written_path}`);
1802+
message.success(
1803+
`Source masks updated at ${response.data.written_path}`,
1804+
);
17921805
if (response.data.backup_path) {
17931806
message.info(`Backup created at ${response.data.backup_path}`);
17941807
}
@@ -1869,7 +1882,10 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
18691882
<Text type="secondary" style={{ fontSize: 12 }}>
18701883
Opacity controls
18711884
</Text>
1872-
<Space size="small" style={{ width: "100%", justifyContent: "space-between" }}>
1885+
<Space
1886+
size="small"
1887+
style={{ width: "100%", justifyContent: "space-between" }}
1888+
>
18731889
<Text style={{ fontSize: 12 }}>Other instances</Text>
18741890
<Text type="secondary" style={{ fontSize: 12 }}>
18751891
{Math.round(overlayAllAlpha * 100)}%
@@ -1881,7 +1897,10 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
18811897
value={Math.round(overlayAllAlpha * 100)}
18821898
onChange={(value) => setOverlayAllAlpha(value / 100)}
18831899
/>
1884-
<Space size="small" style={{ width: "100%", justifyContent: "space-between" }}>
1900+
<Space
1901+
size="small"
1902+
style={{ width: "100%", justifyContent: "space-between" }}
1903+
>
18851904
<Text style={{ fontSize: 12 }}>Selected instance</Text>
18861905
<Text type="secondary" style={{ fontSize: 12 }}>
18871906
{Math.round(overlayActiveAlpha * 100)}%
@@ -1900,7 +1919,11 @@ function DetectionWorkflow({ sessionId, setSessionId, refreshTrigger }) {
19001919
instanceMode !== "none" && instances.length > 0 ? (
19011920
<div style={{ display: "grid", gap: 8 }}>
19021921
<Space size="small" wrap>
1903-
<Button size="small" type="primary" onClick={() => setShowInstanceBrowser(true)}>
1922+
<Button
1923+
size="small"
1924+
type="primary"
1925+
onClick={() => setShowInstanceBrowser(true)}
1926+
>
19041927
Browse...
19051928
</Button>
19061929
<Button size="small" onClick={goToNextUnreviewed}>

client/src/views/ehtool/InstanceNavigator.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ function InstanceNavigator({
6060
);
6161

6262
const total = filtered.length;
63-
const startIndex = Math.max(
64-
0,
65-
Math.floor(scrollTop / rowHeight) - overscan,
66-
);
63+
const startIndex = Math.max(0, Math.floor(scrollTop / rowHeight) - overscan);
6764
const endIndex = Math.min(
6865
total,
6966
Math.ceil((scrollTop + containerHeight) / rowHeight) + overscan,
@@ -135,11 +132,16 @@ function InstanceNavigator({
135132
}}
136133
>
137134
<div style={{ width: "100%" }}>
138-
<Space style={{ width: "100%", justifyContent: "space-between" }}>
135+
<Space
136+
style={{ width: "100%", justifyContent: "space-between" }}
137+
>
139138
<Text style={{ fontSize: 12 }} strong>
140139
#{item.id}
141140
</Text>
142-
<Tag color={statusColor[item.classification]} style={{ fontSize: 10 }}>
141+
<Tag
142+
color={statusColor[item.classification]}
143+
style={{ fontSize: 10 }}
144+
>
143145
{statusLabel[item.classification]}
144146
</Tag>
145147
</Space>

client/src/views/ehtool/ProgressTracker.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import React from "react";
2-
import {
3-
Progress,
4-
Button,
5-
Divider,
6-
Space,
7-
Typography,
8-
} from "antd";
2+
import { Progress, Button, Divider, Space, Typography } from "antd";
93
import {
104
CheckCircleOutlined,
115
CloseCircleOutlined,
@@ -32,7 +26,12 @@ function ProgressTracker({
3226
if (!stats) {
3327
return (
3428
<div style={{ padding: compact ? "0" : "16px" }}>
35-
<div style={{ textAlign: "center", padding: compact ? "8px 4px" : "16px 8px" }}>
29+
<div
30+
style={{
31+
textAlign: "center",
32+
padding: compact ? "8px 4px" : "16px 8px",
33+
}}
34+
>
3635
<Text type="secondary">No session loaded yet.</Text>
3736
</div>
3837
</div>
@@ -43,7 +42,11 @@ function ProgressTracker({
4342

4443
return (
4544
<div style={{ padding: "0" }}>
46-
<Space direction="vertical" size={compact ? 4 : 6} style={{ width: "100%" }}>
45+
<Space
46+
direction="vertical"
47+
size={compact ? 4 : 6}
48+
style={{ width: "100%" }}
49+
>
4750
<Text strong style={{ fontSize: 13 }}>
4851
{totalLayers} {unitLabel}
4952
</Text>
@@ -73,7 +76,8 @@ function ProgressTracker({
7376
{stats.incorrect}
7477
</div>
7578
<div>
76-
<QuestionCircleOutlined style={{ color: "#f59e0b" }} /> {stats.unsure}
79+
<QuestionCircleOutlined style={{ color: "#f59e0b" }} />{" "}
80+
{stats.unsure}
7781
</div>
7882
<div>
7983
<ExclamationCircleOutlined style={{ color: "#cbd5f5" }} />{" "}
@@ -84,7 +88,12 @@ function ProgressTracker({
8488
<Divider style={{ margin: compact ? "4px 0" : "8px 0" }} />
8589

8690
<Space direction="vertical" style={{ width: "100%" }} size="small">
87-
<Button icon={<FolderOpenOutlined />} onClick={onNewSession} block size="small">
91+
<Button
92+
icon={<FolderOpenOutlined />}
93+
onClick={onNewSession}
94+
block
95+
size="small"
96+
>
8897
Load dataset
8998
</Button>
9099
</Space>

client/src/views/ehtool/SliceScheduler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class SliceScheduler {
1717
nearby: options.nearbyConcurrency ?? 1,
1818
background: options.backgroundConcurrency ?? 1,
1919
};
20-
this.onEvent = typeof options.onEvent === "function" ? options.onEvent : null;
20+
this.onEvent =
21+
typeof options.onEvent === "function" ? options.onEvent : null;
2122
this.laneOrder = ["interactive", "nearby", "background"];
2223
this.flushScheduled = false;
2324
}

0 commit comments

Comments
 (0)