Skip to content

feat(mobile): mobile-first foundation (viewport, dvh, touch-target, safe-area, reduced-motion) — PRD-1#176

Merged
EmiyaKiritsugu3 merged 4 commits into
mainfrom
feat/008-mobile-first-foundation
Jul 6, 2026
Merged

feat(mobile): mobile-first foundation (viewport, dvh, touch-target, safe-area, reduced-motion) — PRD-1#176
EmiyaKiritsugu3 merged 4 commits into
mainfrom
feat/008-mobile-first-foundation

Conversation

@EmiyaKiritsugu3

@EmiyaKiritsugu3 EmiyaKiritsugu3 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

PRD-1 of 8 mobile-first premium polish plan. Foundational infrastructure only — zero visual redesign. Unblocks PRDs 2-8 (touch-target util, dvh units, reduced-motion gate consumed downstream).

Webapp primary target is phone (user directive 2026-07-05). Current foundation broken for mobile:

  • No viewport export (Next.js 15 App Router no longer auto-emits)
  • vh/screen units jump ~80px on iOS Safari URL bar show/hide
  • Touch targets 36px (below Apple HIG 44pt)
  • No safe-area-inset (notch/home indicator overlap)
  • No prefers-reduced-motion (vestibular users no opt-out)

Changes

  • layout.tsx: export const viewport (viewportFit cover unlocks env(safe-area-inset-*), colorScheme dark)
  • globals.css: .touch-target 44px util, body safe-area padding, overscroll-behavior: none, prefers-reduced-motion media query (WCAG 2.2 SC 2.3.3)
  • dvh swap (9 files): page.tsx, aluno/layout.tsx, dashboard/layout.tsx, login/page.tsx, aluno/login/page.tsx, aluno/dashboard/dashboard-client.tsx, dashboard/alunos/page.tsx, dashboard/financeiro/page.tsx, global-error.tsx
  • aluno-header.tsx: trigger buttons h-9 w-9h-11 w-11 + touch-target
  • alunos/page.test.tsx: assertion .min-h-screen.min-h-dvh

Constitution Check

  • II Type Safety: viewport typed Viewport from next. No any. ✅
  • III Test-Gated: assertion updated Red→Green. Foundation infra, no new business logic. ✅
  • V Commit Discipline: branch feat/008-mobile-first-foundation. Conventional commits. ✅
  • No principle violated. No amendment.

Verification

  • npm run typecheck
  • npm run lint ✅ (no new issues; pre-existing in mongo-init.js, global-setup.ts, commitlint.config.cjs)
  • npm test ✅ (108 files, 1119 tests)
  • npm run format:check ✅ (13 edited files clean; pre-existing .superpowers/sdd/ doc warnings unrelated)
  • E2E (T12): skipped — no staging env. Manual phone-viewport smoke test recommended pre-merge.

Spec

docs/superpowers/specs/2026-07-07-mobile-first-foundation-design.md

Out of Scope (downstream PRDs)

Bottom nav (PRD-3), brand palette (PRD-2), KPI/charts (PRD-6), next/font (PRD-7), kebab + empty state (PRD-4), workout fullscreen (PRD-5), aluno detail tables (PRD-8).

🤖 Generated with Claude Code


Summary by cubic

Mobile-first foundation (PRD-1): sets a proper viewport, swaps vh to dvh, adds safe-area padding, 44px touch-targets, and reduced-motion support to make the app reliable on phones. Fixes iOS URL bar jumps and notch/home-indicator overlap without visual redesign, unblocking PRDs 2–8.

  • New Features

    • Viewport: added export const viewport with device-width, initialScale=1, viewportFit=cover, and dark colorScheme.
    • Dynamic viewport units: replaced vh/screen with dvh across layouts/pages; updated one test to assert .min-h-dvh.
    • Safe areas: applied env(safe-area-inset-*) padding on body and overscroll-behavior: none.
    • Touch targets: new .touch-target utility (44px min) and upgraded header icon buttons to h-11 w-11.
    • Reduced motion: global prefers-reduced-motion media query to disable long animations.
  • Docs

    • PRD-1: fixed markdown fences; PRDs 3/6/8: corrected data shapes/paths and clarified mobile behavior (e.g., chart legend via useIsMobile).

Written for commit 5640d92. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Improved mobile layouts across login, dashboard, landing, and workout screens for better fit and readability.
    • Added a bottom navigation experience on mobile and upgraded touch-friendly controls.
  • Bug Fixes

    • Reduced unwanted scrolling and layout issues by using dynamic viewport sizing and safe-area support.
    • Fixed inconsistent branding and typography so key screens look more polished and consistent.
  • Style

    • Updated mobile cards, buttons, charts, and action menus for clearer hierarchy and easier tap interactions.

EmiyaKiritsugu3 and others added 2 commits July 5, 2026 23:09
PRD-1 mobile-first-foundation, PRD-2 brand-consistency, PRD-3 mobile-navigation,
PRD-4 meus-treinos-kebab, PRD-5 workout-session-fullscreen, PRD-6 kpi-charts-mobile,
PRD-7 login-parity-nextfont, PRD-8 aluno-detail-tables-mobile.

Co-Authored-By: Claude <noreply@anthropic.com>
…t, safe-area)

- layout.tsx: viewport export (viewportFit cover unlocks safe-area-inset)
- globals.css: .touch-target 44px util, body safe-area padding,
  overscroll-behavior none, prefers-reduced-motion query (WCAG 2.2 SC 2.3.3)
- vh/screen -> dvh across page.tsx, aluno/layout.tsx, dashboard/layout.tsx,
  login/page.tsx, aluno/login/page.tsx, aluno/dashboard/dashboard-client.tsx,
  dashboard/alunos/page.tsx, dashboard/financeiro/page.tsx, global-error.tsx
  (fix iOS Safari URL-bar jump)
- aluno-header.tsx: trigger h-9 w-9 -> h-11 w-11 + touch-target (HIG 44pt)
- alunos/page.test.tsx: .min-h-screen -> .min-h-dvh assertion

Gates: typecheck, lint, test (1119), format:check all green.
Refs docs/superpowers/specs/2026-07-07-mobile-first-foundation-design.md

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
smartmanagementsystem Ready Ready Preview, Comment Jul 6, 2026 2:38am

@ecc-tools

ecc-tools Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR adds seven mobile-focused design specification documents to docs/superpowers/specs/ and implements the initial "mobile-first foundation" infrastructure: a Next.js viewport export, min-h-screen/h-screen to dvh replacements across pages/layouts, larger touch targets, and CSS updates for safe-area insets, overscroll, and reduced-motion behavior.

Changes

Design specification documents

Layer / File(s) Summary
New mobile-focused design specs
docs/superpowers/specs/2026-07-07-*.md
Adds seven markdown specs covering aluno detail tables mobile cards, brand color consistency, KPI/charts mobile layout, login parity + next/font, Meus Treinos kebab menu, mobile-first foundation, mobile bottom navigation, and workout session fullscreen mode, each with problem statements, design steps, files-changed lists, out-of-scope items, and success criteria.

Mobile-first foundation implementation

Layer / File(s) Summary
Viewport metadata export
src/app/layout.tsx
Adds Viewport import and exports a viewport config with width, initial scale, viewportFit: 'cover', and dark colorScheme.
Dynamic viewport height (dvh) swap
src/app/aluno/dashboard/dashboard-client.tsx, src/app/aluno/layout.tsx, src/app/aluno/login/page.tsx, src/app/dashboard/alunos/page.tsx, src/app/dashboard/alunos/page.test.tsx, src/app/dashboard/financeiro/page.tsx, src/app/dashboard/layout.tsx, src/app/global-error.tsx, src/app/login/page.tsx, src/app/page.tsx
Replaces min-h-screen/h-screen (and min-h-[75vh]) with min-h-dvh/h-dvh/min-h-[75dvh] across pages, layouts, and updates a corresponding test assertion.
Touch targets and global CSS
src/app/aluno/aluno-header.tsx, src/app/globals.css
Enlarges header trigger buttons to touch-target h-11 w-11, adds .touch-target utility (44px min sizing), safe-area inset padding and overscroll-behavior: none on body, and reduced-motion overrides limiting animation/transition duration and scroll behavior.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

Not applicable — changes are documentation additions and simple CSS/class-level styling updates without multi-component control flow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed, but it does not follow the required template sections for Type of Change, Related Documents, and Checklist. Add the missing template headings with checkboxes, link the relevant User Story/ADR, and include the required validation checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the mobile-first foundation changes: viewport, dvh, touch targets, safe-area, and reduced-motion.
✨ 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/008-mobile-first-foundation

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 21 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-07-mobile-navigation-design.md
Comment thread docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
docs/superpowers/specs/2026-07-07-brand-consistency-design.md (1)

40-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep this spec token-only.

