-
Notifications
You must be signed in to change notification settings - Fork 896
refactor(site): move workspace schedule controls to its own component #11281
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
Conversation
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.
This looks really good, and it already looks a lot cleaner!
Had some small nits for accessibility, and one question about an edge case for the deadline PUT requests
deadline, | ||
); | ||
const deadlinePlusEnabled = maxDeadlineIncrease >= 1; | ||
const deadlineMinusEnabled = maxDeadlineDecrease >= 1; |
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.
Do we have a policy around deadlines? As in:
- Will it always be a value that's relative to the current time?
- And once a deadline is up, is it not able to be interacted with any way?
Mainly curious because I would've expected the conditions for each of the derived values to be different
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.
Also, since it looks like these properties are only being used once each, do you think it'd be better to move them into the JSX output directly?
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.
About your questions:
- Yes
- Not sure if I got it. Can you say a use case?
Honestly, I don't have too much context on this part and I have the same questions as you. @johnstcn probably can help us to understand this better.
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.
About JSX, I think I can better understand what it does by assigning this condition to a named variable.
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.
Will it always be a value that's relative to the current time?
Yeah workspace deadline should generally be in the future. I could imagine rare situations where it's a few seconds in the past but those should be the exception.
And once a deadline is up, is it not able to be interacted with any way?
There might be a short window between the deadline expiring and the workspace actually being shut down in which you could theoretically still extend the deadline. But in general, I think it's fair to assume that once the deadline is up, workspace is stopping Very Soon.
onSubmit={(e) => { | ||
e.preventDefault(); | ||
const formData = new FormData(e.currentTarget); | ||
const hours = Number(formData.get("hours")); |
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.
I don't think this needs to be fixed, but I just want to make sure I'm understanding what would happen with an accident like this:
- Someone moves things elements around, and the
name
field accidentally gets removed formData.get("hours")
evaluates tonull
, andNumber
converts it into0
It looks like it would make a PUT request with 0
, which I'm guessing wouldn't break anything, but just want to make sure
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.
You are exactly right since increase or decrease something in 0 would result in the same value, but I love your analysis
Doing some refactoring to make this component easier to reuse on the new workspace page and avoid major conflicts in the future. Noticeable changes: