Skip to content

Commit cb1dfe8

Browse files
authored
fix: Use LoadingToast for NoiseSensorDeviceDetails (#631)
1 parent 25df528 commit cb1dfe8

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/lib/ui/noise-sensor/NoiseThresholdsList.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useNoiseThresholds } from 'lib/seam/noise-sensors/use-noise-thresholds.
77
import { DetailRow } from 'lib/ui/layout/DetailRow.js'
88
import { DetailSection } from 'lib/ui/layout/DetailSection.js'
99
import { DetailSectionGroup } from 'lib/ui/layout/DetailSectionGroup.js'
10+
import { LoadingToast } from 'lib/ui/LoadingToast/LoadingToast.js'
1011

1112
interface NoiseThresholdsListProps {
1213
device: NoiseSensorDevice
@@ -21,6 +22,14 @@ export function NoiseThresholdsList({
2122

2223
return (
2324
<DetailSectionGroup>
25+
<div className='seam-loading-toast-centered-wrap'>
26+
<LoadingToast
27+
isLoading={isInitialLoading}
28+
label={t.loading}
29+
top='56px'
30+
/>
31+
</div>
32+
2433
<div className='seam-detail-section-wrap'>
2534
<DetailSection
2635
label={t.noiseThresholds}
@@ -39,10 +48,7 @@ export function NoiseThresholdsList({
3948
)
4049
}
4150
>
42-
<Content
43-
isInitialLoading={isInitialLoading}
44-
noiseThresholds={noiseThresholds}
45-
/>
51+
<Content noiseThresholds={noiseThresholds} />
4652
</DetailSection>
4753

4854
<div className='seam-detail-section-footer'>
@@ -59,20 +65,10 @@ export function NoiseThresholdsList({
5965
}
6066

6167
function Content({
62-
isInitialLoading,
6368
noiseThresholds,
6469
}: {
65-
isInitialLoading: boolean
6670
noiseThresholds: NoiseThresholds[] | undefined
6771
}): JSX.Element | JSX.Element[] {
68-
if (isInitialLoading) {
69-
return (
70-
<DetailRow
71-
label={<span className='seam-detail-row-empty-label'>{t.loading}</span>}
72-
/>
73-
)
74-
}
75-
7672
if (noiseThresholds == null || noiseThresholds.length === 0) {
7773
return (
7874
<DetailRow

src/styles/_loading_toast.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
@use './motion';
33

44
@mixin all {
5+
.seam-loading-toast-centered-wrap {
6+
width: 100%;
7+
display: flex;
8+
justify-content: center;
9+
align-items: center;
10+
}
11+
512
.seam-loading-toast {
613
@include motion.scale-in;
714

0 commit comments

Comments
 (0)