Skip to content

refactor(ui): unify shared work cards, integrate GitHub language palette, and optimize profile layout - #214

Merged
O2sa merged 3 commits into
mainfrom
refactor/work-cards
Sep 14, 2026
Merged

O2sa merged 3 commits into
mainfrom
refactor/work-cards

Conversation

@O2sa

@O2sa O2sa commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

This PR unifies the repository, pull request, and community contribution cards across both the Developer Profile (/user/[username]) and Comparison (/) pages. It also introduces canonical GitHub Linguist language color support, optimizes responsive layout for top work cards, and enforces strict client/server bundle boundary separation.


🛠️ Key Changes

1. Unified Shared Cards (src/components/cards/)

  • Consolidated duplicated cards into domain-agnostic global components:
    • RepoCardItem: Star, fork, watcher stats, multi-language progress bar, selected language highlights, score badge.
    • PullRequestCardItem: Target repository, additions/deletions diff pill, language breakdown, score badge.
    • CommunityCardItem: Issue/discussion badge, comment count, stars, and score badge.
    • ScoreCard: Unified score metric cards with tooltips and normalization meters.
  • Updated user-profile-client.tsx, top-list.tsx, and result-dashboard.tsx to consume these global cards.

2. Profile Top Work Responsive Layout

  • Updated the Top Work section grid from 3 columns to:
    • Small screens / Mobile: 1 column (grid-cols-1).
    • Medium / Large screens: Maximum 2 columns (md:grid-cols-2), with the 3rd card (Community Contributions) spanning across both columns (md:col-span-2) for a clean, balanced layout.
  • Synchronized user-profile-skeleton.tsx loading skeleton to match.

3. Title & Repository Wrapping

  • Replaced rigid text truncation on card titles and repo names with break-words leading-snug, allowing users to read long pull request titles, issue summaries, and repository names in full.
  • Adjusted rank badge vertical alignment to items-start with mt-0.5.

4. Canonical GitHub Language Colors (src/lib/languages/)

  • Created src/lib/languages/github-colors.ts with 150+ canonical colors from GitHub Linguist (TypeScript, Python, JavaScript, Rust, Go, Swift, Kotlin, C++, Solidity, Zig, Gleam, Mojo, etc.).
  • Added alias normalization (ts, js, py, golang, rs, cpp, csharp, sh).
  • Implemented a deterministic HSL hash fallback for novel or rare languages.
  • Updated LanguageBreakdown progress bar segments, legend dots, and SelectedLanguageRow pills to display authentic GitHub colors.

5. Architectural Server Boundary Separation

  • Ensured feature barrels (src/features/*/index.ts) export strictly types and client components.
  • Server services importing @/lib/db or @/lib/cache are imported via explicit @/features/<feature>/services paths, preventing Next.js / Turbopack client SSR bundling errors (Can't resolve 'dns').

🧪 Verification & Testing

  • TypeScript Type Check: npx tsc --noEmit passed with 0 errors.
  • Unit & Integration Tests: npx vitest run passed all 15 test suites and 117 tests.
  • Next.js Compilation: All 160 application routes compiled successfully.

📸 Component Impact

  • Developer Profile (/user/[username]) -> Unified cards, wrapped titles, 2-column top work, GitHub language colors.
  • Comparison Page (/) -> Shared cards with identical styling, tooltips, and language pills.

…umentation

- Reorganized codebase under `src/` following a Feature-Driven Scalable Next.js Architecture:
  - `src/features/` (domain modules: comparison, developer, leaderboard, scoring with colocated components, services, tests, types, and barrel exports)
  - `src/lib/` (infrastructure adapters: cache, db, geo, github, i18n, logger, seo)
  - `src/components/` (shared domain-agnostic UI: ui, layout, providers, seo)
  - `src/app/` (thin routing controllers, layouts, and API routes)
  - `src/locales/`, `src/data/`, `src/types/`, `src/utils/`
- Updated path aliases in `tsconfig.json`, `tailwind.config.ts`, and `vitest.config.ts` (`@/features/*`, `@/lib/*`, `@/components/*`, etc.).
- Updated script paths in `scripts/calculate-next-country.ts`, `scripts/init-db.ts`, and `scripts/validate-locales.js`.
- Created comprehensive `ARCHITECTURE.md` documentation detailing system design, sequence flows, encapsulation rules, and step-by-step contributor cookbooks.
- Updated `README.md`, `CONTRIBUTING.md`, and `algorithm.md` to align with the new architecture.
- Replaced hardcoded machine/absolute paths in markdown files with relative paths.
…ize responsive layout

- Move and unify shared work cards (RepoCardItem, PullRequestCardItem, CommunityCardItem, ScoreCard) under global src/components/cards/
- Fix client/server barrel boundary separation in feature index exports to avoid leaking server-only dependencies (pg, redis, dns) into client bundles
- Restructure Profile Top Work section into a responsive 1-column (mobile) and max 2-column (desktop) grid with balanced community card spanning
- Enable text wrapping with break-words leading-snug for repository and PR titles to prevent awkward truncation
- Add GitHub Linguist language color palette supporting 150+ programming languages with alias normalization and deterministic HSL fallback
- Update LanguageBreakdown and SelectedLanguageRow components to render official GitHub color bars and indicators
- Add comprehensive unit test suite for language colors (15 suites / 117 tests passing)
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
dev-impact Ready Ready Preview Sep 14, 2026 12:16am UTC

@O2sa
O2sa merged commit 3feea9a into main Sep 14, 2026
7 checks passed
@O2sa
O2sa deleted the refactor/work-cards branch September 14, 2026 00:17
@O2sa

O2sa commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Thank you, @O2sa! Another great contribution merged! 🚀

You've been a fantastic contributor! We truly appreciate your continued support.

This branch was successfully deployed

1 active deployment
Preview c7cff5b6 Deployed Sep 14, 2026 by vercel[bot]
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