* feat: redesign playoff bracket UI with compact layout and owner display
- Replace per-match Card wrappers with compact left-vs-right rows (stacks on mobile)
- Add TeamOwnerBadge component (colored avatar + team name + username), matching the standings "Drafted By" style
- Show owner info below each participant name in bracket matches
- Add TBD forward-reference labels ("Winner of Quarterfinals M1") computed via buildFeederMap
- Add Final Rankings table below bracket showing all participants ranked by elimination round
- Fix round ordering in loader: sort by match count descending (more matches = earlier round)
- Add loser relation to playoff matches query for elimination tracking
- Extract getAvatarColor to app/lib/color-hash.ts (shared across GroupStageDisplay, SeasonStandings, TeamOwnerBadge)
- Extract groupMatchesByRound helper; share grouped map between feeder computation and render
- Remove dead getTeamAvatar from SeasonStandings after TeamOwnerBadge adoption
- Add tests for groupMatchesByRound and buildFeederMap (7 tests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add draft order card to league home page
Show draft order on the league home page when order is set and season
is in pre_draft or draft status. Includes team name, owner name, and
a link to the draft room.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: enhance playoff bracket with eliminated teams, points, and ownership highlights
- Show eliminated teams (including group-stage losers) in Final Rankings card
- Display computed fantasy points per participant in rankings table
- Card title switches between "Eliminated Teams" and "Final Rankings" based on bracket completion
- Highlight owned participants with electric blue name, dot indicator, and card border in bracket matches
- Highlight owned rows with electric border/background in rankings table
- Suppress EventSchedule for playoff_bracket sports seasons
- Fix title redundancy: bracket section title no longer repeats sport name
- Two-column match grid on desktop (md:grid-cols-2)
- Code review fixes: parallel DB fetches, targeted query for pre-eliminated, single-pass parseFloat, remove IIFE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Logic extracted from the league home page component
|
|
// ---------------------------------------------------------------------------
|
|
|
|
type SeasonStatus = 'pre_draft' | 'draft' | 'active' | 'completed';
|
|
|
|
/**
|
|
* Mirrors the isDraftOrPreDraft and draft-order-card visibility logic
|
|
* from app/routes/leagues/$leagueId.tsx:
|
|
*
|
|
* const isDraftOrPreDraft = season?.status === "pre_draft" || season?.status === "draft";
|
|
* ...
|
|
* {season && isDraftOrPreDraft && draftSlots.length > 0 && <DraftOrderCard />}
|
|
*/
|
|
function shouldShowDraftOrderCard(
|
|
season: { status: SeasonStatus } | null,
|
|
draftSlotCount: number
|
|
): boolean {
|
|
if (!season) return false;
|
|
const isDraftOrPreDraft = season.status === 'pre_draft' || season.status === 'draft';
|
|
return isDraftOrPreDraft && draftSlotCount > 0;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Tests
|
|
// ---------------------------------------------------------------------------
|
|
|
|
describe('Draft Order Card Visibility', () => {
|
|
describe('visible states (pre_draft / draft)', () => {
|
|
it('shows when status is pre_draft and draft slots are set', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'pre_draft' }, 4)).toBe(true);
|
|
});
|
|
|
|
it('shows when status is draft and draft slots are set', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'draft' }, 4)).toBe(true);
|
|
});
|
|
|
|
it('shows with a single draft slot', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'pre_draft' }, 1)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('hidden states (active / completed)', () => {
|
|
it('hides when status is active even if draft slots exist', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'active' }, 4)).toBe(false);
|
|
});
|
|
|
|
it('hides when status is completed even if draft slots exist', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'completed' }, 4)).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe('no draft slots', () => {
|
|
it('hides when no draft slots are set (pre_draft)', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'pre_draft' }, 0)).toBe(false);
|
|
});
|
|
|
|
it('hides when no draft slots are set (draft)', () => {
|
|
expect(shouldShowDraftOrderCard({ status: 'draft' }, 0)).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe('no season', () => {
|
|
it('hides when there is no season', () => {
|
|
expect(shouldShowDraftOrderCard(null, 4)).toBe(false);
|
|
});
|
|
});
|
|
});
|