The trend field and delta-badge logic are a separate KPI data-model change, which contradicts the file’s own “Zero structural change” scope and overlaps the KPI/charts PRD. Split that requirement into the KPI spec and leave this doc focused on the orange→cyan token swap.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-07-07-brand-consistency-design.md` around lines
40 - 52, The spec currently mixes in KPI delta/trend behavior, which is outside
this doc’s “Zero structural change” scope and overlaps the KPI data-model work.
Remove the `kpi.trend`, delta-badge, and `kpi.color.replaceAll` guidance from
this document, and keep the content focused only on the orange→cyan token swap
in the design spec so the KPI logic can live in the separate KPI/charts spec.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md`:
- Around line 68-70: Preserve the existing empty-state copy instead of changing
it to the new generic text. Update the spec to match the current behavior in the
alumnos detail page, and keep the contract used by the `page.tsx` empty-state
rendering and its related test expecting “Nenhum treino cadastrado para este
aluno.”. Do not replace that string with “Nenhum registro.” in the design notes
or implementation guidance.

In `@docs/superpowers/specs/2026-07-07-kpi-charts-mobile-design.md`:
- Around line 80-85: The chart legend example is not actually responsive and
conflicts with the prose about mobile versus desktop behavior. Update the spec
in the Legend section to either describe a breakpoint-dependent switch in the
example using the Legend component, or simplify the requirement to a single
layout so the intended behavior is unambiguous.

In `@docs/superpowers/specs/2026-07-07-meus-treinos-kebab-design.md`:
- Around line 57-62: The current E2E test IDs are too generic and will collide
across multiple treino cards, making selectors ambiguous. Update the test hooks
referenced in the spec so the card and action identifiers are namespaced per
treino or moved behind a scoped container hook, and use the unique symbols
treino-card, iniciar-treino, treino-kebab, editar-treino, and excluir-treino as
the places to apply the new naming scheme. Ensure each rendered card can be
targeted unambiguously, and prefer scoped selectors plus text checks where
appropriate.

In `@docs/superpowers/specs/2026-07-07-mobile-first-foundation-design.md`:
- Around line 40-46: The fenced code blocks in this spec are unlabeled, which
keeps markdownlint MD040 active. Update both fenced sections mentioned in the
comment to include a language tag (for example, label the blocks as text) so the
documentation in this file renders as properly labeled fenced code blocks.

---

Nitpick comments:
In `@docs/superpowers/specs/2026-07-07-brand-consistency-design.md`:
- Around line 40-52: The spec currently mixes in KPI delta/trend behavior, which
is outside this doc’s “Zero structural change” scope and overlaps the KPI
data-model work. Remove the `kpi.trend`, delta-badge, and `kpi.color.replaceAll`
guidance from this document, and keep the content focused only on the
orange→cyan token swap in the design spec so the KPI logic can live in the
separate KPI/charts spec.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c2bf938c-6f73-420c-9204-e435af5033e2

📥 Commits

Reviewing files that changed from the base of the PR and between ba16847 and 6974cf2.

📒 Files selected for processing (21)
  • docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md
  • docs/superpowers/specs/2026-07-07-brand-consistency-design.md
  • docs/superpowers/specs/2026-07-07-kpi-charts-mobile-design.md
  • docs/superpowers/specs/2026-07-07-login-parity-nextfont-design.md
  • docs/superpowers/specs/2026-07-07-meus-treinos-kebab-design.md
  • docs/superpowers/specs/2026-07-07-mobile-first-foundation-design.md
  • docs/superpowers/specs/2026-07-07-mobile-navigation-design.md
  • docs/superpowers/specs/2026-07-07-workout-session-fullscreen-design.md
  • src/app/aluno/aluno-header.tsx
  • src/app/aluno/dashboard/dashboard-client.tsx
  • src/app/aluno/layout.tsx
  • src/app/aluno/login/page.tsx
  • src/app/dashboard/alunos/page.test.tsx
  • src/app/dashboard/alunos/page.tsx
  • src/app/dashboard/financeiro/page.tsx
  • src/app/dashboard/layout.tsx
  • src/app/global-error.tsx
  • src/app/globals.css
  • src/app/layout.tsx
  • src/app/login/page.tsx
  • src/app/page.tsx

Comment thread docs/superpowers/specs/2026-07-07-aluno-detail-tables-mobile-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-07-kpi-charts-mobile-design.md
Comment on lines +57 to +62
Data-testid for E2E stability:
- Card: `data-testid="treino-card"`
- Iniciar: `data-testid="iniciar-treino"`
- Kebab trigger: `data-testid="treino-kebab"`
- Editar item: `data-testid="editar-treino"`
- Excluir item: `data-testid="excluir-treino"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Namespace the data-testids.

Static IDs like treino-card and iniciar-treino will be duplicated once the page renders multiple cards, which makes E2E selectors ambiguous. Use a treino-specific suffix or a scoped container hook plus text assertions instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-07-07-meus-treinos-kebab-design.md` around lines
57 - 62, The current E2E test IDs are too generic and will collide across
multiple treino cards, making selectors ambiguous. Update the test hooks
referenced in the spec so the card and action identifiers are namespaced per
treino or moved behind a scoped container hook, and use the unique symbols
treino-card, iniciar-treino, treino-kebab, editar-treino, and excluir-treino as
the places to apply the new naming scheme. Ensure each rendered card can be
targeted unambiguously, and prefer scoped selectors plus text checks where
appropriate.

Comment thread docs/superpowers/specs/2026-07-07-mobile-first-foundation-design.md Outdated
Add 'text' language tag to 2 bare fenced code blocks (lines 40, 85)
flagged by markdownlint MD040 / CodeRabbit.

Co-Authored-By: Claude <noreply@anthropic.com>
@ecc-tools

ecc-tools Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

- PRD-8 aluno-detail-tables: replace fictional fields (item.matricula,
  item.plano, bool statusPago) with real Prisma shape (m.Plano.nome,
  m.status StatusMatricula enum, Pagamento has no status field,
  TreinosList is grid not Table), real TableCell counts (4+3), preserve
  per-table empty strings (Nenhuma matrícula/Nenhum pagamento/Nenhum treino)
- PRD-6 kpi-charts: legend responsive via existing useIsMobile hook
  (vertical mobile, horizontal desktop) instead of static horizontal
- PRD-3 mobile-navigation: fix path aluno-layout.tsx -> layout.tsx
  (line 54 + Files Changed table)
- PRD-4 meus-treinos: data-testid naming already per-instance scoped,
  no change needed

Refs PR #176 review comments.

Co-Authored-By: Claude <noreply@anthropic.com>
@ecc-tools

ecc-tools Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

@EmiyaKiritsugu3 EmiyaKiritsugu3 merged commit 222e1b3 into main Jul 6, 2026
14 checks passed
EmiyaKiritsugu3 added a commit that referenced this pull request Jul 6, 2026
…PRD-3 (#179)

* feat(mobile): add bottom navigation bar for mobile aluno + dashboard — PRD-3

- New src/components/bottom-nav.tsx: shared mobile-only BottomNav (md:hidden),
  44pt touch-target, safe-area pb, reduced-motion-safe transitions, lucide
  iconName string union avoids ReactNode serialization across server/client
- Wire BottomNav into aluno layout (2 items) + dashboard layout via
  DashboardBottomNav client wrapper (usePathname + getNavItems, role-filtered;
  dev item stays sidebar-only)
- Extract getNavItems(role) from DashboardNav into reusable selector;
  sidebar + bottom bar share one source of role-filtered nav truth
- Remove redundant md:hidden nav block from aluno UserMenu dropdown
  (primary nav now bottom bar); drop unused navLinks prop from UserMenu
- pb-16/pb-20 on main content reserves space above fixed bottom bar
- Tests: bottom-nav.test.tsx (6), updated aluno-header.test.tsx (drop
  removed prop); dashboard-nav.test.tsx unchanged (14 green)

Refs: PRD-3 mobile-navigation-design, builds on PRD-1 foundation (#176)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: update CURRENT-STATE for PRD-3 bottom nav (PR #179)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(mobile): address 5 cubic review findings on PR #179

- Extract isNavActive() pure fn to bottom-nav.tsx, reuse in DashboardNav
  (P2: was duplicated isActive logic)
- Export DEV_HREF from dashboard-nav, import in DashboardBottomNav wrapper
  (P3: dev route string duplicated)
- Move DashboardBottomNav out of SidebarInset (<main>) into parent div
  (P3: nav landmark nested inside main — aluno layout already kept nav outside main)
- Remove dead DashboardNavItem type alias (P3: exported never consumed)
- Add dashboard-bottom-nav.test.tsx: 4 tests asserting role filtering
  (GERENTE 5 items, FINANCIAL_ROUTES excludes Financeiro+Planos for
  INSTRUTOR), DEV_HREF exclusion, bottom-nav-limit ≤5 (P2: no test coverage)
- Add FolderKanban to dashboard-nav.test.tsx lucide mock (now imported via
  bottom-nav real module chain)

Gates: typecheck ✅, lint ✅, 1129/1129 tests ✅.

Co-Authored-By: Claude <noreply@anthropic.com>

* docs(mobile): correct test count in CURRENT-STATE (1125→1129)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Emiya Kiritsugu <emiyakiritsugu3@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
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