Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Feat/groups refinements #1197

Merged
merged 12 commits into from
Aug 5, 2022
Merged

Feat/groups refinements #1197

merged 12 commits into from
Aug 5, 2022

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Aug 3, 2022

  1. Rest of the refinements.
  2. Mobile/responsive refinements

@vercel
Copy link

vercel bot commented Aug 3, 2022

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

Name Status Preview Updated
unleash-frontend ✅ Ready (Inspect) Visit Preview Aug 5, 2022 at 9:40AM (UTC)

</IconButton>
<span>
<IconButton
disabled={group?.users.length == 1}
Copy link
Contributor

Choose a reason for hiding this comment

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

Small thing but == in javascript allows type coercion. === will do a strict check on value and type. It's a good pattern to default to ===

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

</IconButton>
<span>
<IconButton
disabled={group?.users.length == 1}
Copy link
Contributor

Choose a reason for hiding this comment

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

See above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

const useHiddenColumns = (): string[] => {
const isMediumScreen = useMediaQuery(theme.breakpoints.down('md'));

return useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the value of useMemo here? In my opinion useMemo should only be used for large expensive computation time calculations. If we use it for anything else it's just overhead that doesn't give any tangible benefit and increases the memory footprint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found a way around useMemo

outline: `${theme.spacing(0.25)} solid ${theme.palette.background.paper}`,
}));

const useHiddenColumns = (): string[] => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be reusable and take a list of columns to hide instead of redeclaring this hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made it into reusable component.

const useHiddenColumns = (): string[] => {
const isMediumScreen = useMediaQuery(theme.breakpoints.down('md'));

return useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above in regards of tangible benefit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

onClick={() => setAssignOpen(true)}
maxWidth="700px"
Icon={Add}
permission={UPDATE_PROJECT}
Copy link
Contributor

Choose a reason for hiding this comment

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

This permission will need projectId to work properly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Added

@@ -107,6 +114,20 @@ interface IProjectGroupViewProps {
onRemove: () => void;
}

const useHiddenColumns = (): string[] => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Opportunity to refactor here. Would be nice to have the same pattern for all lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored

@sjaanus sjaanus merged commit 5c27228 into main Aug 5, 2022
@sjaanus sjaanus deleted the feat/groups-refinements branch August 5, 2022 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants