Initialize Workout Tracker app shell

This commit is contained in:
rob
2026-10-18 17:31:27 +01:00
commit e86a2e7850
18 changed files with 6648 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
import { useState } from 'react'
import { Button, Container, Nav, Navbar } from 'react-bootstrap'
const sections = [
{ id: 'today', label: 'Today', title: 'Your workout, at a glance', description: 'Your daily sessions will appear here when the routine is added.' },
{ id: 'week', label: 'Week', title: 'The week ahead', description: 'The seven-day programme will appear here when the routine is added.' },
{ id: 'history', label: 'History', title: 'Your training history', description: 'Completed workouts will appear here once tracking is available.' },
{ id: 'plan', label: 'Plan', title: 'Your training plan', description: 'Routine editing will become available in a later task.' },
{ id: 'settings', label: 'Settings', title: 'Your data and preferences', description: 'Local backup and app settings will become available in a later task.' },
]
export default function App() {
const [activeId, setActiveId] = useState('today')
const activeSection = sections.find((section) => section.id === activeId)
return (
<div className="app-shell">
<a className="skip-link" href="#main-content">Skip to content</a>
<Navbar className="site-header" aria-label="Main navigation">
<Container className="header-inner">
<Navbar.Brand className="brand" href="#main-content" onClick={() => setActiveId('today')}>
<span className="brand-mark" aria-hidden="true">W</span>
<span>Workout Tracker</span>
</Navbar.Brand>
<span className="header-note">A private space to keep moving</span>
</Container>
</Navbar>
<Container className="page-content">
<div className="page-heading">
<div>
<p className="eyebrow">YOUR TRAINING SPACE</p>
<h1>{activeSection.title}</h1>
<p className="intro">A simple place for your plan, sessions and progress.</p>
</div>
<span className="local-badge">Local to this browser</span>
</div>
<Nav className="section-nav" aria-label="App sections">
{sections.map((section) => (
<Nav.Item key={section.id}>
<Button
className="section-link"
variant="link"
aria-current={activeId === section.id ? 'page' : undefined}
onClick={() => setActiveId(section.id)}
>
{section.label}
</Button>
</Nav.Item>
))}
</Nav>
<main id="main-content" tabIndex="-1">
<section className="content-panel" aria-labelledby="panel-title">
<div className="panel-icon" aria-hidden="true">{activeId === 'today' ? '↗' : '•'}</div>
<div>
<p className="panel-kicker">{activeSection.label}</p>
<h2 id="panel-title">A clear place to begin</h2>
<p>{activeSection.description}</p>
</div>
</section>
<p className="shell-note">Your workout data will stay on this device when local storage is added.</p>
</main>
</Container>
</div>
)
}
+15
View File
@@ -0,0 +1,15 @@
import { fireEvent, render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
import App from './App.jsx'
describe('application shell', () => {
it('shows the Today section and changes sections without workout behavior', () => {
render(<App />)
expect(screen.getByRole('heading', { level: 1, name: 'Your workout, at a glance' })).toBeTruthy()
const week = screen.getByRole('button', { name: 'Week' })
fireEvent.click(week)
expect(screen.getByRole('heading', { level: 1, name: 'The week ahead' })).toBeTruthy()
expect(week.getAttribute('aria-current')).toBe('page')
expect(screen.getByRole('main')).toBeTruthy()
})
})
+11
View File
@@ -0,0 +1,11 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import 'bootstrap/dist/css/bootstrap.min.css'
import './styles.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
+29
View File
@@ -0,0 +1,29 @@
:root { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #202923; background: #f4f1ea; }
body { min-width: 320px; margin: 0; }
button { font: inherit; }
.app-shell { min-height: 100vh; background: #f4f1ea; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 10; padding: .6rem 1rem; background: #fff; color: #173d32; }
.skip-link:focus { top: .5rem; }
.site-header { min-height: 76px; background: #173d32; color: #fff; }
.header-inner { display: flex; justify-content: space-between; gap: 1rem; }
.brand, .brand:hover, .brand:focus { display: inline-flex; align-items: center; gap: .75rem; color: #fff; font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: #d6ec77; color: #173d32; font-weight: 800; }
.header-note { color: #d0e3db; font-size: .875rem; }
.page-content { padding-top: clamp(2rem, 5vw, 4rem); padding-bottom: 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; }
.eyebrow, .panel-kicker { color: #476656; font-size: .73rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 16ch; margin: .25rem 0 .7rem; font-size: clamp(2.2rem, 5vw, 3.75rem); line-height: 1.08; letter-spacing: -.045em; }
.intro { margin: 0; color: #5b685f; font-size: 1.08rem; }
.local-badge { flex: 0 0 auto; margin-bottom: .25rem; padding: .45rem .75rem; border: 1px solid #bbccc0; border-radius: 999px; color: #315847; font-size: .8rem; font-weight: 600; }
.section-nav { display: flex; flex-wrap: wrap; gap: .2rem; margin: 2.5rem 0 1.25rem; padding-bottom: .55rem; border-bottom: 1px solid #d4dcd4; }
.section-link.btn { min-height: 44px; padding: .55rem 1rem; border-radius: 8px; color: #445e50; font-weight: 650; text-decoration: none; }
.section-link.btn:hover { background: #e6ebe2; color: #173d32; }
.section-link.btn[aria-current="page"] { background: #173d32; color: #fff; }
.section-link.btn:focus-visible, .brand:focus-visible { outline: 3px solid #9fc45c; outline-offset: 3px; }
.content-panel { display: flex; align-items: flex-start; gap: 1.5rem; min-height: 280px; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid #e0e5dd; border-radius: 20px; background: #fff; box-shadow: 0 14px 36px rgba(22, 54, 43, .045); }
.panel-icon { display: grid; flex: 0 0 56px; width: 56px; height: 56px; place-items: center; border-radius: 16px; background: #e8efd9; color: #315847; font-size: 2rem; line-height: 1; }
.content-panel h2 { margin: .4rem 0 .7rem; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.03em; }
.content-panel p:last-child { max-width: 48ch; color: #5b685f; line-height: 1.6; }
.shell-note { margin: 1rem 0; color: #627067; font-size: .875rem; }
@media (max-width: 575px) { .site-header { min-height: 68px; } .header-note, .local-badge { display: none; } .page-heading { display: block; } .section-nav { flex-wrap: wrap; margin-top: 2rem; } .section-link.btn { white-space: nowrap; padding-inline: .75rem; } .content-panel { gap: 1rem; min-height: 240px; border-radius: 16px; } .panel-icon { flex-basis: 42px; width: 42px; height: 42px; font-size: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }