@seamapi/react 0.16.1 → 0.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 +28 -2
- package/index.css +294 -69
- package/index.css.map +1 -1
- package/index.min.css +1 -1
- package/index.min.css.map +1 -1
- package/lib/icons/LockLocked.d.ts +2 -0
- package/lib/icons/LockLocked.js +5 -0
- package/lib/icons/LockLocked.js.map +1 -0
- package/lib/icons/LockUnlocked.d.ts +2 -0
- package/lib/icons/LockUnlocked.js +5 -0
- package/lib/icons/LockUnlocked.js.map +1 -0
- package/lib/seam/access-codes/use-access-code.d.ts +4 -0
- package/lib/seam/access-codes/use-access-code.js +16 -0
- package/lib/seam/access-codes/use-access-code.js.map +1 -0
- package/lib/seam/access-codes/use-access-codes.d.ts +9 -0
- package/lib/seam/access-codes/use-access-codes.js +18 -0
- package/lib/seam/access-codes/use-access-codes.js.map +1 -0
- package/lib/seam/devices/types.d.ts +2 -0
- package/lib/seam/devices/types.js +2 -0
- package/lib/seam/devices/types.js.map +1 -0
- package/lib/seam/devices/use-device.d.ts +9 -0
- package/lib/seam/devices/use-device.js +56 -0
- package/lib/seam/devices/use-device.js.map +1 -0
- package/lib/seam/devices/use-devices.d.ts +4 -9
- package/lib/seam/devices/use-devices.js +2 -1
- package/lib/seam/devices/use-devices.js.map +1 -1
- package/lib/seam/index.d.ts +4 -1
- package/lib/seam/index.js +4 -1
- package/lib/seam/index.js.map +1 -1
- package/lib/seam/use-seam-client.js +3 -3
- package/lib/seam/use-seam-client.js.map +1 -1
- package/lib/seam/use-seam-query-result.js.map +1 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDetails.d.ts +6 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDetails.js +64 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDetails.js.map +1 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDevice.d.ts +5 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDevice.js +23 -0
- package/lib/ui/AccessCodeDetails/AccessCodeDevice.js.map +1 -0
- package/lib/ui/AccessCodeTable/AccessCodeTable.d.ts +1 -1
- package/lib/ui/AccessCodeTable/AccessCodeTable.js +19 -5
- package/lib/ui/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/ui/AccessCodeTable/AccessCodeTableContent.d.ts +1 -1
- package/lib/ui/AccessCodeTable/AccessCodeTableContent.js +7 -3
- package/lib/ui/AccessCodeTable/AccessCodeTableContent.js.map +1 -1
- package/lib/ui/AccessCodeTable/CodeDetails.js +1 -1
- package/lib/ui/AccessCodeTable/CodeDetails.js.map +1 -1
- package/lib/ui/Button.d.ts +8 -0
- package/lib/ui/Button.js +8 -0
- package/lib/ui/Button.js.map +1 -0
- package/lib/ui/DeviceDetails/DeviceDetails.d.ts +4 -3
- package/lib/ui/DeviceDetails/DeviceDetails.js +25 -9
- package/lib/ui/DeviceDetails/DeviceDetails.js.map +1 -1
- package/lib/ui/DeviceDetails/DeviceModel.d.ts +7 -0
- package/lib/ui/DeviceDetails/DeviceModel.js +18 -0
- package/lib/ui/DeviceDetails/DeviceModel.js.map +1 -0
- package/lib/ui/DeviceTable/DeviceTable.d.ts +7 -0
- package/lib/ui/DeviceTable/DeviceTable.js +49 -0
- package/lib/ui/DeviceTable/DeviceTable.js.map +1 -0
- package/lib/ui/IconButton.js +1 -1
- package/lib/ui/IconButton.js.map +1 -1
- package/lib/ui/Table/TableRow.d.ts +3 -1
- package/lib/ui/Table/TableRow.js +1 -1
- package/lib/ui/Table/TableRow.js.map +1 -1
- package/lib/ui/TextButton.d.ts +7 -0
- package/lib/ui/TextButton.js +5 -0
- package/lib/ui/TextButton.js.map +1 -0
- package/lib/ui/TextField/SearchTextField.d.ts +1 -1
- package/lib/ui/TextField/SearchTextField.js +1 -1
- package/lib/ui/TextField/SearchTextField.js.map +1 -1
- package/lib/ui/device/BatteryStatus.d.ts +5 -0
- package/lib/ui/{DeviceDetails → device}/BatteryStatus.js +5 -6
- package/lib/ui/device/BatteryStatus.js.map +1 -0
- package/lib/ui/{DeviceDetails → device}/DeviceImage.d.ts +2 -1
- package/lib/ui/{DeviceDetails → device}/DeviceImage.js +2 -2
- package/lib/ui/device/DeviceImage.js.map +1 -0
- package/lib/ui/device/LockStatus.d.ts +5 -0
- package/lib/ui/device/LockStatus.js +19 -0
- package/lib/ui/device/LockStatus.js.map +1 -0
- package/lib/ui/device/OnlineStatus.d.ts +5 -0
- package/lib/ui/{DeviceDetails → device}/OnlineStatus.js +4 -5
- package/lib/ui/device/OnlineStatus.js.map +1 -0
- package/lib/ui/index.d.ts +3 -1
- package/lib/ui/index.js +3 -1
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/layout/ContentHeader.d.ts +2 -2
- package/lib/ui/layout/ContentHeader.js +5 -1
- package/lib/ui/layout/ContentHeader.js.map +1 -1
- package/package.json +4 -5
- package/src/icons/lock-locked.svg +8 -0
- package/src/icons/lock-unlocked.svg +9 -0
- package/src/lib/icons/LockLocked.tsx +32 -0
- package/src/lib/icons/LockUnlocked.tsx +34 -0
- package/src/lib/seam/access-codes/use-access-code.ts +24 -0
- package/src/lib/seam/access-codes/use-access-codes.ts +39 -0
- package/src/lib/seam/devices/types.ts +5 -0
- package/src/lib/seam/devices/use-device.ts +79 -0
- package/src/lib/seam/devices/use-devices.ts +13 -8
- package/src/lib/seam/index.ts +4 -1
- package/src/lib/seam/use-seam-client.ts +3 -3
- package/src/lib/ui/AccessCodeDetails/AccessCodeDetails.tsx +154 -0
- package/src/lib/ui/AccessCodeDetails/AccessCodeDevice.tsx +49 -0
- package/src/lib/ui/AccessCodeTable/AccessCodeTable.tsx +33 -12
- package/src/lib/ui/AccessCodeTable/AccessCodeTableContent.tsx +8 -11
- package/src/lib/ui/AccessCodeTable/CodeDetails.tsx +1 -1
- package/src/lib/ui/Button.tsx +26 -0
- package/src/lib/ui/DeviceDetails/DeviceDetails.tsx +49 -22
- package/src/lib/ui/DeviceDetails/DeviceModel.tsx +34 -0
- package/src/lib/ui/DeviceTable/DeviceTable.tsx +110 -0
- package/src/lib/ui/IconButton.tsx +1 -1
- package/src/lib/ui/Table/TableRow.tsx +8 -2
- package/src/lib/ui/TextButton.tsx +15 -0
- package/src/lib/ui/TextField/SearchTextField.tsx +1 -1
- package/src/lib/ui/{DeviceDetails → device}/BatteryStatus.tsx +12 -14
- package/src/lib/ui/device/DeviceImage.tsx +15 -0
- package/src/lib/ui/device/LockStatus.tsx +46 -0
- package/src/lib/ui/{DeviceDetails → device}/OnlineStatus.tsx +15 -11
- package/src/lib/ui/index.ts +3 -1
- package/src/lib/ui/layout/ContentHeader.tsx +9 -4
- package/src/styles/_access-code-details.scss +121 -0
- package/src/styles/_access-code-table.scss +34 -38
- package/src/styles/_buttons.scss +125 -8
- package/src/styles/_colors.scss +30 -0
- package/src/styles/_device-details.scss +21 -10
- package/src/styles/_device-table.scss +63 -0
- package/src/styles/_icons.scss +9 -0
- package/src/styles/_inputs.scss +3 -1
- package/src/styles/_layout.scss +5 -1
- package/src/styles/_main.scss +8 -14
- package/src/styles/_tables.scss +6 -0
- package/src/styles/_typography.scss +18 -2
- package/lib/hooks/use-access-codes.d.ts +0 -5
- package/lib/hooks/use-access-codes.js +0 -16
- package/lib/hooks/use-access-codes.js.map +0 -1
- package/lib/hooks/use-device.d.ts +0 -5
- package/lib/hooks/use-device.js +0 -17
- package/lib/hooks/use-device.js.map +0 -1
- package/lib/hooks/use-devices.d.ts +0 -1
- package/lib/hooks/use-devices.js +0 -2
- package/lib/hooks/use-devices.js.map +0 -1
- package/lib/hooks/use-seam-client.d.ts +0 -1
- package/lib/hooks/use-seam-client.js +0 -2
- package/lib/hooks/use-seam-client.js.map +0 -1
- package/lib/seam/devices/index.d.ts +0 -1
- package/lib/seam/devices/index.js +0 -2
- package/lib/seam/devices/index.js.map +0 -1
- package/lib/types/use-seam-query-result.js.map +0 -1
- package/lib/ui/AccessCodeTable/index.d.ts +0 -2
- package/lib/ui/AccessCodeTable/index.js +0 -3
- package/lib/ui/AccessCodeTable/index.js.map +0 -1
- package/lib/ui/DeviceDetails/BatteryStatus.d.ts +0 -4
- package/lib/ui/DeviceDetails/BatteryStatus.js.map +0 -1
- package/lib/ui/DeviceDetails/DeviceImage.js.map +0 -1
- package/lib/ui/DeviceDetails/ModelStatus.d.ts +0 -4
- package/lib/ui/DeviceDetails/ModelStatus.js +0 -13
- package/lib/ui/DeviceDetails/ModelStatus.js.map +0 -1
- package/lib/ui/DeviceDetails/OnlineStatus.d.ts +0 -4
- package/lib/ui/DeviceDetails/OnlineStatus.js.map +0 -1
- package/lib/ui/DeviceDetails/index.d.ts +0 -5
- package/lib/ui/DeviceDetails/index.js +0 -6
- package/lib/ui/DeviceDetails/index.js.map +0 -1
- package/lib/ui/DeviceManager/DeviceManager.d.ts +0 -6
- package/lib/ui/DeviceManager/DeviceManager.js +0 -24
- package/lib/ui/DeviceManager/DeviceManager.js.map +0 -1
- package/lib/ui/DeviceManager/index.d.ts +0 -1
- package/lib/ui/DeviceManager/index.js +0 -2
- package/lib/ui/DeviceManager/index.js.map +0 -1
- package/lib/ui/Table/index.d.ts +0 -5
- package/lib/ui/Table/index.js +0 -6
- package/lib/ui/Table/index.js.map +0 -1
- package/lib/ui/TextField/index.d.ts +0 -2
- package/lib/ui/TextField/index.js +0 -3
- package/lib/ui/TextField/index.js.map +0 -1
- package/src/lib/hooks/use-access-codes.ts +0 -21
- package/src/lib/hooks/use-device.ts +0 -26
- package/src/lib/hooks/use-devices.ts +0 -1
- package/src/lib/hooks/use-seam-client.ts +0 -1
- package/src/lib/seam/devices/index.ts +0 -1
- package/src/lib/ui/AccessCodeTable/index.ts +0 -2
- package/src/lib/ui/DeviceDetails/DeviceImage.tsx +0 -12
- package/src/lib/ui/DeviceDetails/ModelStatus.tsx +0 -25
- package/src/lib/ui/DeviceDetails/index.ts +0 -5
- package/src/lib/ui/DeviceManager/DeviceManager.tsx +0 -52
- package/src/lib/ui/DeviceManager/index.ts +0 -1
- package/src/lib/ui/Table/index.ts +0 -5
- package/src/lib/ui/TextField/index.ts +0 -2
- /package/lib/{types → seam}/use-seam-query-result.d.ts +0 -0
- /package/lib/{types → seam}/use-seam-query-result.js +0 -0
- /package/src/lib/{types → seam}/use-seam-query-result.ts +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import type { CommonDeviceProperties, Device } from 'seamapi'
|
|
3
|
+
|
|
4
|
+
import { isLockDevice } from 'lib/seam/devices/types.js'
|
|
5
|
+
import {
|
|
6
|
+
useDevices,
|
|
7
|
+
type UseDevicesData,
|
|
8
|
+
type UseDevicesParams,
|
|
9
|
+
} from 'lib/seam/devices/use-devices.js'
|
|
10
|
+
import { BatteryStatus } from 'lib/ui/device/BatteryStatus.js'
|
|
11
|
+
import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
|
|
12
|
+
import { LockStatus } from 'lib/ui/device/LockStatus.js'
|
|
13
|
+
import { OnlineStatus } from 'lib/ui/device/OnlineStatus.js'
|
|
14
|
+
import { DeviceDetails } from 'lib/ui/DeviceDetails/DeviceDetails.js'
|
|
15
|
+
import { getDeviceModel } from 'lib/ui/DeviceDetails/DeviceModel.js'
|
|
16
|
+
import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
|
|
17
|
+
import { TableBody } from 'lib/ui/Table/TableBody.js'
|
|
18
|
+
import { TableCell } from 'lib/ui/Table/TableCell.js'
|
|
19
|
+
import { TableHeader } from 'lib/ui/Table/TableHeader.js'
|
|
20
|
+
import { TableRow } from 'lib/ui/Table/TableRow.js'
|
|
21
|
+
import { TableTitle } from 'lib/ui/Table/TableTitle.js'
|
|
22
|
+
import { Caption } from 'lib/ui/typography/Caption.js'
|
|
23
|
+
import { Title } from 'lib/ui/typography/Title.js'
|
|
24
|
+
|
|
25
|
+
export type DeviceTableProps = Props & UseDevicesParams
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
onBack?: () => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function DeviceTable({ onBack, ...props }: DeviceTableProps) {
|
|
32
|
+
const { devices, isLoading, isError, error } = useDevices(props)
|
|
33
|
+
|
|
34
|
+
const [selectedDevice, selectDevice] =
|
|
35
|
+
useState<Device<CommonDeviceProperties> | null>(null)
|
|
36
|
+
|
|
37
|
+
if (selectedDevice) {
|
|
38
|
+
return (
|
|
39
|
+
<DeviceDetails
|
|
40
|
+
device={selectedDevice}
|
|
41
|
+
onBack={() => {
|
|
42
|
+
selectDevice(null)
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isLoading) return <p>...</p>
|
|
49
|
+
if (isError) return <p>{error?.message}</p>
|
|
50
|
+
if (devices == null) return null
|
|
51
|
+
|
|
52
|
+
const deviceCount = devices.length
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div className='seam-device-table'>
|
|
56
|
+
<ContentHeader onBack={onBack} />
|
|
57
|
+
<TableHeader>
|
|
58
|
+
<TableTitle>
|
|
59
|
+
{t.devices} <Caption>({deviceCount})</Caption>
|
|
60
|
+
</TableTitle>
|
|
61
|
+
</TableHeader>
|
|
62
|
+
<TableBody>
|
|
63
|
+
{devices.map((device) => (
|
|
64
|
+
<DeviceRow
|
|
65
|
+
device={device}
|
|
66
|
+
key={device.device_id}
|
|
67
|
+
onClick={() => {
|
|
68
|
+
selectDevice(device)
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
))}
|
|
72
|
+
</TableBody>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function DeviceRow(props: {
|
|
78
|
+
device: UseDevicesData[number]
|
|
79
|
+
onClick: () => void
|
|
80
|
+
}) {
|
|
81
|
+
const { device, onClick } = props
|
|
82
|
+
|
|
83
|
+
if (!isLockDevice(device)) return null
|
|
84
|
+
|
|
85
|
+
const deviceModel = getDeviceModel(device) ?? t.unknownLock
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<TableRow key={device.device_id} onClick={onClick}>
|
|
89
|
+
<TableCell className='seam-image-cell'>
|
|
90
|
+
<DeviceImage device={device} />
|
|
91
|
+
</TableCell>
|
|
92
|
+
<TableCell className='seam-body-cell'>
|
|
93
|
+
<Title>{device.properties.name}</Title>
|
|
94
|
+
<div className='seam-bottom'>
|
|
95
|
+
<span className='seam-device-model'>{deviceModel}</span>
|
|
96
|
+
<div className='seam-device-statuses'>
|
|
97
|
+
<OnlineStatus device={device} />
|
|
98
|
+
<BatteryStatus device={device} />
|
|
99
|
+
<LockStatus device={device} />
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</TableCell>
|
|
103
|
+
</TableRow>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const t = {
|
|
108
|
+
devices: 'Devices',
|
|
109
|
+
unknownLock: 'Unknown Lock',
|
|
110
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { DivProps } from 'lib/ui/types.js'
|
|
2
2
|
|
|
3
|
-
export function TableRow(
|
|
4
|
-
|
|
3
|
+
export function TableRow(
|
|
4
|
+
props: DivProps & { onClick?: () => void }
|
|
5
|
+
): JSX.Element {
|
|
6
|
+
return (
|
|
7
|
+
<div className='seam-table-row' {...props}>
|
|
8
|
+
{props.children}
|
|
9
|
+
</div>
|
|
10
|
+
)
|
|
5
11
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ButtonProps } from 'lib/ui/types.js'
|
|
2
|
+
|
|
3
|
+
interface TextButtonProps extends ButtonProps {
|
|
4
|
+
color?: 'primary' | 'inherit'
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function TextButton({
|
|
9
|
+
color = 'primary',
|
|
10
|
+
...buttonProps
|
|
11
|
+
}: TextButtonProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<button className={`seam-text-btn seam-color-${color}`} {...buttonProps} />
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -5,32 +5,31 @@ import { BatteryLevelFullIcon } from 'lib/icons/BatteryLevelFull.js'
|
|
|
5
5
|
import { BatteryLevelHighIcon } from 'lib/icons/BatteryLevelHigh.js'
|
|
6
6
|
import { BatteryLevelLowIcon } from 'lib/icons/BatteryLevelLow.js'
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export interface BatteryStatusProps {
|
|
9
9
|
device: LockDevice
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function BatteryStatus(props: BatteryStatusProps) {
|
|
11
13
|
const {
|
|
12
14
|
device: {
|
|
13
15
|
properties: { battery_level: batteryLevel },
|
|
14
16
|
},
|
|
15
17
|
} = props
|
|
16
18
|
|
|
17
|
-
if (batteryLevel == null) {
|
|
18
|
-
return null
|
|
19
|
-
}
|
|
20
|
-
|
|
21
19
|
return (
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
<Status batteryLevel={batteryLevel} />
|
|
26
|
-
</div>
|
|
27
|
-
</>
|
|
20
|
+
<div className='seam-battery-status'>
|
|
21
|
+
<Content batteryLevel={batteryLevel} />
|
|
22
|
+
</div>
|
|
28
23
|
)
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
function
|
|
26
|
+
function Content(props: { batteryLevel?: number }) {
|
|
32
27
|
const { batteryLevel } = props
|
|
33
28
|
|
|
29
|
+
if (batteryLevel == null) {
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
34
33
|
if (batteryLevel > batteryThreshold.full) {
|
|
35
34
|
return (
|
|
36
35
|
<>
|
|
@@ -73,7 +72,6 @@ const batteryThreshold = {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
const t = {
|
|
76
|
-
power: 'Power',
|
|
77
75
|
full: 'Good',
|
|
78
76
|
high: 'Good',
|
|
79
77
|
low: 'Low',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import type { LockDevice } from 'seamapi'
|
|
3
|
+
|
|
4
|
+
export function DeviceImage(
|
|
5
|
+
props: { device: LockDevice } & HTMLAttributes<HTMLImageElement>
|
|
6
|
+
): JSX.Element {
|
|
7
|
+
const { device, ...imageProps } = props
|
|
8
|
+
|
|
9
|
+
const url = device.properties.image_url ?? fallbackImageUrl
|
|
10
|
+
|
|
11
|
+
return <img src={url} alt={device.properties.name} {...imageProps} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const fallbackImageUrl =
|
|
15
|
+
'https://connect.getseam.com/assets/images/devices/unknown-lock.png'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { LockDevice } from 'seamapi'
|
|
2
|
+
|
|
3
|
+
import { LockLockedIcon } from 'lib/icons/LockLocked.js'
|
|
4
|
+
import { LockUnlockedIcon } from 'lib/icons/LockUnlocked.js'
|
|
5
|
+
|
|
6
|
+
export interface LockStatusProps {
|
|
7
|
+
device: LockDevice
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function LockStatus(props: LockStatusProps): JSX.Element {
|
|
11
|
+
const {
|
|
12
|
+
device: {
|
|
13
|
+
properties: { locked },
|
|
14
|
+
},
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className='seam-lock-status'>
|
|
19
|
+
<Content isLocked={locked} />
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function Content(props: { isLocked: boolean }) {
|
|
25
|
+
const { isLocked } = props
|
|
26
|
+
if (isLocked) {
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<LockLockedIcon className='seam-lock-icon' />
|
|
30
|
+
<span className='seam-status-text'>{t.locked}</span>
|
|
31
|
+
</>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<LockUnlockedIcon className='seam-lock-icon' />
|
|
38
|
+
<span className='seam-status-text'>{t.unlocked}</span>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const t = {
|
|
44
|
+
locked: 'Locked',
|
|
45
|
+
unlocked: 'Unlocked',
|
|
46
|
+
}
|
|
@@ -3,21 +3,26 @@ import type { LockDevice } from 'seamapi'
|
|
|
3
3
|
import { OnlineStatusDeviceOfflineIcon } from 'lib/icons/OnlineStatusDeviceOffline.js'
|
|
4
4
|
import { OnlineStatusOnlineIcon } from 'lib/icons/OnlineStatusOnline.js'
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export interface OnlineStatusProps {
|
|
7
|
+
device: LockDevice
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function OnlineStatus(props: OnlineStatusProps): JSX.Element {
|
|
11
|
+
const {
|
|
12
|
+
device: {
|
|
13
|
+
properties: { online },
|
|
14
|
+
},
|
|
15
|
+
} = props
|
|
16
|
+
|
|
8
17
|
return (
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
<Status isOnline={device.properties.online} />
|
|
13
|
-
</div>
|
|
14
|
-
</>
|
|
18
|
+
<div className='seam-online-status'>
|
|
19
|
+
<Content isOnline={online} />
|
|
20
|
+
</div>
|
|
15
21
|
)
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
function
|
|
24
|
+
function Content(props: { isOnline: boolean }) {
|
|
19
25
|
const { isOnline } = props
|
|
20
|
-
|
|
21
26
|
if (isOnline) {
|
|
22
27
|
return (
|
|
23
28
|
<>
|
|
@@ -38,7 +43,6 @@ function Status(props: { isOnline: boolean }): JSX.Element {
|
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
const t = {
|
|
41
|
-
status: 'Status',
|
|
42
46
|
online: 'Online',
|
|
43
47
|
deviceOffline: 'Device Offline',
|
|
44
48
|
}
|
package/src/lib/ui/index.ts
CHANGED
|
@@ -2,12 +2,17 @@ import { ArrowBackIcon } from 'lib/icons/ArrowBack.js'
|
|
|
2
2
|
|
|
3
3
|
export function ContentHeader(props: {
|
|
4
4
|
title?: string
|
|
5
|
-
|
|
6
|
-
}): JSX.Element {
|
|
5
|
+
onBack?: () => void
|
|
6
|
+
}): JSX.Element | null {
|
|
7
|
+
const { title, onBack } = props
|
|
8
|
+
if (!title && !onBack) {
|
|
9
|
+
return null
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
return (
|
|
8
13
|
<div className='seam-content-header'>
|
|
9
|
-
<BackIcon onClick={
|
|
10
|
-
<span className='seam-title'>{
|
|
14
|
+
<BackIcon onClick={onBack} />
|
|
15
|
+
<span className='seam-title'>{title}</span>
|
|
11
16
|
</div>
|
|
12
17
|
)
|
|
13
18
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@use './colors';
|
|
2
|
+
|
|
3
|
+
@mixin all {
|
|
4
|
+
.seam-access-code-details {
|
|
5
|
+
> .seam-summary {
|
|
6
|
+
background: colors.$bg-a;
|
|
7
|
+
border-radius: 16px;
|
|
8
|
+
margin: 0 24px 16px;
|
|
9
|
+
|
|
10
|
+
> .seam-top {
|
|
11
|
+
padding: 24px 16px;
|
|
12
|
+
|
|
13
|
+
> .seam-label {
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
line-height: 134%;
|
|
17
|
+
color: colors.$text-gray-1;
|
|
18
|
+
margin-bottom: 4px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> .seam-access-code-name {
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
font-size: 21px;
|
|
24
|
+
line-height: 132%;
|
|
25
|
+
margin-bottom: 8px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
> .seam-code {
|
|
29
|
+
background: #fff;
|
|
30
|
+
border: 1px solid colors.$text-gray-2;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
padding: 10px 16px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
font-size: 24px;
|
|
35
|
+
line-height: 134%;
|
|
36
|
+
margin-bottom: 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.seam-duration {
|
|
40
|
+
color: colors.$text-gray-1;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
line-height: 134%;
|
|
43
|
+
|
|
44
|
+
.seam-label {
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
color: colors.$text-default;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.seam-access-code-device {
|
|
52
|
+
border-top: 1px solid colors.$bg-c;
|
|
53
|
+
padding: 8px 16px 8px 8px;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
.seam-device-image {
|
|
58
|
+
width: 72px;
|
|
59
|
+
height: 72px;
|
|
60
|
+
margin-right: 16px;
|
|
61
|
+
|
|
62
|
+
img {
|
|
63
|
+
width: 100%;
|
|
64
|
+
max-height: 100%;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.seam-body {
|
|
69
|
+
flex: 1;
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
line-height: 134%;
|
|
73
|
+
margin-right: 8px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.seam-details {
|
|
79
|
+
font-size: 16px;
|
|
80
|
+
line-height: 134%;
|
|
81
|
+
border-bottom: 1px solid rgb(0 0 0 / 12%);
|
|
82
|
+
padding: 0 24px;
|
|
83
|
+
|
|
84
|
+
.seam-row {
|
|
85
|
+
padding: 16px;
|
|
86
|
+
display: flex;
|
|
87
|
+
border-top: 1px solid rgb(0 0 0 / 12%);
|
|
88
|
+
|
|
89
|
+
.seam-heading {
|
|
90
|
+
width: 112px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.seam-content {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex: 1;
|
|
96
|
+
|
|
97
|
+
.seam-times {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex: 1;
|
|
100
|
+
font-size: 16px;
|
|
101
|
+
line-height: 134%;
|
|
102
|
+
|
|
103
|
+
.seam-label {
|
|
104
|
+
color: colors.$text-gray-2;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
> div {
|
|
108
|
+
div {
|
|
109
|
+
margin-bottom: 4px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:first-child {
|
|
113
|
+
flex: 0 1 160px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -1,54 +1,50 @@
|
|
|
1
|
+
@use './colors';
|
|
2
|
+
|
|
1
3
|
@mixin all {
|
|
2
4
|
.seam-access-code-table {
|
|
3
|
-
.seam-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.seam-table-header {
|
|
8
|
-
margin-bottom: 16px;
|
|
9
|
-
height: 56px;
|
|
10
|
-
padding: 0 16px;
|
|
11
|
-
}
|
|
5
|
+
.seam-table-row {
|
|
6
|
+
cursor: pointer;
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
|
|
19
|
-
> div {
|
|
20
|
-
width: 40px;
|
|
21
|
-
height: 40px;
|
|
8
|
+
.seam-icon-cell {
|
|
9
|
+
flex: 0;
|
|
22
10
|
display: flex;
|
|
23
11
|
align-items: center;
|
|
24
12
|
justify-content: center;
|
|
13
|
+
|
|
14
|
+
> div {
|
|
15
|
+
width: 40px;
|
|
16
|
+
height: 40px;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
}
|
|
25
21
|
}
|
|
26
|
-
}
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
.seam-name-cell {
|
|
24
|
+
flex: 1;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
gap: 2px;
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
.seam-code-details {
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
line-height: 134%;
|
|
33
|
+
color: colors.$text-gray-1;
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
.seam-dot-divider {
|
|
36
|
+
margin: 0 4px;
|
|
37
|
+
color: colors.$text-gray-3;
|
|
38
|
+
}
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
|
-
}
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
.seam-action-cell {
|
|
43
|
+
margin-right: 12px;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
}
|
package/src/styles/_buttons.scss
CHANGED
|
@@ -1,17 +1,134 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
1
|
+
@use './typography';
|
|
2
|
+
@use './colors';
|
|
3
|
+
|
|
4
|
+
@mixin icon-button {
|
|
5
|
+
.seam-icon-btn {
|
|
3
6
|
border-radius: 6px;
|
|
4
7
|
border: 1px solid rgb(0 122 252 / 50%);
|
|
5
8
|
cursor: pointer;
|
|
9
|
+
background: #fff;
|
|
10
|
+
padding: 6px;
|
|
11
|
+
line-height: 0;
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
background: rgb(0 122 252 / 8%);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@mixin text-button {
|
|
20
|
+
.seam-text-btn {
|
|
21
|
+
color: colors.$primary;
|
|
22
|
+
padding: 0;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
background: transparent;
|
|
25
|
+
border: 0;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
text-decoration: underline;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.seam-btn-disabled,
|
|
32
|
+
&:disabled {
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@mixin button-size {
|
|
40
|
+
&.seam-btn-small {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
line-height: 22px;
|
|
43
|
+
border-radius: 6px;
|
|
44
|
+
padding: 4px 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.seam-btn-medium {
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
line-height: 26px;
|
|
50
|
+
border-radius: 7px;
|
|
51
|
+
padding: 6px 16px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.seam-btn-large {
|
|
55
|
+
font-size: 19px;
|
|
56
|
+
line-height: 30px;
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
padding: 8px 22px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@mixin button-variant {
|
|
63
|
+
&.seam-btn-solid {
|
|
64
|
+
background: colors.$primary;
|
|
65
|
+
color: #fff;
|
|
66
|
+
border: 1px solid colors.$primary;
|
|
6
67
|
|
|
7
|
-
|
|
68
|
+
&:hover {
|
|
69
|
+
background: colors.$primary-dark;
|
|
70
|
+
border-color: colors.$primary-dark;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.seam-btn-disabled,
|
|
74
|
+
&:disabled {
|
|
75
|
+
background: colors.$primary-dim;
|
|
76
|
+
border-color: colors.$primary-dim;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.seam-btn-outline {
|
|
81
|
+
color: colors.$primary;
|
|
82
|
+
border: 1px solid colors.$primary-50;
|
|
83
|
+
background: transparent;
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
background: colors.$primary-5;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.seam-btn-disabled,
|
|
90
|
+
&:disabled {
|
|
91
|
+
background: transparent;
|
|
92
|
+
color: colors.$primary-50;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.seam-btn-neutral {
|
|
97
|
+
color: colors.$text-gray-1;
|
|
98
|
+
border: 1px solid colors.$text-gray-2-5;
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
background: colors.$bg-a;
|
|
102
|
+
border-color: colors.$text-gray-2-5;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.seam-btn-disabled,
|
|
106
|
+
&:disabled {
|
|
107
|
+
color: colors.$text-gray-2-5;
|
|
108
|
+
border-color: colors.$text-gray-3;
|
|
8
109
|
background: #fff;
|
|
9
|
-
|
|
10
|
-
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@mixin button {
|
|
115
|
+
.seam-btn {
|
|
116
|
+
@include typography.font-family;
|
|
117
|
+
@include button-size;
|
|
118
|
+
@include button-variant;
|
|
11
119
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
|
|
123
|
+
&.seam-btn-disabled,
|
|
124
|
+
&:disabled {
|
|
125
|
+
cursor: not-allowed;
|
|
15
126
|
}
|
|
16
127
|
}
|
|
17
128
|
}
|
|
129
|
+
|
|
130
|
+
@mixin all {
|
|
131
|
+
@include button;
|
|
132
|
+
@include icon-button;
|
|
133
|
+
@include text-button;
|
|
134
|
+
}
|