Skip to content

Conversation

mikewuu
Copy link
Contributor

@mikewuu mikewuu commented Oct 7, 2025

Closes https://linear.app/seam/issue/CX-450/status-field-disappears-when-clicking-unlock-button-in-seam-components

Previously we were hiding the toggle to prevent the case where the device doesn't report lock status.

This PR conditionally renders buttons depending on whether the device has capability to unlock/lock:

  • Can both lock/unlock = show toggle (current button)
  • Can lock only = show lock status + lock button only
  • Can unlock only = show lock status + unlock button only
  • Cannot lock or unlock = show unknown status + both lock/unlock buttons

Screenshots

CleanShot 2025-10-08 at 14 01 45@2x

@mikewuu
Copy link
Contributor Author

mikewuu commented Oct 7, 2025

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original file was actually intentional as a pattern for Seam Components to put stuff that defines its concept of a Lock (Thermostat, etc.).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useLockDoor/useUnlockDoor / use-(un)lock-door.ts

Comment on lines +57 to +59
if (!device.properties.online) {
return null
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already contained in can_remotely_lock / can_remotely_unlock

Suggested change
if (!device.properties.online) {
return null
}

Comment on lines +131 to +157
return (
<div className='seam-content seam-lock-status'>
<div>
<span className='seam-label'>{t.lockStatus}</span>
<span className='seam-value'>{t.statusUnknown}</span>
</div>
<div className='seam-right'>
<Button
size='small'
onClick={() => {
lock.mutate(device)
}}
>
{t.lock}
</Button>
<Button
size='small'
onClick={() => {
unlock.mutate(device)
}}
>
{t.unlock}
</Button>
</div>
</div>
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this last condition

Cannot lock or unlock = show unknown status + both lock/unlock buttons

We should not show ANY buttons or any row. If cannot lock or unlock then the buttons are not going to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants