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

style: enhancements for responsive design #930

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

LinaYahya
Copy link
Contributor

@LinaYahya LinaYahya commented Jan 3, 2024

image
closes #929

@LinaYahya LinaYahya self-assigned this Jan 4, 2024
@LinaYahya LinaYahya marked this pull request as ready for review January 4, 2024 08:41
@LinaYahya LinaYahya marked this pull request as draft January 8, 2024 09:34
@LinaYahya LinaYahya marked this pull request as ready for review January 8, 2024 16:03
Copy link
Contributor

@pyphilia pyphilia left a comment

Choose a reason for hiding this comment

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

Thanks for your PR, I think it can be optimized in various, please take a look at my comments! 🐰

src/components/item/header/ItemHeaderActions.tsx Outdated Show resolved Hide resolved
src/components/item/header/ItemHeaderActions.tsx Outdated Show resolved Hide resolved
src/components/item/header/ItemHeaderActions.tsx Outdated Show resolved Hide resolved
src/components/item/header/ItemHeaderActions.tsx Outdated Show resolved Hide resolved
src/components/layout/Navigation.tsx Outdated Show resolved Hide resolved
src/components/main/Main.tsx Outdated Show resolved Hide resolved
src/components/main/MobileItemMenu.tsx Outdated Show resolved Hide resolved
src/components/main/MobileItemMenu.tsx Outdated Show resolved Hide resolved
src/components/main/MobileItemMenu.tsx Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Feb 8, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@spaenleh spaenleh left a comment

Choose a reason for hiding this comment

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

Nice work ! I have left a lot of comments on how to improve and refine this work.

I think you should:

  • fix the .only
  • fix any small issues that do not require a significant refactor.

We will then merge the PR and plan a refactor to refine the components and architecture.

This will allow us to move on from this PR (which has been stuck for a while, sorry) and build upon it in a clean way, how does that sound ?

Comment on lines +52 to +55
const { id } = SAMPLE_ITEMS.items[1];
cy.setUpApi(SAMPLE_ITEMS);
visitItem({ id });

Copy link
Member

Choose a reason for hiding this comment

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

These lines are repeated in each test, put them in the beforeEach.

Comment on lines +121 to +124
const displayTags = cy.get(
`#${buildCoEditorSettingsRadioButtonId(option.value)}`,
);
displayTags.should('be.visible');
Copy link
Member

Choose a reason for hiding this comment

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

Do not assign to a variable. It is prefered to simply chain.

Suggested change
const displayTags = cy.get(
`#${buildCoEditorSettingsRadioButtonId(option.value)}`,
);
displayTags.should('be.visible');
cy.get(
`#${buildCoEditorSettingsRadioButtonId(option.value)}`,
).should('be.visible');

},
);
});
it.only('Recycle item', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Remove only

visitItem({ id });
cy.get(`#${MOBILE_MORE_ACTIONS_BUTTON_ID}`).click();
cy.get(`.${ITEM_MENU_FLAG_BUTTON_CLASS}`).click();
cy.get(`#${buildFlagListItemId(type)}`).should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

There is a difference between should exist and should be visible:

  • exist: only checks for existence in the DOM, if it is disabled, or hidden by CSS this will pass
  • be.visible: asserts that it is visible by the user, if it is hidden by CSS this will fail.
    In general you want to assert for visibility more than existence.

visitItem({ id });
cy.get(`#${MOBILE_MORE_ACTIONS_BUTTON_ID}`).click();
cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click();
cy.get(`#${ITEM_SETTINGS_CONTAINER_ID}`).should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

Same here


export const MobileItemHeaderActions = (): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();
const itemId = useShortenURLParams(ITEM_ID_PARAMS);
Copy link
Member

Choose a reason for hiding this comment

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

This is deprecated, use useParams()[ITEM_ID_PARAMS] instead.

<Typography px={3} pb={1} variant="h5">
{item.name}
</Typography>
<Divider sx={{ borderColor: theme.palette.grey[400] }} />
Copy link
Member

Choose a reason for hiding this comment

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

I do not think you need a divider here. if you really need one you can simply change the opacity:

Suggested change
<Divider sx={{ borderColor: theme.palette.grey[400] }} />
<Divider sx={{ opacity: 0.8 }} />

for example.

Comment on lines +167 to +173
<Box
display="flex"
flexDirection="column"
sx={{ maxHeight: '100%', overflow: 'auto', marginTop: 1 }}
>
{renderItemActions()}
</Box>
Copy link
Member

Choose a reason for hiding this comment

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

For this part you can use the Stack component as it has a divider prop that lets you specify the component that should be used to separate the children.

Suggested change
<Box
display="flex"
flexDirection="column"
sx={{ maxHeight: '100%', overflow: 'auto', marginTop: 1 }}
>
{renderItemActions()}
</Box>
<Stack
flexDirection="column"
divider={<Divider variant="middle" flexItem />}
>

src/components/main/MobileItemMenu.tsx Show resolved Hide resolved
src/components/main/MobileItemMenu.tsx Show resolved Hide resolved
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.

Responsive Design
3 participants