Add payment launch mode flag

This commit is contained in:
fightme-cmd
2026-07-05 12:48:27 +02:00
parent 28e8ade05f
commit 49dc1de769
3 changed files with 27 additions and 4 deletions
+6 -4
View File
@@ -233,6 +233,7 @@ const TABS = [
const FREE_LEVEL_IDS = new Set([1, 2, 3, 4, 8, 9, 10, 18]);
const CORE_ARTICLE_CASES = ['nominative', 'accusative', 'dative'];
const PAYMENTS_ENABLED = String(import.meta.env.VITE_PAYMENTS_ENABLED || 'false').toLowerCase() === 'true';
const STRIPE_PLANS = [
{
id:'weekly',
@@ -662,8 +663,9 @@ export default function App() {
await Storage.set(s);
},[]);
const hasAccess = !!access?.paid;
const gated = id => !hasAccess && !FREE_LEVEL_IDS.has(id);
const hasPaidAccess = !!access?.paid;
const hasAccess = !PAYMENTS_ENABLED || hasPaidAccess;
const gated = id => PAYMENTS_ENABLED && !hasPaidAccess && !FREE_LEVEL_IDS.has(id);
const unlocked = (id) => {
return !gated(id);
@@ -769,7 +771,7 @@ export default function App() {
: <div style={S.logo}>Beug</div>}
<div style={{display:'flex',gap:14,alignItems:'center'}}>
{scr === 'practice' && <button style={S.linkBtn} onClick={()=>setChart(true)}>charts</button>}
{hasAccess && <span style={S.stat}>Unlocked</span>}
{PAYMENTS_ENABLED && hasPaidAccess && <span style={S.stat}>Unlocked</span>}
<span style={S.stat}>🔥 {st.streak||0}</span>
</div>
</div>
@@ -831,7 +833,7 @@ export default function App() {
)}
{/* PAYWALL */}
{scr === 'paywall' && (
{PAYMENTS_ENABLED && scr === 'paywall' && (
<PaywallScreen
message={payMsg}
onCheckout={openCheckout}