Skip to content

chore: refactor schedule banner #4274

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

Merged
merged 11 commits into from
Sep 30, 2022
Merged

chore: refactor schedule banner #4274

merged 11 commits into from
Sep 30, 2022

Conversation

presleyp
Copy link
Contributor

@presleyp presleyp commented Sep 30, 2022

  • move more logic from component to XState
  • logically, the schedule banner machine is part of the workspace page machine because it depends on deadline, which comes from workspace. But the workspace page machine is huge. So instead of inlining the schedule banner machine inside the workspace page machine, I invoke it. This requires breaking the workspace page component into two components, because you can use a hook (to access the child machine) inside a conditional (which ensures the child machine has been invoked).
  • fix color of Auto-Stop switch to match color of Auto-Start switch and not look disabled

I notice there's a pre-existing bug where we show a success message even if you try to increase (or decrease) beyond the max (or min) and so no change takes effect; something to fix later.

@presleyp presleyp marked this pull request as ready for review September 30, 2022 17:48
@presleyp presleyp requested a review from a team as a code owner September 30, 2022 17:48
@presleyp presleyp requested review from BrunoQuaresma and removed request for a team September 30, 2022 17:48
return <FullScreenLoader />
} else if (!template) {
return <FullScreenLoader />
} else if (workspace && workspaceState.matches("ready")) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is not something we could use the Choose one component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooh good catch!

// },
// clearScheduleBannerRef: assign({
// scheduleBannerRef: (_) => undefined
// }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes thank you! Makes me realize - I tried both ways, spawning and invoking, and I wrote that I spawned but I really invoked! Haha, you can see why, invoking requires less code.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

LGTM. Nice refactoring!

@presleyp presleyp merged commit d931b2c into main Sep 30, 2022
@presleyp presleyp deleted the bump/presleyp/3566 branch September 30, 2022 21:39
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