Skip to content

551: Fix Leaderboard Card Ordering On Mobile View#902

Open
isabellalam12 wants to merge 2 commits intomainfrom
551
Open

551: Fix Leaderboard Card Ordering On Mobile View#902
isabellalam12 wants to merge 2 commits intomainfrom
551

Conversation

@isabellalam12
Copy link
Copy Markdown
Collaborator

@isabellalam12 isabellalam12 commented Apr 15, 2026

551

Description of changes

  • Moved the POTD under the leaderboard for mobile view
  • Fixed the spacing of the POTD box for mobile view

Checklist before review

  • I have done a thorough self-review of the PR
  • Copilot has reviewed my latest changes, and all comments have been fixed and/or closed.
  • If I have made database changes, I have made sure I followed all the db repo rules listed in the wiki here. (check if no db changes)
  • All tests have passed
  • I have successfully deployed this PR to staging
  • I have done manual QA in both dev (and staging if possible) and attached screenshots below.

Screenshots

Dev

Screenshot 2026-04-14 at 11 54 27 PM Screenshot 2026-04-14 at 11 54 18 PM

Staging

@github-actions
Copy link
Copy Markdown
Contributor

Available PR Commands

  • /ai - Triggers all AI review commands at once
  • /review - AI review of the PR changes
  • /describe - AI-powered description of the PR
  • /improve - AI-powered suggestions
  • /deploy - Deploy to staging

See: https://github.com/tahminator/codebloom/wiki/CI-Commands

@github-actions
Copy link
Copy Markdown
Contributor

Title

551: Fix Leaderboard Card Ordering On Mobile View


PR Type

Bug fix


Description

  • Reordered dashboard cards for mobile.

  • Adjusted Problem of the Day card height.


Diagram Walkthrough

flowchart LR
  A[Dashboard Page] --> B{Is `smallPhone`?};
  B -- Yes --> C[Problem of the Day then Leaderboard];
  B -- No --> D[Leaderboard then Problem of the Day];
  C --> E[Render Recent Submissions];
  D --> E;
Loading

File Walkthrough

Relevant files
Enhancement
Dashboard.page.tsx
Reorder dashboard cards based on screen size                         

js/src/app/dashboard/Dashboard.page.tsx

  • Implemented conditional rendering to reorder ProblemOfTheDay and
    DashboardLeaderboard components.
  • On small phone screens, ProblemOfTheDay is now displayed before
    DashboardLeaderboard.
  • On larger screens, DashboardLeaderboard remains displayed before
    ProblemOfTheDay.
+24/-9   
ProblemOfTheDay.tsx
Adjust Problem of the Day card height for mobile                 

js/src/app/dashboard/_components/ProblemOfTheDay/ProblemOfTheDay.tsx

  • Modified the CodebloomCard component's mih (min-height) prop.
  • Set mih to auto for base (mobile) breakpoints to allow dynamic height
    adjustment.
  • Retained 63vh for md (medium) breakpoints and above.
+4/-1     

@github-actions
Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

Fix-Leaderboard-Card-Ordering-On-Mobile-View-2d77c85563aa80c48f27c2aff55f126f - Partially compliant

Compliant requirements:

  • Fix the spacing of the POTD box for mobile view.

Non-compliant requirements:

  • Move the Problem of the Day (POTD) under the Leaderboard for mobile view.

Requires further human verification:

  • Verify the actual rendering order of Leaderboard and POTD on mobile devices, as the code logic appears to contradict the PR description and screenshot.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Logical Inversion

The conditional rendering logic for smallPhone appears to be inverted or misconfigured, leading to an incorrect order of ProblemOfTheDay and DashboardLeaderboard on mobile. The PR description states "Moved the POTD under the leaderboard for mobile view" (implying Leaderboard first, then POTD on mobile), and the provided screenshot shows this layout. However, the code for smallPhone (lines 66-77) renders ProblemOfTheDay before DashboardLeaderboard, and the outer Flex container's direction is set to row for smallPhone, which would place them side-by-side, not stacked. This contradicts both the stated goal and the visual evidence.

{smallPhone ?
  <>
    <Flex direction={"column"} flex={1}>
      <ProblemOfTheDay />
    </Flex>
    <Flex direction={"column"} flex={1}>
      <DashboardLeaderboard
        userId={data.user.id}
        userTags={data.user.tags}
      />
    </Flex>
  </>
: <>
    <Flex direction={"column"} flex={1}>
      <DashboardLeaderboard
        userId={data.user.id}
        userTags={data.user.tags}
      />
    </Flex>
    <Flex direction={"column"} flex={1}>
      <ProblemOfTheDay />
    </Flex>
  </>
}

