From 860c00eb99d5027f7b230e5e7c6ab32def0b0af7 Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 6 May 2026 19:28:16 +0200 Subject: [PATCH] =?UTF-8?q?UX:=20Pro-Chips=20bei=20Standard-User=20mit=201?= =?UTF-8?q?0%=20Opazit=C3=A4t=20statt=20ausgeblendet=20(SW=20by-v740)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 2 +- backend/static/index.html | 2 +- backend/static/js/app.js | 2 +- backend/static/js/worlds.js | 37 +++++++++++++++++++------------------ backend/static/sw.js | 2 +- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/backend/main.py b/backend/main.py index d1a40f8..89c5ef1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -327,7 +327,7 @@ MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media") os.makedirs(MEDIA_DIR, exist_ok=True) app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media") -APP_VER = "739" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "740" # muss mit APP_VER in app.js übereinstimmen @app.get("/api/version") async def app_version(): diff --git a/backend/static/index.html b/backend/static/index.html index bf0c68e..619edc4 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -578,7 +578,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 0daec2b..74f2440 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '739'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '740'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.4.0'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; diff --git a/backend/static/js/worlds.js b/backend/static/js/worlds.js index 8232c20..70a5056 100644 --- a/backend/static/js/worlds.js +++ b/backend/static/js/worlds.js @@ -569,19 +569,7 @@ window.Worlds = (() => { const u = _state?.user; const tier = u?.subscription_tier || 'standard'; const isTest = tier.endsWith('_test'); - - // Pro-Check — _test-Tiers ignorieren Admin-Override - if (chip.pro) { - if (!u) return false; - if (isTest) { - if (!['pro_test','breeder_test'].includes(tier)) return false; - } else { - if (u.rolle === 'admin' || u.rolle === 'moderator') {} // erlaubt - else if (u.is_moderator || u.is_social_media) {} // erlaubt - else if (!['pro','breeder'].includes(tier)) return false; - } - } - // Role-Checks — admin-Chip immer über echte Rolle, breeder respektiert _test + // Role-Checks (hart — komplett ausblenden) if (!chip?.role) return true; if (chip.role === 'breeder') { if (isTest) return tier === 'breeder_test'; @@ -589,9 +577,21 @@ window.Worlds = (() => { } if (chip.role === 'social') return u?.is_social_media || u?.rolle === 'admin'; if (chip.role === 'mod') return u?.rolle === 'admin' || u?.rolle === 'moderator' || u?.is_moderator; - if (chip.role === 'admin') return u?.rolle === 'admin'; // immer echte Rolle + if (chip.role === 'admin') return u?.rolle === 'admin'; return true; } + + // Gibt true zurück wenn User vollen Pro-Zugriff hat + function _hasProAccess() { + const u = _state?.user; + if (!u) return false; + const tier = u.subscription_tier || 'standard'; + if (tier.endsWith('_test')) return ['pro_test','breeder_test'].includes(tier); + if (u.rolle === 'admin' || u.rolle === 'moderator') return true; + if (u.is_moderator || u.is_social_media) return true; + return ['pro','breeder'].includes(tier); + } + function _chipsForWorld(world) { const pages = _getConfig()[world] || _DEFAULT_CONFIG[world]; return pages.map(_chipMeta).filter(c => c && _chipAllowed(c)); @@ -887,9 +887,10 @@ window.Worlds = (() => { // ── CHIP-HELPER ────────────────────────────────────────────── - function _chip(icon, label, page) { + function _chip(icon, label, page, locked = false) { + const style = locked ? 'opacity:0.12;cursor:default;' : ''; return ` -
+
@@ -1258,7 +1259,7 @@ window.Worlds = (() => { ` : ''}
- ${chips.map(c => _chip(c.icon, c.label, c.page)).join('')} + ${chips.map(c => _chip(c.icon, c.label, c.page, !!(c.pro && !_hasProAccess()))).join('')}