Update Version and Enhance Club Creation Request Management
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 39s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m20s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 39s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m20s
- Incremented application version to 0.8.192 and database schema version to 20260606081. - Updated club module versions for 'clubs' and 'club_creation_requests' to reflect recent changes. - Implemented logic to mark approved club creation requests as 'superseded' when the associated club is deleted. - Refactored frontend components to clear session storage for coach-related keys upon logout and during login checks. - Enhanced onboarding page to accurately display the status of club creation requests based on their validity.
This commit is contained in:
1 parent
37785135b1
commit
fa10450315
9 files changed
+71
-13
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
} from 'react'
|
||||
import api, { ACTIVE_CLUB_STORAGE_KEY } from '../utils/api'
|
||||
import { activeClubMemberships } from '../utils/activeClub'
|
||||
import { clearCoachSessionStorage } from '../utils/trainingPlanUtils'
|
||||
|
||||
const AuthContext = createContext(null)
|
||||
|
||||
@@ -131,11 +132,7 @@ export function AuthProvider({ children }) {
|
||||
setUser(null)
|
||||
localStorage.removeItem('authToken')
|
||||
localStorage.removeItem(ACTIVE_CLUB_STORAGE_KEY)
|
||||
for (const key of Object.keys(sessionStorage)) {
|
||||
if (key.startsWith('sj_coach_')) {
|
||||
sessionStorage.removeItem(key)
|
||||
}
|
||||
}
|
||||
clearCoachSessionStorage()
|
||||
}, [])
|
||||
|
||||
const value = useMemo(
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
|
||||
import { useNavigate, Link } from 'react-router-dom'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import api from '../utils/api'
|
||||
import { clearCoachSessionStorage } from '../utils/trainingPlanUtils'
|
||||
|
||||
function LoginPage() {
|
||||
const [mode, setMode] = useState('login') // 'login' or 'register'
|
||||
@@ -18,6 +19,12 @@ function LoginPage() {
|
||||
const navigate = useNavigate()
|
||||
const { checkAuth } = useAuth()
|
||||
|
||||
useEffect(() => {
|
||||
if (!localStorage.getItem('authToken')) {
|
||||
clearCoachSessionStorage()
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (mode !== 'register') return
|
||||
api.listPublicClubsDirectory().then(setPublicClubs).catch(() => setPublicClubs([]))
|
||||
|
||||
@@ -19,8 +19,14 @@ const creationStatusLabel = (s) =>
|
||||
approved: 'freigegeben',
|
||||
rejected: 'abgelehnt',
|
||||
withdrawn: 'zurückgezogen',
|
||||
superseded: 'Verein entfernt',
|
||||
})[s] || s
|
||||
|
||||
/** Freigabe noch gültig (Verein existiert). */
|
||||
function isActiveApprovedCreation(req) {
|
||||
return req.status === 'approved' && req.created_club_id
|
||||
}
|
||||
|
||||
/**
|
||||
* Onboarding für Nutzer ohne aktive Vereinsmitgliedschaft (Phase A).
|
||||
*/
|
||||
@@ -264,7 +270,7 @@ export default function OnboardingPage() {
|
||||
{myCreationRequests.map((r) => (
|
||||
<li key={r.id} style={{ marginBottom: '0.35rem' }}>
|
||||
{r.proposed_name} — {creationStatusLabel(r.status)}
|
||||
{r.status === 'approved' && r.created_club_name
|
||||
{isActiveApprovedCreation(r) && r.created_club_name
|
||||
? ` (${r.created_club_name})`
|
||||
: null}
|
||||
{r.status === 'pending' ? (
|
||||
@@ -288,7 +294,7 @@ export default function OnboardingPage() {
|
||||
</button>
|
||||
</>
|
||||
) : null}
|
||||
{r.status === 'approved' ? (
|
||||
{isActiveApprovedCreation(r) ? (
|
||||
<>
|
||||
{' '}
|
||||
<button
|
||||
|
||||
@@ -283,6 +283,17 @@ export function coachBranchPicksStorageKey(unitId) {
|
||||
return `sj_coach_branches_${unitId}`
|
||||
}
|
||||
|
||||
/** Coach-Sitzung (P-12): alle sj_coach_*-Keys aus sessionStorage entfernen. */
|
||||
export function clearCoachSessionStorage() {
|
||||
if (typeof sessionStorage === 'undefined') return
|
||||
for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {
|
||||
const k = sessionStorage.key(i)
|
||||
if (k && k.startsWith('sj_coach_')) {
|
||||
sessionStorage.removeItem(k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Index zum Springen: Co-Trainer-Link atBranch+preferSo — Gate falls noch offen, sonst erste Kachel im Stream.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user