Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changes/play-cards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
type: new
---
Play cards for every lineup: tap Play cards on the Plan or Game Day screen to swipe through Offense (1-2-2 / 2-2-1), Defense (2-3 Zone, 3-2 Zone, Box & 1), and Inbounding Stack (with Left/Right lane, toggleable cut arrows, and Play all / Step 1→4 animation), drag players freely, and tap Reset to snap back to standard spacing.
8 changes: 8 additions & 0 deletions docs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ Fixed on 2026-11-08: quick taps on the practice length and drill minutes stepper

Tests: `src/domain/practice.test.ts` (with property tests for team splits and dragging), `src/data/practice.test.ts`, `src/screens/Practice.test.tsx`, and `e2e/practice.spec.ts` (WebKit at 375×667 with a wide font). Help topic **Planning practices**.

## 11b. Game play cards

| ID | Status | Notes |
|----|--------|-------|
| PC1 | ✅ 📱 | **Play cards** button inline with **On court** on both the Plan (Segments view) and Game Day screens (`src/components/PlayCardsModal.tsx`, `src/components/HalfCourt.tsx`), adding zero vertical height on Game Day. Opens a fullscreen half-court deck (basket at top) for each unique 5-player lineup (`lineupKey` in `src/domain/playCards.ts`), stored in the optional unindexed `playCards` field on games (included in backups and Coach ↔ Assistant handoffs). |
| PC2 | ✅ 📱 | Three cards in order: **Offense** (`1-2-2` / `2-2-1` auto-picked from lineup positions, with formation toggle), **Defense** (`2-3 Zone` default, plus `3-2 Zone` and `Box & 1`), and **Inbounding Stack** (Center defaults to baseline inbounder; 4 stack players single-file starting at the 3rd lane hash mark, with Left/Right lane mirroring). Every player token shows name, jersey/position, and drags freely anywhere on the court. Every card has a **↺ Reset** button that snaps players back to default spacing for whiteboard use. |
| PC3 | ✅ 📱 | **Inbounding Stack** annotations and animation: toggleable directional cut arrows (`1` away from basket, `2` toward basket, `3` forward to inbounder, `4` pop back), recomputed dynamically when players are dragged or mirrored; **▶ Play all** and **Step 1→4** animation modes. Swipe left/right between cards; swiping left past the last card (or tapping **Done**) returns to the lineup screen. |

## 12. Documentation and help

| ID | Status | Notes |
Expand Down
65 changes: 65 additions & 0 deletions e2e/playcards.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { expect, test } from '@playwright/test';

test.describe('Play cards on iPhone', () => {
test.use({ viewport: { width: 402, height: 874 } });

test('opens play cards from Plan and Game Day, switches formations, animates stack, and persists per unique lineup', async ({
page,
}) => {
await page.goto('./');
await page.getByRole('button', { name: 'Load demo team' }).click();
await page.getByRole('radio', { name: 'Games' }).click();
await page.getByRole('button', { name: '+ New game' }).click();
await page.getByRole('button', { name: 'Generate plan' }).click();

// Open Play Cards from Plan screen (Q1 · 1 of 2)
await page.getByRole('button', { name: 'Play cards' }).click();
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible();
await expect(dialog.getByRole('heading', { name: 'Offense' })).toBeVisible();
await expect(dialog.locator('[data-player-token]')).toHaveCount(5);

// Move to Defense, switch to Box & 1, then Reset stays on Box & 1
await dialog.getByRole('button', { name: 'Next ›' }).click();
await expect(dialog.getByRole('heading', { name: 'Defense' })).toBeVisible();
await dialog.getByRole('radio', { name: 'Box & 1' }).click();
await expect(dialog.getByRole('radio', { name: 'Box & 1' })).toBeChecked();

// Move to Inbounding Stack: arrows default to off, toggle on/off, left/right side, and step animation
await dialog.getByRole('button', { name: 'Next ›' }).click();
await expect(dialog.getByRole('heading', { name: 'Inbounding Stack' })).toBeVisible();
await expect(dialog.locator('[data-testid^="stack-arrow-"]')).toHaveCount(0);
await dialog.getByRole('button', { name: 'Arrows: Off' }).click();
await expect(dialog.locator('[data-testid^="stack-arrow-"]')).toHaveCount(4);
await expect(dialog.getByTestId('stack-arrow-3')).toBeVisible();
await dialog.getByRole('button', { name: 'Arrows: On' }).click();
await expect(dialog.locator('[data-testid^="stack-arrow-"]')).toHaveCount(0);

await dialog.getByRole('radio', { name: 'Left lane' }).click();
await expect(dialog.getByRole('radio', { name: 'Left lane' })).toBeChecked();

// Step through 1 -> 2 -> Play all -> Reset
await dialog.getByRole('button', { name: 'Step 1→4' }).click();
await expect(dialog.getByText(/1\..*Away from basket/)).toBeVisible();
await dialog.getByRole('button', { name: '▶ Play all' }).click();
await expect(dialog.getByRole('button', { name: '↺ Stack' })).toBeVisible();
await dialog.getByRole('button', { name: '↺ Reset' }).click();
await expect(dialog.getByRole('button', { name: '▶ Play all' })).toBeVisible();

// Return to Plan screen via Done button at end of deck
await dialog.getByRole('button', { name: 'Done' }).last().click();
await expect(dialog).toBeHidden();

// Start game and verify the exact same Q1 · 1 of 2 lineup still has Box & 1 and Left lane saved!
await page.getByRole('button', { name: 'Start game' }).click();
await expect(page.getByRole('heading', { name: 'Q1 · 1 of 2' })).toBeVisible();
await page.getByRole('button', { name: 'Play cards' }).click();
await expect(dialog).toBeVisible();
await dialog.getByRole('button', { name: 'Next ›' }).click();
await expect(dialog.getByRole('radio', { name: 'Box & 1' })).toBeChecked();
await dialog.getByRole('button', { name: 'Next ›' }).click();
await expect(dialog.getByRole('radio', { name: 'Left lane' })).toBeChecked();
await dialog.getByRole('button', { name: 'Done' }).last().click();
await expect(dialog).toBeHidden();
});
});
Loading
Loading