Skip to content

721: Embed Leaderboard with startDate/endDate#738

Open
naanci wants to merge 1 commit intomainfrom
721
Open

721: Embed Leaderboard with startDate/endDate#738
naanci wants to merge 1 commit intomainfrom
721

Conversation

@naanci
Copy link
Collaborator

@naanci naanci commented Feb 5, 2026

721

Description of changes

  • sampled leaderboard.tsx currentlyLeaderboard() to pass the startDate/endDate for embed leaderboard

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

top: /leaderboard, bottom: /embed/leaderboard
Screenshot 2026-02-05 at 3 05 27 PM

Staging

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

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

@naanci
Copy link
Collaborator Author

naanci commented Feb 5, 2026

/deploy

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Title

721: Embed Leaderboard with startDate/endDate


PR Type

Bug fix


Description

  • Fetch leaderboard metadata for date range

  • Format metadata to compute dateRange

  • Pass startDate/endDate to top cards

  • Fix profile link range in embeds


Diagram Walkthrough

flowchart LR
  Org["OrgEmbedView.tsx"]
  MetaQ["useCurrentLeaderboardMetadataQuery()"]
  Format["formatLeaderboardDateRange(payload)"]
  Cards["LeaderboardCard (first/second/third)"]

  Org -- "fetch metadata" --> MetaQ
  MetaQ -- "payload" --> Format
  Format -- "startDate/endDate" --> Cards
Loading

File Walkthrough

Relevant files
Bug fix
OrgEmbedView.tsx
Pass date range to LeaderboardCard                                             

js/src/app/embed/leaderboard/_components/OrgEmbedView.tsx

  • Import leaderboard metadata query and formatter
  • Fetch metadata to derive date range
  • Compute dateRange from successful metadata response
  • Pass startDate/endDate to top LeaderboardCard entries
+18/-1   

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Acceptance Coverage

The startDate/endDate are only passed to the top-three LeaderboardCard components. Verify that all user-click entry points in the embed (e.g., table rows, profile links, avatar/name clicks) also receive and use the date range to meet the task’s acceptance criteria.

  mb="md"
>
  {page === 1 && second && !debouncedQuery && (
    <Box>
      <LeaderboardCard
        placeString={getOrdinal(second.index)}
        sizeOrder={2}
        discordName={second.discordName}
        startDate={dateRange?.startDate}
        endDate={dateRange?.endDate}
        leetcodeUsername={second.leetcodeUsername}
        totalScore={second.totalScore}
        nickname={second.nickname}
        width={"200px"}
        userId={second.id as string}
        isLoading={isPlaceholderData}
        embedded
      />
    </Box>
  )}
  {page === 1 && first && !debouncedQuery && (
    <LeaderboardCard
      placeString={getOrdinal(first.index)}
      startDate={dateRange?.startDate}
      endDate={dateRange?.endDate}
      sizeOrder={1}
      discordName={first.discordName}
      leetcodeUsername={first.leetcodeUsername}
      totalScore={first.totalScore}
      nickname={first.nickname}
      width={"200px"}
      userId={first.id as string}
      isLoading={isPlaceholderData}
      embedded
    />
  )}
  {page === 1 && third && !debouncedQuery && (
    <LeaderboardCard
      placeString={getOrdinal(third.index)}
      sizeOrder={3}
      discordName={third.discordName}
      leetcodeUsername={third.leetcodeUsername}
      totalScore={third.totalScore}
      nickname={third.nickname}
      startDate={dateRange?.startDate}
      endDate={dateRange?.endDate}
      width={"200px"}
      userId={third.id as string}
      isLoading={isPlaceholderData}
      embedded
Loading Handling

If the metadata query is still loading or fails, startDate/endDate are undefined, which can lead to incorrect navigation if users click before the range is ready. Consider gating interactions until metadata is loaded or showing a fallback and handling query errors (e.g., toast).

const metadataQuery = useCurrentLeaderboardMetadataQuery();

const dateRange =
  metadataQuery.data?.success ?
    formatLeaderboardDateRange(metadataQuery.data.payload)
  : undefined;

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

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