finish new demo
This commit is contained in:
parent
e2b85fe819
commit
30d36a33d5
16 changed files with 318 additions and 94 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { lazy, Suspense, useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
||||
import type { ParseKeys } from 'i18next';
|
||||
import type { ExportState } from './components/map/MapPage';
|
||||
import {
|
||||
getSeoContentPage,
|
||||
|
|
@ -277,6 +278,9 @@ export default function App() {
|
|||
const { startCheckout: startPostAuthCheckout } = useLicense();
|
||||
const [showAuthModal, setShowAuthModal] = useState(false);
|
||||
const [authModalTab, setAuthModalTab] = useState<'login' | 'register'>('login');
|
||||
// Optional context-specific value-prop key for the auth modal (e.g. when a
|
||||
// logged-out user taps Save/Share/Export). Null → the generic value prop.
|
||||
const [authModalValuePropKey, setAuthModalValuePropKey] = useState<ParseKeys | null>(null);
|
||||
const [postAuthIntent, setPostAuthIntent] = useState<PostAuthIntent | null>(null);
|
||||
const postAuthCheckoutReturnPathRef = useRef<string | null>(null);
|
||||
const authCompletedRef = useRef(false);
|
||||
|
|
@ -294,13 +298,15 @@ export default function App() {
|
|||
(
|
||||
tab: 'login' | 'register',
|
||||
intent: PostAuthIntent | null = null,
|
||||
checkoutReturnPath?: string
|
||||
checkoutReturnPath?: string,
|
||||
valuePropKey?: ParseKeys | null
|
||||
) => {
|
||||
authCompletedRef.current = false;
|
||||
postAuthCheckoutReturnPathRef.current =
|
||||
intent === 'checkout' ? (checkoutReturnPath ?? currentRelativePath()) : null;
|
||||
setPostAuthIntent(intent);
|
||||
setAuthModalTab(tab);
|
||||
setAuthModalValuePropKey(valuePropKey ?? null);
|
||||
setShowAuthModal(true);
|
||||
clearError();
|
||||
},
|
||||
|
|
@ -648,7 +654,7 @@ export default function App() {
|
|||
onPageChange={navigateTo}
|
||||
theme={theme}
|
||||
onToggleTheme={toggleTheme}
|
||||
exportState={activePage === 'dashboard' && user ? exportState : null}
|
||||
exportState={activePage === 'dashboard' ? exportState : null}
|
||||
dashboardParams={activePage === 'dashboard' ? dashboardParams : ''}
|
||||
dashboardActionsDisabled={activePage === 'dashboard' && !dashboardReady}
|
||||
onSaveSearch={
|
||||
|
|
@ -665,6 +671,9 @@ export default function App() {
|
|||
user={user}
|
||||
onLoginClick={() => openAuthModal('login')}
|
||||
onRegisterClick={() => openAuthModal('register')}
|
||||
onAccountRequired={() =>
|
||||
openAuthModal('register', null, undefined, 'auth.dashboardActionsValueProp')
|
||||
}
|
||||
onLogout={logout}
|
||||
isMobile={isMobile}
|
||||
/>
|
||||
|
|
@ -753,7 +762,6 @@ export default function App() {
|
|||
user={user}
|
||||
onLoginClick={() => openAuthModal('login')}
|
||||
onRegisterClick={() => openAuthModal('register')}
|
||||
onCheckoutLoginClick={(returnPath) => openAuthModal('login', 'checkout', returnPath)}
|
||||
onCheckoutRegisterClick={(returnPath) =>
|
||||
openAuthModal('register', 'checkout', returnPath)
|
||||
}
|
||||
|
|
@ -782,6 +790,7 @@ export default function App() {
|
|||
error={authError}
|
||||
onClearError={clearError}
|
||||
initialTab={authModalTab}
|
||||
valuePropKey={authModalValuePropKey ?? undefined}
|
||||
/>
|
||||
)}
|
||||
{showSaveModal && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue