|
|
|
@ -10,6 +10,8 @@
|
|
|
|
$: myDecksActive = loc === '/' || loc === '/decks/new' || /^\/decks\/[^/]+\/edit$/.test(loc) || $navContext === 'my-decks';
|
|
|
|
$: myDecksActive = loc === '/' || loc === '/decks/new' || /^\/decks\/[^/]+\/edit$/.test(loc) || $navContext === 'my-decks';
|
|
|
|
$: communityActive = loc === '/community' || loc.startsWith('/community/') || $navContext === 'community';
|
|
|
|
$: communityActive = loc === '/community' || loc.startsWith('/community/') || $navContext === 'community';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const registrationDisabled = import.meta.env.VITE_DISABLE_REGISTRATION === 'true';
|
|
|
|
|
|
|
|
|
|
|
|
let showPopup = false;
|
|
|
|
let showPopup = false;
|
|
|
|
let mode = 'login'; // 'login' | 'register'
|
|
|
|
let mode = 'login'; // 'login' | 'register'
|
|
|
|
let email = '';
|
|
|
|
let email = '';
|
|
|
|
@ -206,14 +208,16 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
Log in
|
|
|
|
Log in
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
{#if !registrationDisabled}
|
|
|
|
type="button"
|
|
|
|
<button
|
|
|
|
class="tab"
|
|
|
|
type="button"
|
|
|
|
class:active={mode === 'register'}
|
|
|
|
class="tab"
|
|
|
|
onclick={() => { mode = 'register'; auth.clearError(); registerSuccess = false; }}
|
|
|
|
class:active={mode === 'register'}
|
|
|
|
>
|
|
|
|
onclick={() => { mode = 'register'; auth.clearError(); registerSuccess = false; }}
|
|
|
|
Register
|
|
|
|
>
|
|
|
|
</button>
|
|
|
|
Register
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{#if registerSuccess && !$auth.user}
|
|
|
|
{#if registerSuccess && !$auth.user}
|
|
|
|
@ -250,7 +254,7 @@
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
{#if $auth.error}
|
|
|
|
{#if $auth.error}
|
|
|
|
<p class="auth-error">{$auth.error}</p>
|
|
|
|
<p class="auth-error">{$auth.error}</p>
|
|
|
|
{#if mode === 'login'}
|
|
|
|
{#if mode === 'login' && !registrationDisabled}
|
|
|
|
<p class="auth-switch">
|
|
|
|
<p class="auth-switch">
|
|
|
|
Do you have an account? <button type="button" class="auth-link" onclick={() => { mode = 'register'; auth.clearError(); }}>Register here</button>.
|
|
|
|
Do you have an account? <button type="button" class="auth-link" onclick={() => { mode = 'register'; auth.clearError(); }}>Register here</button>.
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
|