@@ -7,11 +7,11 @@ import { NestedAccessCodeTable } from 'lib/seam/components/AccessCodeTable/Acces
77import type { NestedSpecificDeviceDetailsProps } from 'lib/seam/components/DeviceDetails/DeviceDetails.js'
88import { DeviceInfo } from 'lib/seam/components/DeviceDetails/DeviceInfo.js'
99import { DeviceModel } from 'lib/seam/components/DeviceDetails/DeviceModel.js'
10+ import { LockDeviceToggleLockButton } from 'lib/seam/components/DeviceDetails/LockDeviceToggleLockButton.js'
1011import { deviceErrorFilter , deviceWarningFilter } from 'lib/seam/filters.js'
1112import type { LockDevice } from 'lib/seam/locks/lock-device.js'
1213import { useToggleLock } from 'lib/seam/locks/use-toggle-lock.js'
1314import { Alerts } from 'lib/ui/Alert/Alerts.js'
14- import { Button } from 'lib/ui/Button.js'
1515import { BatteryStatusIndicator } from 'lib/ui/device/BatteryStatusIndicator.js'
1616import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
1717import { EditableDeviceName } from 'lib/ui/device/EditableDeviceName.js'
@@ -59,9 +59,6 @@ export function LockDeviceDetails({
5959 } ,
6060 } )
6161
62- const lockStatus = device . properties . locked ? t . locked : t . unlocked
63- const toggleLockLabel = device . properties . locked ? t . unlock : t . lock
64-
6562 const accessCodeCount = accessCodes ?. length
6663
6764 if ( accessCodes == null ) {
@@ -164,25 +161,13 @@ export function LockDeviceDetails({
164161
165162 < div className = 'seam-box' >
166163 { device . properties . online && (
167- < div className = 'seam-content seam-lock-status' >
168- < div >
169- < span className = 'seam-label' > { t . lockStatus } </ span >
170- < span className = 'seam-value' > { lockStatus } </ span >
171- </ div >
172- < div className = 'seam-right' >
173- { ! disableLockUnlock &&
174- device . capabilities_supported . includes ( 'lock' ) && (
175- < Button
176- size = 'small'
177- onClick = { ( ) => {
178- toggleLock . mutate ( device )
179- } }
180- >
181- { toggleLockLabel }
182- </ Button >
183- ) }
184- </ div >
185- </ div >
164+ < LockDeviceToggleLockButton
165+ onToggle = { ( ) => {
166+ toggleLock . mutate ( device )
167+ } }
168+ device = { device }
169+ disableLockUnlock = { disableLockUnlock }
170+ />
186171 ) }
187172
188173 < AccessCodeLength
@@ -230,14 +215,9 @@ function AccessCodeLength(props: {
230215
231216const t = {
232217 device : 'Device' ,
233- unlock : 'Unlock' ,
234- lock : 'Lock' ,
235- locked : 'Locked' ,
236- unlocked : 'Unlocked' ,
237218 accessCodes : 'access codes' ,
238219 codeLength : 'Code length' ,
239220 digits : 'digits' ,
240- lockStatus : 'Lock status' ,
241221 status : 'Status' ,
242222 power : 'Power' ,
243223 successfullyUpdated : 'Lock status has been successfully updated' ,
0 commit comments