Phase 0a Mandantenfähigkeit
This commit is contained in:
1 parent
0748990328
commit
0c044249d9
15 files changed
+982
-193
No files matched your search
@@ -4,9 +4,13 @@ import { useAuth } from '../context/AuthContext'
|
||||
function Navigation() {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const { user, logout } = useAuth()
|
||||
const { user, logout, setActiveClub } = useAuth()
|
||||
|
||||
const handleLogout = async () => {
|
||||
const clubs = user?.clubs || []
|
||||
const selectClubId =
|
||||
user?.active_club_id != null && clubs.some((c) => c.id === user.active_club_id)
|
||||
? user.active_club_id
|
||||
: clubs[0]?.id const handleLogout = async () => {
|
||||
await logout()
|
||||
navigate('/login')
|
||||
}
|
||||
@@ -84,6 +88,25 @@ function Navigation() {
|
||||
Profil
|
||||
</Link>
|
||||
|
||||
{(clubs?.length ?? 0) > 1 && (
|
||||
<label style={{ display: 'flex', alignItems: 'center', gap: '0.35rem', fontSize: '0.8125rem', color: 'var(--text2)' }}>
|
||||
<span>Verein</span>
|
||||
<select
|
||||
className="form-input"
|
||||
style={{ padding: '0.35rem 0.5rem', minWidth: '9rem', fontSize: '0.8125rem' }}
|
||||
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}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
|
||||
{/* User Menu */}
|
||||
<div style={{
|
||||
borderLeft: '1px solid var(--border)',
|
||||
|
||||
Reference in new issue
Block a user