Skip to content

Commit fde0c1c

Browse files
Andrewjeskaseambot
andauthored
Add hideAccessCodes flag to device table (#583)
* disable access codes * ci: Format code * no show access codes * ci: Format code * typechecks * ci: Format code --------- Co-authored-by: Seam Bot <[email protected]>
1 parent ca005e7 commit fde0c1c

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

src/lib/seam/components/DeviceDetails/DeviceDetails.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const name = 'seam-device-details'
66

77
export const props: ElementProps<DeviceDetailsProps> = {
88
deviceId: 'string',
9+
hideAccessCodes: 'boolean',
910
}
1011

1112
export { DeviceDetails as Component } from './DeviceDetails.js'

src/lib/seam/components/DeviceDetails/DeviceDetails.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useDevice } from 'lib/seam/devices/use-device.js'
1212

1313
export interface DeviceDetailsProps extends CommonProps {
1414
deviceId: string
15+
hideAccessCodes?: boolean
1516
}
1617

1718
export const NestedDeviceDetails = withRequiredCommonProps(DeviceDetails)
@@ -21,6 +22,7 @@ export function DeviceDetails({
2122
disableLockUnlock = false,
2223
disableDeleteAccessCode = false,
2324
disableResourceIds = false,
25+
hideAccessCodes = false,
2426
onBack,
2527
className,
2628
}: DeviceDetailsProps): JSX.Element | null {
@@ -38,6 +40,7 @@ export function DeviceDetails({
3840
disableLockUnlock,
3941
disableDeleteAccessCode,
4042
disableResourceIds,
43+
hideAccessCodes,
4144
onBack,
4245
className,
4346
}

src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useToggle } from 'lib/ui/use-toggle.js'
1818

1919
interface LockDeviceDetailsProps extends CommonProps {
2020
device: LockDevice
21+
hideAccessCodes?: boolean
2122
}
2223

2324
export function LockDeviceDetails(
@@ -32,6 +33,7 @@ export function LockDeviceDetails(
3233
disableEditAccessCode,
3334
disableDeleteAccessCode,
3435
disableResourceIds,
36+
hideAccessCodes,
3537
onBack,
3638
className,
3739
} = props
@@ -108,17 +110,19 @@ export function LockDeviceDetails(
108110
</div>
109111
<Alerts alerts={alerts} className='seam-alerts-space-top' />
110112
</div>
111-
<div className='seam-box'>
112-
<div
113-
className='seam-content seam-access-codes'
114-
onClick={toggleAccessCodesOpen}
115-
>
116-
<span className='seam-value'>
117-
{accessCodeCount} {t.accessCodes}
118-
</span>
119-
<ChevronRightIcon />
113+
{hideAccessCodes !== true && (
114+
<div className='seam-box'>
115+
<div
116+
className='seam-content seam-access-codes'
117+
onClick={toggleAccessCodesOpen}
118+
>
119+
<span className='seam-value'>
120+
{accessCodeCount} {t.accessCodes}
121+
</span>
122+
<ChevronRightIcon />
123+
</div>
120124
</div>
121-
</div>
125+
)}
122126

123127
<div className='seam-box'>
124128
<div className='seam-content seam-lock-status'>

src/lib/seam/components/DeviceTable/DeviceTable.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const props: ElementProps<Omit<DeviceTableProps, 'title'>> = {
1313
onDeviceClick: 'object',
1414
preventDefaultOnDeviceClick: 'boolean',
1515
heading: 'string',
16+
hideAccessCodes: 'boolean',
1617
}
1718

1819
export { DeviceTable as Component } from './DeviceTable.js'

src/lib/seam/components/DeviceTable/DeviceTable.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface DeviceTableProps extends CommonProps {
4040
deviceComparator?: (deviceA: Device, deviceB: Device) => number
4141
onDeviceClick?: (deviceId: string) => void
4242
preventDefaultOnDeviceClick?: boolean
43+
hideAccessCodes?: boolean
4344
heading?: string | null
4445
}
4546

@@ -70,6 +71,7 @@ export function DeviceTable({
7071
disableEditAccessCode = false,
7172
disableDeleteAccessCode = false,
7273
disableResourceIds = false,
74+
hideAccessCodes = false,
7375
onBack,
7476
className,
7577
}: DeviceTableProps = {}): JSX.Element {
@@ -112,6 +114,7 @@ export function DeviceTable({
112114
disableEditAccessCode={disableEditAccessCode}
113115
disableDeleteAccessCode={disableDeleteAccessCode}
114116
disableResourceIds={disableResourceIds}
117+
hideAccessCodes={hideAccessCodes}
115118
onBack={() => {
116119
setSelectedDeviceId(null)
117120
}}

0 commit comments

Comments
 (0)