Enhance Authentication and Feature Usage Handling
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 1m15s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 1m15s
- Refactored the logout function in AuthContext to handle asynchronous logout operations, improving session management. - Updated the FeatureUsageBadge component to display error messages when feature data retrieval fails, enhancing user feedback. - Replaced lazy loading of OnboardingPage with lazyWithRetry for improved loading reliability. - Adjusted the EntitlementsContext to determine club ID using utility functions for better governance form handling.
This commit is contained in:
1 parent
91dae7b614
commit
8718cf5c70
5 files changed
+55
-11
No files matched your search
@@ -5,7 +5,7 @@ import { useEntitlements } from '../context/EntitlementsContext'
|
||||
* Unbegrenzt (limit null) → nichts rendern.
|
||||
*/
|
||||
export default function FeatureUsageBadge({ featureId = 'ai_calls', label = 'KI-Kontingent' }) {
|
||||
const { entitlements, loading, getFeature } = useEntitlements()
|
||||
const { entitlements, loading, error, getFeature } = useEntitlements()
|
||||
const feat = getFeature(featureId)
|
||||
|
||||
if (loading && !feat) {
|
||||
@@ -16,9 +16,23 @@ export default function FeatureUsageBadge({ featureId = 'ai_calls', label = 'KI-
|
||||
)
|
||||
}
|
||||
|
||||
if (!feat) return null
|
||||
if (!feat) {
|
||||
if (error) {
|
||||
return (
|
||||
<span
|
||||
className="feature-usage-badge muted"
|
||||
style={{ fontSize: '0.8rem', color: 'var(--text3)' }}
|
||||
title={error}
|
||||
>
|
||||
{label}: —
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const { used = 0, limit, remaining, allowed } = feat
|
||||
// limit === 0 (z. B. Free-Plan ai_calls) anzeigen; nur echtes Unbegrenzt (null) ausblenden
|
||||
if (limit == null) return null
|
||||
|
||||
const tone = !allowed || remaining === 0 ? 'var(--danger)' : 'var(--text2)'
|
||||
|
||||
Reference in new issue
Block a user