-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Seat): add status prop with processing/done states, deprecate selected #4567
base: master
Are you sure you want to change the base?
Conversation
- Add status enum (default | selected | processing | done) - Mark selected prop as deprecated - Implement background and label styling for new states - Add icon support for processing and done states - Maintain backward compatibility with selected prop Co-Authored-By: Jozef Képesi <[email protected]>
…lected Co-Authored-By: Jozef Képesi <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Storybook staging is available at https://kiwicom-orbit-devin-1735834536-seat-status.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key Issues
The effectiveStatus
calculation lacks validation against allowed status values, risking invalid states and runtime errors. Conditional rendering with effectiveStatus
is performed without type narrowing, which could lead to errors if invalid values are used.
@@ -26,6 +27,7 @@ const Seat = ({ | |||
description, | |||
"aria-labelledby": ariaLabelledBy = "", | |||
}: Props) => { | |||
const effectiveStatus = status ?? (selected ? "selected" : "default"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Possible Bug
The effectiveStatus
calculation doesn't validate the status
prop value, which could lead to invalid states being passed down to child components. The status should be validated against allowed values ('default', 'selected', 'processing', 'done') to prevent runtime errors.
const effectiveStatus = status ?? (selected ? "selected" : "default"); | |
const validStatuses = ['default', 'selected', 'processing', 'done'] as const; | |
const effectiveStatus = status && validStatuses.includes(status) ? status : (selected ? 'selected' : 'default'); |
{effectiveStatus !== "default" && clickable && ( | ||
<SeatCircle size={size} type={type} status={effectiveStatus} /> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Possible Bug
The effectiveStatus
is used in conditional rendering without type narrowing, which could lead to runtime errors if invalid status values are provided. The status check should be more explicit.
{effectiveStatus !== "default" && clickable && ( | |
<SeatCircle size={size} type={type} status={effectiveStatus} /> | |
)} | |
{(effectiveStatus === 'selected' || effectiveStatus === 'processing' || effectiveStatus === 'done') && clickable && ( | |
<SeatCircle size={size} type={type} status={effectiveStatus} /> | |
)} |
Size Change: +1.52 kB (+0.33%) Total Size: 464 kB
ℹ️ View Unchanged
|
Deploying orbit with Cloudflare Pages
|
Description
Adding new
status
prop to the Seat component to replace the deprecatedselected
prop. This change introduces new states for processing and done, while maintaining backward compatibility.Changes
selected
propstatus
prop with values:default | selected | processing | done
processing
anddone
statesTesting
Link to Devin run: https://app.devin.ai/sessions/4ce5152c9e9a4877b06d0f24ba4a20cf
✨
Description by Callstackai
This PR introduces a new
status
prop to the Seat component, replacing the deprecatedselected
prop. It adds new states for processing and done, along with corresponding styling and icons.Diagrams of code changes
Files Changed
status
prop and its possible values.status
prop and render appropriate icons for processing and done states.status
prop and adjust rendering logic accordingly.status
prop and its effects on rendering.status
prop for conditional styling.status
prop for conditional styling.status
prop for conditional styling.status
prop instead of the deprecatedselected
prop.SeatStatus
type to define possible values for thestatus
prop.This PR includes files in programming languages that we currently do not support. We have not reviewed files with the extensions
.md
. See list of supported languages.