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

fix: Feed page responsiveness #1490

Merged
merged 6 commits into from
Aug 7, 2023
Merged

fix: Feed page responsiveness #1490

merged 6 commits into from
Aug 7, 2023

Conversation

RitaDee
Copy link
Contributor

@RitaDee RitaDee commented Aug 5, 2023

Description

Fixes #1453

Fixes #1336

Duplicate to Issue #1336

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

#1336

Mobile & Desktop Screenshots/Recordings

Before:

Screen.Recording.2023-07-31.at.19.11.01.mov

After:

Screen.Recording.2023-08-05.at.04.59.09.mov

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Aug 5, 2023

βœ… Deploy Preview for oss-insights ready!

Built without sensitive environment variables

Name Link
πŸ”¨ Latest commit c376ebf
πŸ” Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/64d014648db0b800084932a4
😎 Deploy Preview https://deploy-preview-1490--oss-insights.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Aug 5, 2023

βœ… Deploy Preview for design-insights ready!

Name Link
πŸ”¨ Latest commit c376ebf
πŸ” Latest deploy log https://app.netlify.com/sites/design-insights/deploys/64d01464c682b10008f01b67
😎 Deploy Preview https://deploy-preview-1490--design-insights.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@babblebey
Copy link
Contributor

babblebey commented Aug 5, 2023

Reviewing this @RitaDee... in the meantime do append the Fixes term to the duplicate issue too so It can allow it automatically close on merge this PR.

This way you should have...

Fixes #1453

Fixes #1336

@RitaDee
Copy link
Contributor Author

RitaDee commented Aug 5, 2023

@babblebey Done.

Copy link
Contributor

@babblebey babblebey left a comment

Choose a reason for hiding this comment

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

Great stuff @RitaDee, but your implementation isn't quite there yet... I have made the diagram below to guide you, it suggests some classes you should remove and ones to add...

screenshot-miro com-2023 08 05-13_45_03

Tasks

  1. Append the container and px-2 md:px-16 classes to the main element i.e. the first purple area in the diagram
  2. Append/update the stated classes and remove the striked ones from the next nested div.
  3. Do the same for the other divs.
  4. Remove all fixed width from the Left (userCard) div and Right (filter) div children divs replacing them with w-full to allow them inherit width from their respective parent divs.

Expected Behaviour

  • The Central (feedInput form and feeds) div should have a flexible width, taking all available spaces in the center
  • The Left (userCard) div should take 24% width of the total viewport initially, but when screen size scales down below 1280px i.e. tailwind xl, its display should be none.
  • The Right (filter) div should also take 24% width of the total viewport initially, but when screen size scales down below 1280px i.e. tailwind xl, its width should increase to 30%, at thesame point when the Left (userCard) div is no longer in display.
  • When screen size scales down below 1024px i.e. tailwind lg the Right (filter) div display at this point should also be none leaving only the Central (feedInput form and feeds) div on screen.

Potential Bottlenecks

  • You might experience weird behaviour in the width of the Left (userCard) div and Right (filter) div children divs, as seen below..

screenshot-insights opensauced pizza-2023 08 05-14_19_58 screenshot-insights opensauced pizza-2023 08 05-14_25_47

This is the intention of the Task No. 4, (setting w-full for child components) but you may not be able to fix some of this at the /feed page level, requiring you to go into the source components instead. You can just skip going into the source components for now, do the things you can within the /feed page for now...

Let's see the result of your Implementation first, then we can go fixing for the source component if needed.

We anticipate your screencast/demo after this!

Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

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

I noticed some of the things @babblebey mentioned. Marking requested changes for other reviewers.

@RitaDee
Copy link
Contributor Author

RitaDee commented Aug 5, 2023

Thank you, @babblebey for providing the diagram and the specific tasks to make the /feed page responsive. I have carefully reviewed the requirements, and I'll make the necessary changes as suggested.

@RitaDee
Copy link
Contributor Author

RitaDee commented Aug 6, 2023