Comment on lines 65 to 92
<Flex direction={smallPhone ? "row" : "column"} gap={"md"}>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
{smallPhone ?
<>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
</>
: <>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
</>
}
<Flex direction={"column"} flex={1}>
<RecentSubmissions userId={data.user.id} />
</Flex>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The direction prop of the main Flex component appears to be inverted for mobile and desktop views. For smallPhone (mobile), the Flex direction should typically be column to stack content vertically, while for larger screens, it could be row for a horizontal layout. The current implementation sets direction="row" for smallPhone and direction="column" otherwise, which is likely to cause layout issues on mobile. [possible issue, importance: 8]

New proposed code:
-<Flex direction={smallPhone ? "row" : "column"} gap={"md"}>
+<Flex direction={smallPhone ? "column" : "row"} gap={"md"}>
   {smallPhone ?
     <>
       <Flex direction={"column"} flex={1}>
         <ProblemOfTheDay />
       </Flex>
       <Flex direction={"column"} flex={1}>
         <DashboardLeaderboard
           userId={data.user.id}
           userTags={data.user.tags}
         />
       </Flex>
     </>
   : <>
       <Flex direction={"column"} flex={1}>
         <DashboardLeaderboard
           userId={data.user.id}
           userTags={data.user.tags}
         />
       </Flex>
       <Flex direction={"column"} flex={1}>
         <ProblemOfTheDay />
       </Flex>
     </>
   }
   <Flex direction={"column"} flex={1}>
     <RecentSubmissions userId={data.user.id} />
   </Flex>
 </Flex>

Comment on lines +43 to +46
<CodebloomCard
miw={{ base: "31vw", md: "31vw" }}
mih={{ base: "auto", md: "63vh" }}
>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The miw prop for CodebloomCard uses responsive syntax but assigns the same value to both base and md breakpoints. This makes the md breakpoint specification redundant. Simplify this by either removing the md entry or by directly using miw="31vw" if the width is intended to be consistent across these breakpoints. [general, importance: 5]

Suggested change
<CodebloomCard
miw={{ base: "31vw", md: "31vw" }}
mih={{ base: "auto", md: "63vh" }}
>
<CodebloomCard
miw="31vw"
mih={{ base: "auto", md: "63vh" }}
>

@github-actions
Copy link
Copy Markdown
Contributor

Title

551: Fix Leaderboard Card Ordering On Mobile View


PR Type

Enhancement


Description

  • Reorder dashboard components for mobile

  • Place leaderboard above Problem of the Day

  • Adjust Problem of the Day card height


Diagram Walkthrough

flowchart LR
  A[Dashboard Page] --> B{Is smallPhone?};
  B -- Yes --> C[ProblemOfTheDay then DashboardLeaderboard];
  B -- No --> D[DashboardLeaderboard then ProblemOfTheDay];
Loading

File Walkthrough

Relevant files
Enhancement
Dashboard.page.tsx
Adjust dashboard component order for mobile view                 

js/src/app/dashboard/Dashboard.page.tsx

  • Implemented conditional rendering for ProblemOfTheDay and
    DashboardLeaderboard components.
  • On small phone screens, ProblemOfTheDay is displayed before
    DashboardLeaderboard.
  • On larger screens, DashboardLeaderboard is displayed before
    ProblemOfTheDay.
+24/-9   
ProblemOfTheDay.tsx
Update Problem of the Day card height for responsiveness 

js/src/app/dashboard/_components/ProblemOfTheDay/ProblemOfTheDay.tsx

  • Modified the mih (minimum height) prop of CodebloomCard to be
    responsive.
  • Set mih to auto for base (mobile) view and 63vh for medium (desktop)
    screens.
  • Simplified the miw prop syntax from {"31vw"} to "31vw".
+1/-1     

@github-actions
Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

Fix-Leaderboard-Card-Ordering-On-Mobile-View-2d77c85563aa80c48f27c2aff55f126f - PR Code Verified

Compliant requirements:

  • Moved the POTD under the leaderboard for mobile view.
  • Fixed the spacing of the POTD box for mobile view.

Requires further human verification:

  • Verify the correct ordering of POTD and Leaderboard on mobile view.
  • Verify the spacing of the POTD box on mobile view.
⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

Comment on lines +66 to +89
{smallPhone ?
<>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
</>
: <>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
</>
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The conditional rendering of ProblemOfTheDay and DashboardLeaderboard components introduces significant code duplication. This can be refactored by defining the components in an array and conditionally ordering them based on smallPhone before mapping and rendering them. This approach enhances readability and maintainability. [general, importance: 8]

Suggested change
{smallPhone ?
<>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
</>
: <>
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
</>
}
{(() => {
const leaderboardCard = (
<Flex direction={"column"} flex={1}>
<DashboardLeaderboard
userId={data.user.id}
userTags={data.user.tags}
/>
</Flex>
);
const problemOfTheDayCard = (
<Flex direction={"column"} flex={1}>
<ProblemOfTheDay />
</Flex>
);
const orderedComponents = smallPhone
? [problemOfTheDayCard, leaderboardCard]
: [leaderboardCard, problemOfTheDayCard];
return <>{orderedComponents}</>;
})()}

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.

1 participant