Skip to content

Feature: Types and Utils#11

Merged
orimcoding merged 6 commits into
mainfrom
feat/types-and-utils
May 28, 2026
Merged

Feature: Types and Utils#11
orimcoding merged 6 commits into
mainfrom
feat/types-and-utils

Conversation

@orimcoding
Copy link
Copy Markdown
Owner

@orimcoding orimcoding commented May 28, 2026

Pull Request

Description

Added comprehensive TypeScript types (types/index.ts), created global constants (lib/constants.ts), implemented utility functions (lib/utils.ts), setup API clients, updated styling and dependencies.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe):

Related Issues

Screenshots (If it is a front end feature screenshot is reccomended)

Additional Notes

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced dashboard section with dark-first design system and updated branding
    • Added AI-powered match previews and player summaries
    • Implemented Redis caching for improved application performance
    • Expanded support for multiple football competitions and World Cup tournament data
  • Chores

    • Updated Next.js to version 16.2.6
    • Added dependencies for charting, UI components, and AI integration

Review Change Stack

@orimcoding orimcoding self-assigned this May 28, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swale Ready Ready Preview, Comment May 28, 2026 1:33am

@supabase
Copy link
Copy Markdown

supabase Bot commented May 28, 2026

This pull request has been ignored for the connected project isbbtnzupwefmhzojltw because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Caution

Review failed

Pull request was closed or merged during review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "version"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

This PR establishes the complete infrastructure foundation for a football analytics dashboard. It introduces a comprehensive TypeScript domain model, configuration system, global styling with CSS design tokens, utility helpers, and integrations with API-Football, OpenAI, and Redis caching.

Changes

Dashboard Infrastructure & Foundation

Layer / File(s) Summary
Domain type system and data models
src/types/index.ts
MatchStatus, Team, Match, Player, PlayerFormMatch, World Cup tournament/group/knockout structures, Competition, AI insight request/response shapes, NewsArticle, API response wrappers, and UI state/filter types define the core football data model.
Configuration, theme, and constants
package.json, src/lib/constants.ts
Dependencies updated with D3, Redis, OpenAI, and recharts; THEME dark-first colors, COMPETITIONS and NAV_ITEMS metadata, MATCH_STATUS_DISPLAY and PLAYER_POSITIONS labels, RATING_THRESHOLDS, cache TTL, API endpoints, date formats, radar stats, World Cup groups, and formation coordinates exported as centralized constants.
Global styling system and app shell
src/app/globals.css, src/app/layout.tsx, src/app/dashboard/layout.tsx, src/app/dashboard/page.tsx
CSS variables define semantic colors (primary, accent, background, foreground, border) with light-mode overrides; global body/html styling uses theme tokens; scrollbar, selection, focus, and link styles added; .live-pulse and .live-dot animations included; layout metadata updated to dashboard focus; dashboard layout and page placeholders introduced.
Utility and helper functions
src/lib/utils.ts
formatTime, isToday, isSoon, formatMatchTime for date/time; formatNumber, formatCurrency, formatPercentage for numeric display; getMatchStatusDisplay, isMatchLive, isMatchFinished, isMatchScheduled for match predicates; getRatingBadgeColor, getRatingLabel, calculateFormTrend, getFormTrendEmoji for rating/form; calculateGoalDifference, getMatchWinner, getPointsFromMatch for score logic; getPositionCategory, getPositionShorthand for player positions; cn, truncateString, capitalize for strings; sortMatches, groupMatchesByCompetition, groupMatchesByDate for match organization; isValidEmail, isValidURL for validation; fetchWithTimeout with abort-controller timeout; cache key builders for scores, players, and World Cup; getDistance and calculatePercentPosition for math.
API-Football HTTP client wrapper
src/lib/api-football/client.ts
APIFootballClient class with private request<T> helper that constructs URLs, appends query parameters, includes x-apisports-key header, parses JSON responses, and throws on errors; environment-variable validation for API_FOOTBALL_KEY; public methods getFixtures, getPlayer, getStandings, getLiveMatches currently return mock empty results; exports singleton apiFootballClient.
Redis caching infrastructure
src/lib/redis/cache.ts
Upstash Redis client initialized from UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN; CacheManager with async get, set (supports TTL via setex), delete, clear (namespace-filtered key deletion via KEYS pattern), getOrSet (read-through using caller-supplied async function), and buildKey for namespace scoping; all operations catch errors, log to console, and return safe defaults; exports singleton cacheManager and re-exports redis client.
OpenAI client and prompt templates
src/lib/openai/client.ts, src/lib/openai/prompts.ts
OpenAI SDK client with MODEL = "gpt-4o-mini", MAX_TOKENS = 500, TEMPERATURE = 0.7; environment-key validation; three system-prompt constants (MATCH_PREVIEW_SYSTEM_PROMPT, PLAYER_SUMMARY_SYSTEM_PROMPT, TREND_NARRATIVE_SYSTEM_PROMPT) and corresponding typed prompt generators (generateMatchPreviewPrompt with optional form interpolation, generatePlayerSummaryPrompt with stats formatting, generateTrendNarrativePrompt converting data to key-value lines) with graceful fallback text for missing optional data.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A dashboard takes root with types and constants true,
Styling flows in tokens, utilities brew,
APIs and caches stand ready and tall,
With prompts and formations, we'll conquer it all! ⚽✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature: Types and Utils' is partially related to the changeset, referring to key components added (types and utils), but it omits significant additions like constants, API clients, styling, and dependencies.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/types-and-utils

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@orimcoding orimcoding merged commit 42b2936 into main May 28, 2026
9 of 10 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.

1 participant