mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Update Login.tsx
This commit is contained in:
@@ -27,9 +27,6 @@ export default function Login() {
|
|||||||
// Extract referral code from URL
|
// Extract referral code from URL
|
||||||
const referralCode = searchParams.get('ref') || '';
|
const referralCode = searchParams.get('ref') || '';
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState<'telegram' | 'email'>(() =>
|
|
||||||
referralCode ? 'email' : 'telegram',
|
|
||||||
);
|
|
||||||
const [authMode, setAuthMode] = useState<'login' | 'register'>(() =>
|
const [authMode, setAuthMode] = useState<'login' | 'register'>(() =>
|
||||||
referralCode ? 'register' : 'login',
|
referralCode ? 'register' : 'login',
|
||||||
);
|
);
|
||||||
@@ -96,12 +93,6 @@ export default function Login() {
|
|||||||
}
|
}
|
||||||
}, [referralCode, emailAuthConfig, botUsername]);
|
}, [referralCode, emailAuthConfig, botUsername]);
|
||||||
|
|
||||||
// If email auth is disabled but we initially set to email tab, switch back to telegram
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isEmailAuthEnabled && activeTab === 'email') {
|
|
||||||
setActiveTab('telegram');
|
|
||||||
}
|
|
||||||
}, [isEmailAuthEnabled, activeTab]);
|
|
||||||
const appName = branding ? branding.name : import.meta.env.VITE_APP_NAME || 'VPN';
|
const appName = branding ? branding.name : import.meta.env.VITE_APP_NAME || 'VPN';
|
||||||
const appLogo = branding?.logo_letter || import.meta.env.VITE_APP_LOGO || 'V';
|
const appLogo = branding?.logo_letter || import.meta.env.VITE_APP_LOGO || 'V';
|
||||||
const logoUrl = branding ? brandingApi.getLogoUrl(branding) : null;
|
const logoUrl = branding ? brandingApi.getLogoUrl(branding) : null;
|
||||||
@@ -336,43 +327,13 @@ export default function Login() {
|
|||||||
) : (
|
) : (
|
||||||
/* Card */
|
/* Card */
|
||||||
<div className="card">
|
<div className="card">
|
||||||
{/* Tabs */}
|
|
||||||
{isEmailAuthEnabled ? (
|
|
||||||
<div className="mb-6 flex">
|
|
||||||
<button
|
|
||||||
className={`flex-1 border-b-2 py-3 text-sm font-medium transition-all ${
|
|
||||||
activeTab === 'telegram'
|
|
||||||
? 'border-accent-500 text-accent-400'
|
|
||||||
: 'border-transparent text-dark-500 hover:text-dark-300'
|
|
||||||
}`}
|
|
||||||
onClick={() => setActiveTab('telegram')}
|
|
||||||
>
|
|
||||||
Telegram
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`flex-1 border-b-2 py-3 text-sm font-medium transition-all ${
|
|
||||||
activeTab === 'email'
|
|
||||||
? 'border-accent-500 text-accent-400'
|
|
||||||
: 'border-transparent text-dark-500 hover:text-dark-300'
|
|
||||||
}`}
|
|
||||||
onClick={() => setActiveTab('email')}
|
|
||||||
>
|
|
||||||
Email
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="mb-6 border-b border-dark-700 pb-3">
|
|
||||||
<h2 className="text-center text-lg font-medium text-dark-200">Telegram</h2>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="mb-6 rounded-xl border border-error-500/30 bg-error-500/10 px-4 py-3 text-sm text-error-400">
|
<div className="mb-6 rounded-xl border border-error-500/30 bg-error-500/10 px-4 py-3 text-sm text-error-400">
|
||||||
{error}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{activeTab === 'telegram' || !isEmailAuthEnabled ? (
|
{/* Telegram auth section */}
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<p className="text-center text-sm text-dark-400">{t('auth.registerHint')}</p>
|
<p className="text-center text-sm text-dark-400">{t('auth.registerHint')}</p>
|
||||||
|
|
||||||
@@ -385,7 +346,17 @@ export default function Login() {
|
|||||||
<TelegramLoginButton botUsername={botUsername} />
|
<TelegramLoginButton botUsername={botUsername} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
|
||||||
|
{/* Email auth section - only when enabled */}
|
||||||
|
{isEmailAuthEnabled && (
|
||||||
|
<>
|
||||||
|
{/* Divider */}
|
||||||
|
<div className="my-6 flex items-center gap-3">
|
||||||
|
<div className="h-px flex-1 bg-dark-700" />
|
||||||
|
<span className="text-xs text-dark-500">{t('auth.or', 'or')}</span>
|
||||||
|
<div className="h-px flex-1 bg-dark-700" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="space-y-5">
|
<div className="space-y-5">
|
||||||
{/* Login / Register toggle */}
|
{/* Login / Register toggle */}
|
||||||
<div className="flex rounded-lg bg-dark-800 p-1">
|
<div className="flex rounded-lg bg-dark-800 p-1">
|
||||||
@@ -524,6 +495,7 @@ export default function Login() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user