2026-04-21 14:56:16 +02:00
|
|
|
import React from 'react'
|
2026-04-22 16:25:36 +02:00
|
|
|
import { BrowserRouter as Router, Routes, Route, Navigate, NavLink, useLocation } from 'react-router-dom'
|
2026-04-21 14:56:16 +02:00
|
|
|
import { AuthProvider, useAuth } from './context/AuthContext'
|
2026-04-22 16:25:36 +02:00
|
|
|
import DesktopSidebar from './components/DesktopSidebar'
|
|
|
|
|
import { getMainNavItems } from './config/appNav'
|
2026-04-21 14:56:16 +02:00
|
|
|
import LoginPage from './pages/LoginPage'
|
|
|
|
|
import Dashboard from './pages/Dashboard'
|
2026-04-22 06:48:18 +02:00
|
|
|
import ProfilePage from './pages/ProfilePage'
|
|
|
|
|
import ExercisesPage from './pages/ExercisesPage'
|
|
|
|
|
import ClubsPage from './pages/ClubsPage'
|
feat: Skills & Methods catalog complete
Backend:
- Created routers/skills.py with full CRUD
- Skills: list (with category filter), get, create, update, delete
- Methods: list (with category filter), get, create, update, delete
- Default: only show active items
- Read access: all authenticated users
- Write access: admin only
- Registered skills router in main.py
Frontend:
- Complete SkillsPage with 2 tabs (Fähigkeiten, Trainingsmethoden)
- Browse by category with cards layout
- Admin CRUD forms (importance rating for skills, duration/group size for methods)
- Mobile-responsive grid layout
- Updated api.js with all skill/method functions
- Added /skills route to App.jsx
Migration already exists: 003_catalogs.sql (skills, training_methods + seed data)
Next: Training Planning (core feature)
2026-04-22 16:50:31 +02:00
|
|
|
import SkillsPage from './pages/SkillsPage'
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
import TrainingPlanningPage from './pages/TrainingPlanningPage'
|
2026-04-23 07:52:03 +02:00
|
|
|
import AdminCatalogsPage from './pages/AdminCatalogsPage'
|
2026-04-23 14:26:10 +02:00
|
|
|
import TrainerContextsPage from './pages/TrainerContextsPage'
|
2026-04-22 16:25:36 +02:00
|
|
|
import './app.css'
|
|
|
|
|
|
|
|
|
|
// Bottom Navigation (Mobile)
|
|
|
|
|
function Nav({ isAdmin }) {
|
|
|
|
|
const items = getMainNavItems(isAdmin)
|
|
|
|
|
const loc = useLocation()
|
|
|
|
|
|
|
|
|
|
const navItemActive = (pathname, item, routerIsActive) => {
|
|
|
|
|
if (item.to.startsWith('/admin')) return pathname.startsWith('/admin')
|
|
|
|
|
return routerIsActive
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<nav className="bottom-nav">
|
|
|
|
|
{items.map((item) => (
|
|
|
|
|
<NavLink
|
|
|
|
|
key={item.to}
|
|
|
|
|
to={item.to}
|
|
|
|
|
end={!!item.end}
|
|
|
|
|
className={({ isActive }) =>
|
|
|
|
|
'nav-item' +
|
|
|
|
|
(navItemActive(loc.pathname, item, isActive) ? ' active' : '')
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<item.Icon size={20} strokeWidth={2} />
|
|
|
|
|
<span>{item.shortLabel || item.label}</span>
|
|
|
|
|
</NavLink>
|
|
|
|
|
))}
|
|
|
|
|
</nav>
|
|
|
|
|
)
|
|
|
|
|
}
|
feat: Complete MVP setup - Docker, Frontend, Migrations, CI/CD
Docker & Deployment:
- docker-compose.yml (Prod: Port 3003/8003)
- docker-compose.dev-env.yml (Dev: Port 3098/8098)
- Backend Dockerfile (Python 3.12-slim)
- Frontend Dockerfile (Node 20 + Nginx)
- Gitea Actions (deploy-dev.yml, deploy-prod.yml)
Frontend:
- React 18 + Vite setup
- package.json, vite.config.js, index.html
- App.jsx (minimal with version display)
- api.js (complete API client)
- app.css + AuthContext from Mitai
- main.jsx entry point
Backend Migrations:
- 001_auth_membership.sql (Auth + Features + Tier Limits)
- 002_organization.sql (Clubs, Divisions, Training Groups)
- 003_catalogs.sql (Skills + Methods with sample data)
Documentation:
- .claude/rules/ (ARCHITECTURE, CODING_RULES, etc.)
- SHINKAN_PROJECT_SETUP.md (technical setup guide)
Server:
- Directories created on Pi: /home/lars/docker/shinkan[-dev]
- Gitea Runner configured and running
Ready for first deployment to dev.shinkan.jinkendo.de
version: 0.1.0
date: 2026-04-21
2026-04-21 14:36:52 +02:00
|
|
|
|
2026-04-21 14:56:16 +02:00
|
|
|
// Protected Route Component
|
|
|
|
|
function ProtectedRoute({ children }) {
|
2026-04-22 16:25:36 +02:00
|
|
|
const { isAuthenticated, loading, user, logout } = useAuth()
|
|
|
|
|
|
|
|
|
|
const handleLogout = () => {
|
|
|
|
|
if (confirm('Wirklich abmelden?')) {
|
|
|
|
|
logout()
|
|
|
|
|
window.location.href = '/'
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-21 14:56:16 +02:00
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div style={{
|
|
|
|
|
minHeight: '100vh',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
background: 'var(--bg)'
|
|
|
|
|
}}>
|
|
|
|
|
<div className="spinner"></div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-22 16:25:36 +02:00
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return <Navigate to="/login" replace />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isAdmin = user?.role === 'admin' || user?.role === 'superadmin'
|
|
|
|
|
|
|
|
|
|
return (
|
2026-04-22 06:48:18 +02:00
|
|
|
<>
|
2026-04-22 16:25:36 +02:00
|
|
|
<DesktopSidebar
|
|
|
|
|
isAdmin={isAdmin}
|
|
|
|
|
user={user}
|
|
|
|
|
onLogout={handleLogout}
|
|
|
|
|
/>
|
|
|
|
|
<div className="app-shell">
|
|
|
|
|
<div className="app-shell__column">
|
|
|
|
|
<div className="app-header app-header--mobile">
|
|
|
|
|
<div className="app-logo">🥋 Shinkan</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="app-main">{children}</div>
|
|
|
|
|
<Nav isAdmin={isAdmin} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-04-22 06:48:18 +02:00
|
|
|
</>
|
2026-04-22 16:25:36 +02:00
|
|
|
)
|
2026-04-21 14:56:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Public Route Component (redirect to dashboard if already logged in)
|
|
|
|
|
function PublicRoute({ children }) {
|
|
|
|
|
const { isAuthenticated, loading } = useAuth()
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div style={{
|
|
|
|
|
minHeight: '100vh',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
background: 'var(--bg)'
|
|
|
|
|
}}>
|
|
|
|
|
<div className="spinner"></div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return !isAuthenticated ? children : <Navigate to="/" replace />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AppRoutes() {
|
|
|
|
|
return (
|
|
|
|
|
<Routes>
|
|
|
|
|
{/* Public Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/login"
|
|
|
|
|
element={
|
|
|
|
|
<PublicRoute>
|
|
|
|
|
<LoginPage />
|
|
|
|
|
</PublicRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: Complete MVP setup - Docker, Frontend, Migrations, CI/CD
Docker & Deployment:
- docker-compose.yml (Prod: Port 3003/8003)
- docker-compose.dev-env.yml (Dev: Port 3098/8098)
- Backend Dockerfile (Python 3.12-slim)
- Frontend Dockerfile (Node 20 + Nginx)
- Gitea Actions (deploy-dev.yml, deploy-prod.yml)
Frontend:
- React 18 + Vite setup
- package.json, vite.config.js, index.html
- App.jsx (minimal with version display)
- api.js (complete API client)
- app.css + AuthContext from Mitai
- main.jsx entry point
Backend Migrations:
- 001_auth_membership.sql (Auth + Features + Tier Limits)
- 002_organization.sql (Clubs, Divisions, Training Groups)
- 003_catalogs.sql (Skills + Methods with sample data)
Documentation:
- .claude/rules/ (ARCHITECTURE, CODING_RULES, etc.)
- SHINKAN_PROJECT_SETUP.md (technical setup guide)
Server:
- Directories created on Pi: /home/lars/docker/shinkan[-dev]
- Gitea Runner configured and running
Ready for first deployment to dev.shinkan.jinkendo.de
version: 0.1.0
date: 2026-04-21
2026-04-21 14:36:52 +02:00
|
|
|
|
2026-04-21 14:56:16 +02:00
|
|
|
{/* Protected Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<Dashboard />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2026-04-22 06:48:18 +02:00
|
|
|
<Route
|
|
|
|
|
path="/profile"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ProfilePage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/exercises"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ExercisesPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/clubs"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ClubsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: Skills & Methods catalog complete
Backend:
- Created routers/skills.py with full CRUD
- Skills: list (with category filter), get, create, update, delete
- Methods: list (with category filter), get, create, update, delete
- Default: only show active items
- Read access: all authenticated users
- Write access: admin only
- Registered skills router in main.py
Frontend:
- Complete SkillsPage with 2 tabs (Fähigkeiten, Trainingsmethoden)
- Browse by category with cards layout
- Admin CRUD forms (importance rating for skills, duration/group size for methods)
- Mobile-responsive grid layout
- Updated api.js with all skill/method functions
- Added /skills route to App.jsx
Migration already exists: 003_catalogs.sql (skills, training_methods + seed data)
Next: Training Planning (core feature)
2026-04-22 16:50:31 +02:00
|
|
|
<Route
|
|
|
|
|
path="/skills"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<SkillsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<Route
|
|
|
|
|
path="/planning"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<TrainingPlanningPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2026-04-23 09:00:28 +02:00
|
|
|
<Route
|
|
|
|
|
path="/admin"
|
|
|
|
|
element={<Navigate to="/admin/catalogs" replace />}
|
|
|
|
|
/>
|
2026-04-23 07:52:03 +02:00
|
|
|
<Route
|
|
|
|
|
path="/admin/catalogs"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<AdminCatalogsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2026-04-23 14:26:10 +02:00
|
|
|
<Route
|
|
|
|
|
path="/trainer-contexts"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<TrainerContextsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: Complete MVP setup - Docker, Frontend, Migrations, CI/CD
Docker & Deployment:
- docker-compose.yml (Prod: Port 3003/8003)
- docker-compose.dev-env.yml (Dev: Port 3098/8098)
- Backend Dockerfile (Python 3.12-slim)
- Frontend Dockerfile (Node 20 + Nginx)
- Gitea Actions (deploy-dev.yml, deploy-prod.yml)
Frontend:
- React 18 + Vite setup
- package.json, vite.config.js, index.html
- App.jsx (minimal with version display)
- api.js (complete API client)
- app.css + AuthContext from Mitai
- main.jsx entry point
Backend Migrations:
- 001_auth_membership.sql (Auth + Features + Tier Limits)
- 002_organization.sql (Clubs, Divisions, Training Groups)
- 003_catalogs.sql (Skills + Methods with sample data)
Documentation:
- .claude/rules/ (ARCHITECTURE, CODING_RULES, etc.)
- SHINKAN_PROJECT_SETUP.md (technical setup guide)
Server:
- Directories created on Pi: /home/lars/docker/shinkan[-dev]
- Gitea Runner configured and running
Ready for first deployment to dev.shinkan.jinkendo.de
version: 0.1.0
date: 2026-04-21
2026-04-21 14:36:52 +02:00
|
|
|
|
2026-04-21 14:56:16 +02:00
|
|
|
{/* Catch all - redirect to dashboard or login */}
|
|
|
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
|
|
|
</Routes>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function App() {
|
feat: Complete MVP setup - Docker, Frontend, Migrations, CI/CD
Docker & Deployment:
- docker-compose.yml (Prod: Port 3003/8003)
- docker-compose.dev-env.yml (Dev: Port 3098/8098)
- Backend Dockerfile (Python 3.12-slim)
- Frontend Dockerfile (Node 20 + Nginx)
- Gitea Actions (deploy-dev.yml, deploy-prod.yml)
Frontend:
- React 18 + Vite setup
- package.json, vite.config.js, index.html
- App.jsx (minimal with version display)
- api.js (complete API client)
- app.css + AuthContext from Mitai
- main.jsx entry point
Backend Migrations:
- 001_auth_membership.sql (Auth + Features + Tier Limits)
- 002_organization.sql (Clubs, Divisions, Training Groups)
- 003_catalogs.sql (Skills + Methods with sample data)
Documentation:
- .claude/rules/ (ARCHITECTURE, CODING_RULES, etc.)
- SHINKAN_PROJECT_SETUP.md (technical setup guide)
Server:
- Directories created on Pi: /home/lars/docker/shinkan[-dev]
- Gitea Runner configured and running
Ready for first deployment to dev.shinkan.jinkendo.de
version: 0.1.0
date: 2026-04-21
2026-04-21 14:36:52 +02:00
|
|
|
return (
|
|
|
|
|
<AuthProvider>
|
|
|
|
|
<Router>
|
2026-04-21 14:56:16 +02:00
|
|
|
<AppRoutes />
|
feat: Complete MVP setup - Docker, Frontend, Migrations, CI/CD
Docker & Deployment:
- docker-compose.yml (Prod: Port 3003/8003)
- docker-compose.dev-env.yml (Dev: Port 3098/8098)
- Backend Dockerfile (Python 3.12-slim)
- Frontend Dockerfile (Node 20 + Nginx)
- Gitea Actions (deploy-dev.yml, deploy-prod.yml)
Frontend:
- React 18 + Vite setup
- package.json, vite.config.js, index.html
- App.jsx (minimal with version display)
- api.js (complete API client)
- app.css + AuthContext from Mitai
- main.jsx entry point
Backend Migrations:
- 001_auth_membership.sql (Auth + Features + Tier Limits)
- 002_organization.sql (Clubs, Divisions, Training Groups)
- 003_catalogs.sql (Skills + Methods with sample data)
Documentation:
- .claude/rules/ (ARCHITECTURE, CODING_RULES, etc.)
- SHINKAN_PROJECT_SETUP.md (technical setup guide)
Server:
- Directories created on Pi: /home/lars/docker/shinkan[-dev]
- Gitea Runner configured and running
Ready for first deployment to dev.shinkan.jinkendo.de
version: 0.1.0
date: 2026-04-21
2026-04-21 14:36:52 +02:00
|
|
|
</Router>
|
|
|
|
|
</AuthProvider>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default App
|