I acknowledge the suggestions provided by @babblebey. Thank you

Update:

I have improved the layout and styles of the /feed page to achieve a responsive design as outlined in the tasks provided. The changes focus on the main, left, and right sections, ensuring they adapt gracefully to different screen sizes.

I applied the container and px-2 md:px-16 classes to the main element, allowing proper padding and responsiveness. Also, used the appropriate tailwind class to achieve this.

Current behaviour:

Screen.Recording.2023-08-06.at.22.50.22.mov

Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

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

Thanks

@bdougie bdougie added needs review PRs that need review from core engineering team and removed requested changes labels Aug 7, 2023
@bdougie bdougie merged commit 67662b2 into open-sauced:beta Aug 7, 2023
open-sauced bot pushed a commit that referenced this pull request Aug 7, 2023
## [1.59.0-beta.5](v1.59.0-beta.4...v1.59.0-beta.5) (2023-08-07)

### πŸ› Bug Fixes

* Feed page responsiveness  ([#1490](#1490)) ([67662b2](67662b2))

### πŸ• Features

* onboarding auto fetch timezone ([#1488](#1488)) ([ae5cdd7](ae5cdd7))
babblebey added a commit to babblebey/insights that referenced this pull request Aug 7, 2023
Copy link
Contributor

@babblebey babblebey left a comment

Choose a reason for hiding this comment

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

Great work hey @RitaDee,

We have some few things to address.

@@ -8,7 +8,9 @@ const ProfileLayout = ({ children }: { children: React.ReactNode }) => {
<div className="flex flex-col min-h-screen">
<TopNav />
<div className="page-container flex grow flex-col items-center">
<main className="flex pb-16 w-full flex-1 flex-col items-center bg-light-slate-2">{children}</main>
<main className="container px-2 flex md:px-16 pb-16 w-full flex-1 flex-col items-center bg-light-slate-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

REGRESSION!!!

I see that the changes to the main occured in the ProfileLayout component, this will lead to Regression in other components where the ProfileLayout is integrated. See pages/component where regression occurs below with screenshots

image

image

This is due to the classes (container, px-2 and md:px-16) that we moved up into the component.

FIX!!

Suggested change
<main className="container px-2 flex md:px-16 pb-16 w-full flex-1 flex-col items-center bg-light-slate-2">
<main className="flex pb-16 w-full flex-1 flex-col items-center bg-light-slate-2">

We will have to remove the classes (container, px-2 and md:px-16), from there moving it back to its initial place in the child div.

>
<div className="flex-col flex-1 hidden gap-6 mt-12 md:flex">
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}>
<div className="flex-col flex-1 xl:flex hidden gap-6 mt-12">
Copy link
Contributor

@babblebey babblebey Aug 7, 2023

Choose a reason for hiding this comment

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

Suggested change
<div className="flex-col flex-1 xl:flex hidden gap-6 mt-12">
<div className="w-[24%] flex-col flex-none xl:flex hidden gap-6 mt-12">

You are missing a width and flex-none from the Left (userCard) div.

With flex-none, the goal is to size the Left (userCard) div according to the width (that you will have to set to 24%), rendering it fully inflexible: so it neither shrinks nor grows in relation to its parent flex container.

In the absence of these we are have non equal width on the Right (Filter) Div and Left (userCard) div

image

@@ -284,7 +281,7 @@ const Feeds: WithPageLayout<HighlightSSRProps> = (props: HighlightSSRProps) => {
<FollowingHighlightWrapper selectedFilter={selectedRepo} emojis={emojis} />
</TabsContent>
</Tabs>
<div className="hidden gap-6 mt-10 md:flex-1 md:flex md:flex-col">
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col">
<div className="md:hidden gap-6 mt-10 w-[30%] lg:w-[24%] flex-none lg:flex md:flex-col">

You are also missing a responsive width and flex-none from the Right (Filter) Div. for the same reason as Left (userCard) div.

...and

Suggested change
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col">
<div className="hidden gap-6 mt-10 md:flex-1 lg:flex flex-col">

Tailwind uses a mobile-first breakpoint system.

This means that unprefixed classes (like hidden) take effect on all screen sizes, while prefixed one (like lg:flex) only take effect at the specified breakpoint (lg in this case) and above.

So Right Filter Div will be hidden normally on all screen sizes and it will only be in display again at lg (desktop) and above i.e. lg:flex.

So you needn't specify a responsive class of md:hidden since its gonna be hidden normally till lg.

ref={topRef}
>
<div className="flex-col flex-1 hidden gap-6 mt-12 md:flex">
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}>
<div className="w-full gap-[2rem] justify-center flex flex-col pt-12 md:flex-row" ref={topRef}>

The responsive/prefixed gap classes are not affecting anything at those breakpoints (i.e. xl and md), because the flex items the points are already reduced leaving the gap with nothing to space out.

So we can remove them.

{user && (
<div>
<div className="md:w-1/2 lg:w-1/3">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div className="md:w-1/2 lg:w-1/3">
<div className="w-full">

This should only take full width of the parent div, not some fraction of it at breakpoints.

@@ -18,13 +18,13 @@ const UserCard = ({ username, name, meta, loading }: UserCardProps) => {
const avatarUrl = getAvatarByUsername(username);

return (
<div className="w-full pb-6 border rounded-lg bg-light-slate-1 border-zinc-200">
<div className="pb-6 border bg-light-slate-1 w-max rounded-xl border-zinc-200">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div className="pb-6 border bg-light-slate-1 w-max rounded-xl border-zinc-200">
<div className="pb-6 border bg-light-slate-1 w-full rounded-lg border-zinc-200">

Return the full width for the user-card and the border-radius component.

Why though!?

  • The width w-full for size inheritance reason
  • The Border radius rounded-lg for uniformity reason, looking at all other sibling components/divs on the Right (Filter) Div and Left (userCard) div.

{loading ? (
<div className="flex items-center justify-center h-32 w-72">
<Spinner className="mt-6 " />
</div>
) : (
<div className="flex flex-col items-center gap-6 px-6 ">
<div className="flex flex-col items-center gap-6 px-9">
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm very curious to know why you thought to increase this padding!?

open-sauced bot pushed a commit that referenced this pull request Aug 8, 2023
## [1.59.0](v1.58.0...v1.59.0) (2023-08-08)

### πŸ§‘β€πŸ’» Code Refactoring

* replace supabase/ui in design system typography components ([#1438](#1438)) ([38cfb30](38cfb30))

### πŸ• Features

* add a user notifications page ([#1478](#1478)) ([022dc69](022dc69))
* add conditional routing to single highlight dialog close action ([#1473](#1473)) ([1341cba](1341cba))
* add github link to profile ([#1459](#1459)) ([d42bc6d](d42bc6d))
* add support for highlight.new ([#1487](#1487)) ([3daa5c0](3daa5c0))
* improved the UX on the feeds page and scroll behaviour ([#1506](#1506)) ([31c1593](31c1593))
* onboarding auto fetch timezone ([#1488](#1488)) ([ae5cdd7](ae5cdd7))

### πŸ› Bug Fixes

* Feed page responsiveness  ([#1490](#1490)) ([67662b2](67662b2))
* feeds page typography and styles improvements ([#1467](#1467)) ([a3b289e](a3b289e))
* on page reload Insights page redirecting to Dashboard ([#1517](#1517)) ([397c36e](397c36e))
* update environment variable for Sentry ([#1521](#1521)) ([56ac14b](56ac14b))
* update release workflow to use GitHub app for semantic versioning ([#1484](#1484)) ([3f1ce84](3f1ce84))
* update user interest logo error for machine learning ([#1474](#1474)) ([a286eda](a286eda))
* uses session to update user info for notifications check ([#1486](#1486)) ([60d787e](60d787e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review PRs that need review from core engineering team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Feed Page is not responsive Bug: General Responsiveness of the Highlights Page
3 participants