Skip to content

Fixed layouts for league thumb/cover#121

Merged
sethwv merged 1 commit into
sethwv:devfrom
brheinfelder:league-layout
Apr 28, 2026
Merged

Fixed layouts for league thumb/cover#121
sethwv merged 1 commit into
sethwv:devfrom
brheinfelder:league-layout

Conversation

@brheinfelder

Copy link
Copy Markdown
Contributor

Description

Fixed the layouts for league covers/thumbs to avoid the possibility of overlapping/clipping items like in the below example:

GET /f1/thumb?title=Miami+Grand+Prix&subtitle=Practice+1&iconurl=https%3A%2F%2Fmedia.formula1.com%2Fimage%2Fupload%2Fc_fit%2Ch_704%2Fq_auto%2Fv1740000001%2Fcommon%2Ff1%2F2026%2Ftrack%2F2026trackmiamidetailed.png
image

Reworked into 3 possible layouts that are switched automatically according to what query params are present:

  1. League Logo Only (The original game-thumbs league layout)
  2. League and Title/Subtitle Only (No icon)
  3. League, Title/Subtitle, and Icon

Type of Change

  • Bug fix
  • New feature
  • New league/sport support
  • Team data correction/override
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Other (please describe)

Changes Made

Refactored canvas element draw logic in generateLeagueImage() into a centralized function drawContents() so layout variables can be updated in one place instead of several (and significantly reducing code duplication). The new function also contains the logic for the layout switching. This should also make it easy to add other layouts in the future.

Testing

Changes tested locally with /:league/thumb and /:league/cover and relevant query params

  • Tested locally
  • Added/updated tests
  • Verified endpoints work as expected

Test Details:

Screenshots/Examples

Layout 1 (League Only, game-thumbs OG)

Current

GET /f1/thumb
image
GET /f1/cover
image

New (pretty much identical)

image image

Layout 2 (League, Title/subtitle)

Current (inconsistent spacing)

GET /nba/thumb?title=Basketball+Game&subtitle=I+know+nothing+about+this+sport
image
GET /nba/cover?title=Basketball+Game&subtitle=I+know+nothing+about+this+sport
image

New (fixed)

image image

Layout 3 (League, Title/subtitle, Icon)

Current (broken)

GET /f1/thumb?title=Miami+Grand+Prix&subtitle=Practice+1&iconurl=https%3A%2F%2Fmedia.formula1.com%2Fimage%2Fupload%2Fc_fit%2Ch_704%2Fq_auto%2Fv1740000001%2Fcommon%2Ff1%2F2026%2Ftrack%2F2026trackmiamidetailed.png
image
GET /f1/cover?title=Miami+Grand+Prix&subtitle=Practice+1&iconurl=https%3A%2F%2Fmedia.formula1.com%2Fimage%2Fupload%2Fc_fit%2Ch_704%2Fq_auto%2Fv1740000001%2Fcommon%2Ff1%2F2026%2Ftrack%2F2026trackmiamidetailed.png
image

New (fixed)

image image

Checklist

  • My code follows the project's coding style
  • I have updated documentation if needed
  • My changes generate no new warnings or errors
  • I have tested my changes thoroughly

@sethwv sethwv deleted the branch sethwv:dev April 28, 2026 18:47
@sethwv sethwv closed this Apr 28, 2026
@sethwv sethwv reopened this Apr 28, 2026
@sethwv sethwv merged commit 83ad790 into sethwv:dev Apr 28, 2026
26 of 27 checks passed
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