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

feat: add push to all button to UI #2969

Merged
merged 4 commits into from
Jan 24, 2023
Merged

Conversation

gastonfournier
Copy link
Contributor

About the changes

This adds the push to all button to the UI

Relates to roadmap item: #2254

UI

Screenshot from 2023-01-16 12-25-49

@vercel
Copy link

vercel bot commented Jan 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 24, 2023 at 7:59AM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
unleash-docs ⬜️ Ignored (Inspect) Jan 24, 2023 at 7:59AM (UTC)

padding: theme.spacing(0),
},
},
}));
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking and if we want to make it perfect maybe we shouldn't remove the padding from the lis. It looks very good overall but the hover effect on the items looks a bit weird. Maybe we should remove some of these specifics, clean some of this up, and try to only style a div for the separator and button below, but I'm not sure.

Something we can run by @NicolaeUnleash and see what he thinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can iterate on the details later, so we can have this ready to be shipped with 4.20. Also, maybe we should have a .styles.ts file as specified here?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, good point.
We are actually moving away from .styles.ts files and preferring styled components like you're doing here instead, so this looks good as is.

const [pushToAnchorEl, setPushToAnchorEl] = useState<null | HTMLElement>(
null
);
const pushToOpen = Boolean(pushToAnchorEl);
Copy link
Member

Choose a reason for hiding this comment

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

In terms of code organisation since this is a computation based on a state, maybe it belongs some lines below instead, but it's a tiny nitpick based on preference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was some lines below, but I moved it up to keep the related components together... otherwise, you may think you need to use pushToAnchorEl for reading the state and never realize that there's a pushToOpen that should be used instead... which is a bit confusing IMO but 🤷

} catch (e) {
throw e;
}
};
Copy link
Member

Choose a reason for hiding this comment

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

I know that this is copy pasted from the other methods, and we always do it like this, me included. Not sure about the original reasoning but the fact is that this could optionally be simplified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the try catch throwing an exception without doing anything is pointless... I could just replace:

        try {
            const res = await makeRequest(req.caller, req.id);
            return res;
        } catch (e) {
            throw e;
        }

with

        return makeRequest(req.caller, req.id);

and now there's no need to await because it's the return statement.

But it's specified that way in this ADR. Maybe the intent of the ADR was to say that you should do something with the exception? Or perhaps it's something we carried away from another place... 🤙 @FredrikOseberg who may have more context

Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

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

Looks great! But since I'm a bit biased from us pairing you may want another pair of eyes just in case 😄

…tureEnvironmentVariants/PushVariantsButton/PushVariantsButton.tsx

Co-authored-by: Nuno Góis <github@nunogois.com>
Copy link
Contributor Author

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

I'm inclined to merge and move fast, then come back if needed, just to be able to release this week. I'm going to share in standup and make a decision there

padding: theme.spacing(0),
},
},
}));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can iterate on the details later, so we can have this ready to be shipped with 4.20. Also, maybe we should have a .styles.ts file as specified here?

const [pushToAnchorEl, setPushToAnchorEl] = useState<null | HTMLElement>(
null
);
const pushToOpen = Boolean(pushToAnchorEl);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was some lines below, but I moved it up to keep the related components together... otherwise, you may think you need to use pushToAnchorEl for reading the state and never realize that there's a pushToOpen that should be used instead... which is a bit confusing IMO but 🤷

} catch (e) {
throw e;
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the try catch throwing an exception without doing anything is pointless... I could just replace:

        try {
            const res = await makeRequest(req.caller, req.id);
            return res;
        } catch (e) {
            throw e;
        }

with

        return makeRequest(req.caller, req.id);

and now there's no need to await because it's the return statement.

But it's specified that way in this ADR. Maybe the intent of the ADR was to say that you should do something with the exception? Or perhaps it's something we carried away from another place... 🤙 @FredrikOseberg who may have more context

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

I see there's small detail chatter going on here. Agree some of it makes sense but it also might be worth doing in a separate PR due to time pressure around this one?

Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

I'm concurring with Simon and Nuno here. This looks good. The small nits around catching and rethrowing can be solved in a separate PR; it won't block us moving forward.

@gastonfournier
Copy link
Contributor Author

gastonfournier commented Jan 24, 2023

Agree some of it makes sense but it also might be worth doing in a separate PR due to time pressure around this one?

This is what I plan to do, and I'll take in all comments in another PR. For others: do comment, I'll check them later

@gastonfournier gastonfournier merged commit 3713764 into main Jan 24, 2023
@gastonfournier gastonfournier deleted the variants-push-to-all-button branch January 24, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants