Skip to content

Conversation

@tariknz
Copy link
Owner

@tariknz tariknz commented Jun 21, 2025

Relatives have a bad layout shift currently when the table in relatives is not filled. This PR ensures that we keep the player centred by adding dummy rows that are hidden when the table is not filled so that the player stays vertically centred.

PR also adds settings for the buffer for the number of players ahead/behind the player to display

Screen.Recording.2025-06-21.at.1.41.06.PM.mov
Screen.Recording.2025-06-21.at.1.45.51.PM.mov

@tariknz tariknz requested a review from Copilot June 21, 2025 01:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR centers the player’s row in the Relatives table by inserting hidden dummy rows and adds a user-configurable buffer size setting.

  • Adds a useRelativeSettings hook and setting UI to adjust how many rows appear above and below the player.
  • Modifies the Relative component to always render 2*buffer+1 rows, centering the player and filling gaps with invisible dummy rows.
  • Updates default dashboard configuration and hook exports to support the new relative settings.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/frontend/components/Standings/hooks/useRelativeSettings.ts New hook to read the relative widget’s buffer setting.
src/frontend/components/Standings/hooks/index.ts Exported useDriverRelatives and useRelativeSettings hooks.
src/frontend/components/Standings/components/DriverRatingBadge/DriverRatingBadge.tsx Added leading-tight class to improve badge vertical alignment.
src/frontend/components/Standings/components/DriverInfoRow/DriverInfoRow.tsx Introduced hidden prop, adjusted alignment utilities.
src/frontend/components/Standings/Relative.tsx Core logic to render fixed rows, center player, and add dummy rows.
src/frontend/components/Settings/types.ts Defined RelativeWidgetSettings.config shape with buffer.
src/frontend/components/Settings/sections/RelativeSettings.tsx Settings UI for buffer size, duplicated local type.
src/app/storage/defaultDashboard.ts Set default buffer: 3 for the relative widget.
Comments suppressed due to low confidence (1)

src/frontend/components/Standings/Relative.tsx:19

  • Add a unit or integration test to verify that when no player is found, the component renders the correct number of hidden rows to preserve layout height.
  if (playerIndex === -1) {

@tariknz tariknz changed the title Relative: Keep player in the centre to avoid layout shift relative: keep player in the centre to avoid layout shift Jun 21, 2025
@tariknz tariknz merged commit 4da775d into main Jun 21, 2025
1 check passed
@tariknz tariknz deleted the feat/pivot-relatives branch June 21, 2025 06:57
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.

2 participants