Skip to content
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

web: better unify all the trigger buttons #5261

Merged
merged 2 commits into from
Dec 8, 2021
Merged

web: better unify all the trigger buttons #5261

merged 2 commits into from
Dec 8, 2021

Conversation

nicks
Copy link
Member

@nicks nicks commented Dec 8, 2021

Hello @lizzthabet,

Please review the following commits I made in branch nicks/ch13060:

e85f34f (2021-12-08 09:24:09 -0500)
web: better unify all the trigger buttons
fixes #5252

Code review reminders, by giving a LGTM you attest that:

  • Commits are adequately tested
  • Code is easy to understand and conforms to style guides
  • Incomplete code is marked with TODOs
  • Code is suitably instrumented with logging and metrics

@nicks nicks requested a review from lizzthabet December 8, 2021 14:24
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #13060: auto_init=False does not show trigger button.

@nicks
Copy link
Member Author

nicks commented Dec 8, 2021

there's still a bunch of copy-and-pasted code between SidebarTriggerButton and OverviewTriggerButton, but i tried to make it so at least the code is the SAME copy-and-pasted code 😬

Copy link
Contributor

@lizzthabet lizzthabet left a comment

Choose a reason for hiding this comment

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

happy to see some code cleanup with a bug fix! 🎉

is there any reason in the future to keep these as separate components? the styling is slightly different between the two views, but at first glance, i don't see major functionality differences. (asking for my curiosity, and not because i think this pr should do more.)

i may create a backlog ticket for myself to clean up the hover/focus states because i don't think the colors are accessible, and i could tackle other cleanup.

shouldBeClicked = true
} else if (!props.hasBuilt && isManualTriggerIncludingInitial) {
shouldBeClicked = true
let isBold = false
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) i found isBold as a var name a little confusing without being too familiar with all the trigger button states. wdyt about isEmphasized instead? (i think it's fine that the css class is isBold.)

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

if (props.hasPendingChanges && isManual) {
isBold = true
} else if (!props.hasBuilt && !isAutoInit) {
isBold = true
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi, there is a slight discrepancy between table view and detail view when a manual resource has been triggered once, even though it looks like this logic is the same! i did check on the main branch and it seems like this is happening there too, so it's not really anything to fix here.

detail view fills the icon with blue:
Screen Shot 2021-12-08 at 11 58 09 AM

table view does not (but it is blue when the resource is manual init and has not been built):
Screen Shot 2021-12-08 at 11 58 02 AM

Copy link
Member Author

Choose a reason for hiding this comment

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

haha -- yahhhhh, there are a bunch of discrepancies here. honestly i meant this to be a 2-line PR but it was hard to resist not fixing some of them (tho there are still some left)

@nicks
Copy link
Member Author

nicks commented Dec 8, 2021

👍

@nicks
Copy link
Member Author

nicks commented Dec 8, 2021

speaking to: "is there any reason in the future to keep these as separate components?"

i tend to lean on the side of https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction - i.e., to bias towards code duplication if you're not sure how to come up with the right abstraction for an attribute. tho reasonable people differ on this. i wouldn't be opposed to trying to unify them, but also wouldn't take for granted that it would be an improvement.

@nicks nicks merged commit ad3edb9 into master Dec 8, 2021
@nicks nicks deleted the nicks/ch13060 branch December 8, 2021 22:23
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.

auto_init=False does not show trigger button
2 participants