Mandantenfähigkeit V1 #10
|
|
@ -31,6 +31,7 @@ import AdminMaturityModelsPage from './pages/AdminMaturityModelsPage'
|
||||||
import TrainerContextsPage from './pages/TrainerContextsPage'
|
import TrainerContextsPage from './pages/TrainerContextsPage'
|
||||||
import MediaWikiImportPage from './pages/MediaWikiImportPage'
|
import MediaWikiImportPage from './pages/MediaWikiImportPage'
|
||||||
import AdminUsersPage from './pages/AdminUsersPage'
|
import AdminUsersPage from './pages/AdminUsersPage'
|
||||||
|
import ActiveClubSwitcher from './components/ActiveClubSwitcher'
|
||||||
import './app.css'
|
import './app.css'
|
||||||
|
|
||||||
// Bottom Navigation (Mobile)
|
// Bottom Navigation (Mobile)
|
||||||
|
|
@ -99,8 +100,11 @@ function ProtectedLayout() {
|
||||||
<DesktopSidebar isAdmin={isAdmin} user={user} onLogout={handleLogout} />
|
<DesktopSidebar isAdmin={isAdmin} user={user} onLogout={handleLogout} />
|
||||||
<div className="app-shell">
|
<div className="app-shell">
|
||||||
<div className="app-shell__column">
|
<div className="app-shell__column">
|
||||||
<div className="app-header app-header--mobile">
|
<div className="app-header app-header--mobile app-header--mobile-stack">
|
||||||
<div className="app-logo">🥋 Shinkan</div>
|
<div className="app-header-mobile__top">
|
||||||
|
<div className="app-logo">🥋 Shinkan</div>
|
||||||
|
</div>
|
||||||
|
<ActiveClubSwitcher variant="mobile" />
|
||||||
</div>
|
</div>
|
||||||
<div className="app-main">
|
<div className="app-main">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,42 @@ body { font-family: var(--font); background: var(--bg); color: var(--text1); -we
|
||||||
padding-right: max(16px, env(safe-area-inset-right, 0px));
|
padding-right: max(16px, env(safe-area-inset-right, 0px));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.app-header--mobile-stack {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
.app-header-mobile__top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: var(--header-h);
|
||||||
|
}
|
||||||
.app-logo { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
|
.app-logo { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
|
||||||
|
|
||||||
|
.active-club-switch {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.35rem;
|
||||||
|
}
|
||||||
|
.active-club-switch__label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text2);
|
||||||
|
}
|
||||||
|
.active-club-switch__select {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
padding: 0.4rem 0.5rem;
|
||||||
|
}
|
||||||
|
.active-club-switch--sidebar {
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
.active-club-switch--mobile {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
/* === Seiten-Inhalt: volle Breite der Spalte, kein künstlicher Max-Wert auf großen Screens === */
|
/* === Seiten-Inhalt: volle Breite der Spalte, kein künstlicher Max-Wert auf großen Screens === */
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -2198,7 +2232,14 @@ a.analysis-split__nav-item {
|
||||||
|
|
||||||
.desktop-sidebar__footer {
|
.desktop-sidebar__footer {
|
||||||
border-top: 1px solid var(--border);
|
border-top: 1px solid var(--border);
|
||||||
padding: 16px 12px 0;
|
padding: 16px 12px 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__footer-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
|
||||||
44
frontend/src/components/ActiveClubSwitcher.jsx
Normal file
44
frontend/src/components/ActiveClubSwitcher.jsx
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { useAuth } from '../context/AuthContext'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeigt einen Vereins-Umschalter, wenn der Nutzer mehreren Vereinen zugeordnet ist.
|
||||||
|
* Steuert den Mandanten-Kontext (Header X-Active-Club-Id + Profilfeld active_club_id).
|
||||||
|
*/
|
||||||
|
export default function ActiveClubSwitcher({ variant = 'sidebar' }) {
|
||||||
|
const { user, setActiveClub } = useAuth()
|
||||||
|
const clubs = user?.clubs || []
|
||||||
|
if (clubs.length <= 1) return null
|
||||||
|
|
||||||
|
const selectClubId =
|
||||||
|
user?.active_club_id != null && clubs.some((c) => c.id === user.active_club_id)
|
||||||
|
? user.active_club_id
|
||||||
|
: clubs[0]?.id
|
||||||
|
|
||||||
|
const isMobile = variant === 'mobile'
|
||||||
|
|
||||||
|
return (
|
||||||
|
<label
|
||||||
|
className={
|
||||||
|
'active-club-switch' +
|
||||||
|
(isMobile ? ' active-club-switch--mobile' : ' active-club-switch--sidebar')
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="active-club-switch__label">Aktiver Verein</span>
|
||||||
|
<select
|
||||||
|
className="form-input active-club-switch__select"
|
||||||
|
aria-label="Aktiven Verein wählen"
|
||||||
|
value={selectClubId ?? ''}
|
||||||
|
onChange={(e) => {
|
||||||
|
const v = e.target.value
|
||||||
|
if (v) setActiveClub(Number(v))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{clubs.map((c) => (
|
||||||
|
<option key={c.id} value={c.id}>
|
||||||
|
{c.name || `Verein #${c.id}`}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { NavLink, useLocation } from 'react-router-dom'
|
import { NavLink, useLocation } from 'react-router-dom'
|
||||||
import { LogOut } from 'lucide-react'
|
import { LogOut } from 'lucide-react'
|
||||||
import { getMainNavItems } from '../config/appNav'
|
import { getMainNavItems } from '../config/appNav'
|
||||||
|
import ActiveClubSwitcher from './ActiveClubSwitcher'
|
||||||
|
|
||||||
function sidebarLinkActive(pathname, item, routerIsActive) {
|
function sidebarLinkActive(pathname, item, routerIsActive) {
|
||||||
if (item.to.startsWith('/admin')) return pathname.startsWith('/admin')
|
if (item.to.startsWith('/admin')) return pathname.startsWith('/admin')
|
||||||
|
|
@ -46,40 +47,43 @@ export default function DesktopSidebar({
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div className="desktop-sidebar__footer">
|
<div className="desktop-sidebar__footer">
|
||||||
<div className="desktop-sidebar__user">
|
<ActiveClubSwitcher variant="sidebar" />
|
||||||
<div
|
<div className="desktop-sidebar__footer-row">
|
||||||
style={{
|
<div className="desktop-sidebar__user">
|
||||||
width: 32,
|
<div
|
||||||
height: 32,
|
style={{
|
||||||
borderRadius: '50%',
|
width: 32,
|
||||||
background: 'var(--accent)',
|
height: 32,
|
||||||
display: 'flex',
|
borderRadius: '50%',
|
||||||
alignItems: 'center',
|
background: 'var(--accent)',
|
||||||
justifyContent: 'center',
|
display: 'flex',
|
||||||
color: 'white',
|
alignItems: 'center',
|
||||||
fontWeight: 600,
|
justifyContent: 'center',
|
||||||
fontSize: '14px'
|
color: 'white',
|
||||||
}}
|
fontWeight: 600,
|
||||||
|
fontSize: '14px'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(user?.name || user?.email || '?').trim().slice(0, 1).toUpperCase()}
|
||||||
|
</div>
|
||||||
|
<div className="desktop-sidebar__user-text">
|
||||||
|
<span className="desktop-sidebar__user-name">
|
||||||
|
{user?.name || user?.email || 'User'}
|
||||||
|
</span>
|
||||||
|
{tier ? (
|
||||||
|
<span className="desktop-sidebar__user-tier">{tier}</span>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="desktop-sidebar__logout"
|
||||||
|
onClick={onLogout}
|
||||||
|
title="Abmelden"
|
||||||
>
|
>
|
||||||
{(user?.name || user?.email || '?').trim().slice(0, 1).toUpperCase()}
|
<LogOut size={18} />
|
||||||
</div>
|
</button>
|
||||||
<div className="desktop-sidebar__user-text">
|
|
||||||
<span className="desktop-sidebar__user-name">
|
|
||||||
{user?.name || user?.email || 'User'}
|
|
||||||
</span>
|
|
||||||
{tier ? (
|
|
||||||
<span className="desktop-sidebar__user-tier">{tier}</span>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="desktop-sidebar__logout"
|
|
||||||
onClick={onLogout}
|
|
||||||
title="Abmelden"
|
|
||||||
>
|
|
||||||
<LogOut size={18} />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user