@seamapi/react 2.17.0 → 2.18.0
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/README.md +2 -2
- package/dist/elements.js +4018 -3950
- package/dist/elements.js.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.css.map +1 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js +2 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js.map +1 -1
- package/lib/ui/device/NoiseLevelStatus.d.ts +7 -0
- package/lib/ui/device/NoiseLevelStatus.js +32 -0
- package/lib/ui/device/NoiseLevelStatus.js.map +1 -0
- package/lib/ui/noise-sensor/NoiseThresholdsList.js +3 -5
- package/lib/ui/noise-sensor/NoiseThresholdsList.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx +2 -0
- package/src/lib/ui/device/NoiseLevelStatus.tsx +58 -0
- package/src/lib/ui/noise-sensor/NoiseThresholdsList.tsx +10 -14
- package/src/lib/version.ts +1 -1
- package/src/styles/_loading_toast.scss +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoiseThresholdsList.js","sourceRoot":"","sources":["../../../src/lib/ui/noise-sensor/NoiseThresholdsList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AA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GAAG,CACzB,MAAyB,EACzB,UAAyC,EAC1B,EAAE;IACjB,IAAI,MAAM,CAAC,QAAQ,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC,CAAC,UAAU,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACtE,CAAC;IAED,MAAM,cAAc,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,CAAA;IAEtC,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;QAChE,OAAO,GAAG,CAAC,CAAC,UAAU,IAAI,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAA;IAChE,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,GAAG;IACR,eAAe,EAAE,kBAAkB;IACnC,OAAO,EACL,2GAA2G;IAC7G,iBAAiB,EACf,yEAAyE;IAC3E,kBAAkB,EAChB,wFAAwF;IAC1F,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,cAAc;CAC3B,CAAA"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiReactVersion = "2.
|
|
1
|
+
declare const seamapiReactVersion = "2.18.0";
|
|
2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Seam Components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"luxon": "^3.3.0",
|
|
133
133
|
"queue": "^7.0.0",
|
|
134
134
|
"react-hook-form": "^7.46.1",
|
|
135
|
-
"seamapi": "^8.22.
|
|
135
|
+
"seamapi": "^8.22.1",
|
|
136
136
|
"uuid": "^9.0.0",
|
|
137
137
|
"zoned-time": "^1.1.2"
|
|
138
138
|
},
|
|
@@ -5,6 +5,7 @@ import type { NestedSpecificDeviceDetailsProps } from 'lib/seam/components/Devic
|
|
|
5
5
|
import { DeviceInfo } from 'lib/seam/components/DeviceDetails/DeviceInfo.js'
|
|
6
6
|
import { DeviceModel } from 'lib/seam/components/DeviceDetails/DeviceModel.js'
|
|
7
7
|
import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
|
|
8
|
+
import { NoiseLevelStatus } from 'lib/ui/device/NoiseLevelStatus.js'
|
|
8
9
|
import { OnlineStatus } from 'lib/ui/device/OnlineStatus.js'
|
|
9
10
|
import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
|
|
10
11
|
import { NoiseThresholdsList } from 'lib/ui/noise-sensor/NoiseThresholdsList.js'
|
|
@@ -37,6 +38,7 @@ export function NoiseSensorDeviceDetails({
|
|
|
37
38
|
<div className='seam-properties'>
|
|
38
39
|
<span className='seam-label'>{t.status}:</span>{' '}
|
|
39
40
|
<OnlineStatus device={device} />
|
|
41
|
+
<NoiseLevelStatus device={device} />
|
|
40
42
|
<DeviceModel device={device} />
|
|
41
43
|
</div>
|
|
42
44
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { NoiseSensorDevice } from 'seamapi'
|
|
2
|
+
|
|
3
|
+
import { NoiseLevelsIcon } from 'lib/icons/NoiseLevels.js'
|
|
4
|
+
|
|
5
|
+
interface NoiseLevelStatusProps {
|
|
6
|
+
device: NoiseSensorDevice
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function NoiseLevelStatus({
|
|
10
|
+
device,
|
|
11
|
+
}: NoiseLevelStatusProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<span className='seam-label'>{t.noiseLevel}:</span>
|
|
15
|
+
|
|
16
|
+
<div className='seam-device-status'>
|
|
17
|
+
<NoiseLevelsIcon />
|
|
18
|
+
<span className='seam-text'>{getNoiseLevel(device)}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function toNoiseString(value: number | string | undefined): string {
|
|
25
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
26
|
+
return `${Number(value).toFixed(0)} ${t.decibel}`
|
|
27
|
+
}
|
|
28
|
+
return t.unknown
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getNoiseLevel(device: NoiseSensorDevice): string {
|
|
32
|
+
const isMinut = device.device_type === 'minut_sensor'
|
|
33
|
+
const isNoiseAware = device.device_type === 'noiseaware_activity_zone'
|
|
34
|
+
|
|
35
|
+
if (isMinut) {
|
|
36
|
+
return toNoiseString(
|
|
37
|
+
device?.properties?.minut_metadata?.latest_sensor_values?.sound?.value
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isNoiseAware) {
|
|
42
|
+
if (device?.properties?.noiseaware_metadata?.noise_level_nrs === -1) {
|
|
43
|
+
return t.noiseAwareDefault
|
|
44
|
+
}
|
|
45
|
+
return toNoiseString(
|
|
46
|
+
device?.properties?.noiseaware_metadata?.noise_level_decibel
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return toNoiseString(undefined)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const t = {
|
|
54
|
+
noiseLevel: 'Noise level',
|
|
55
|
+
unknown: 'Unknown',
|
|
56
|
+
decibel: 'dB',
|
|
57
|
+
noiseAwareDefault: '0-40 dB',
|
|
58
|
+
}
|
|
@@ -7,6 +7,7 @@ import { useNoiseThresholds } from 'lib/seam/noise-sensors/use-noise-thresholds.
|
|
|
7
7
|
import { DetailRow } from 'lib/ui/layout/DetailRow.js'
|
|
8
8
|
import { DetailSection } from 'lib/ui/layout/DetailSection.js'
|
|
9
9
|
import { DetailSectionGroup } from 'lib/ui/layout/DetailSectionGroup.js'
|
|
10
|
+
import { LoadingToast } from 'lib/ui/LoadingToast/LoadingToast.js'
|
|
10
11
|
|
|
11
12
|
interface NoiseThresholdsListProps {
|
|
12
13
|
device: NoiseSensorDevice
|
|
@@ -21,6 +22,14 @@ export function NoiseThresholdsList({
|
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
24
|
<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
|
+
|
|
24
33
|
<div className='seam-detail-section-wrap'>
|
|
25
34
|
<DetailSection
|
|
26
35
|
label={t.noiseThresholds}
|
|
@@ -39,10 +48,7 @@ export function NoiseThresholdsList({
|
|
|
39
48
|
)
|
|
40
49
|
}
|
|
41
50
|
>
|
|
42
|
-
<Content
|
|
43
|
-
isInitialLoading={isInitialLoading}
|
|
44
|
-
noiseThresholds={noiseThresholds}
|
|
45
|
-
/>
|
|
51
|
+
<Content noiseThresholds={noiseThresholds} />
|
|
46
52
|
</DetailSection>
|
|
47
53
|
|
|
48
54
|
<div className='seam-detail-section-footer'>
|
|
@@ -59,20 +65,10 @@ export function NoiseThresholdsList({
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
function Content({
|
|
62
|
-
isInitialLoading,
|
|
63
68
|
noiseThresholds,
|
|
64
69
|
}: {
|
|
65
|
-
isInitialLoading: boolean
|
|
66
70
|
noiseThresholds: NoiseThresholds[] | undefined
|
|
67
71
|
}): 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
|
-
|
|
76
72
|
if (noiseThresholds == null || noiseThresholds.length === 0) {
|
|
77
73
|
return (
|
|
78
74
|
<DetailRow
|
package/src/lib/version.ts
CHANGED