mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
23
index.html
23
index.html
@@ -18,8 +18,29 @@
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
media="print"
|
||||
onload="this.media='all'"
|
||||
/>
|
||||
<script src="https://telegram.org/js/telegram-web-app.js" async></script>
|
||||
<noscript>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</noscript>
|
||||
<script>
|
||||
// Load Telegram Web App script only inside Telegram environment
|
||||
(function() {
|
||||
var isTelegram = window.TelegramWebviewProxy ||
|
||||
location.hash.indexOf('tgWebApp') !== -1 ||
|
||||
location.search.indexOf('tgWebApp') !== -1;
|
||||
if (isTelegram) {
|
||||
var s = document.createElement('script');
|
||||
s.src = 'https://telegram.org/js/telegram-web-app.js';
|
||||
s.async = true;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<style>
|
||||
body {
|
||||
background-color: #0a0f1a;
|
||||
|
||||
@@ -14,7 +14,7 @@ interface TelegramLoginButtonProps {
|
||||
referralCode?: string;
|
||||
}
|
||||
|
||||
const SCRIPT_LOAD_TIMEOUT_MS = 8000;
|
||||
const SCRIPT_LOAD_TIMEOUT_MS = 2000;
|
||||
const DEEPLINK_POLL_INTERVAL_MS = 2500;
|
||||
|
||||
export default function TelegramLoginButton({ referralCode }: TelegramLoginButtonProps) {
|
||||
|
||||
12
src/main.tsx
12
src/main.tsx
@@ -27,11 +27,16 @@ import { getCachedFullscreenEnabled, isTelegramMobile } from './hooks/useTelegra
|
||||
import './i18n';
|
||||
import './styles/globals.css';
|
||||
|
||||
// HMR guard — prevent double init when Vite hot-reloads the module
|
||||
// Only initialize Telegram SDK when running inside Telegram
|
||||
const isTelegramEnv =
|
||||
!!(window as unknown as Record<string, unknown>).TelegramWebviewProxy ||
|
||||
location.hash.includes('tgWebApp') ||
|
||||
location.search.includes('tgWebApp');
|
||||
|
||||
const HMR_KEY = '__tg_sdk_initialized';
|
||||
const alreadyInitialized = (window as unknown as Record<string, unknown>)[HMR_KEY] === true;
|
||||
|
||||
if (!alreadyInitialized) {
|
||||
if (isTelegramEnv && !alreadyInitialized) {
|
||||
(window as unknown as Record<string, unknown>)[HMR_KEY] = true;
|
||||
|
||||
try {
|
||||
@@ -77,6 +82,9 @@ if (!alreadyInitialized) {
|
||||
|
||||
miniAppReady();
|
||||
} catch {}
|
||||
} else if (!isTelegramEnv) {
|
||||
// Outside Telegram — still clear stale session tokens if any
|
||||
clearStaleSessionIfNeeded(null);
|
||||
}
|
||||
|
||||
if ('requestIdleCallback' in window) {
|
||||
|
||||
@@ -232,8 +232,6 @@ export default function AdminUsers() {
|
||||
|
||||
const handleSearch = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setOffset(0);
|
||||
loadUsers();
|
||||
};
|
||||
|
||||
const totalPages = Math.ceil(total / limit);
|
||||
@@ -305,7 +303,10 @@ export default function AdminUsers() {
|
||||
<input
|
||||
type="text"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setSearch(e.target.value);
|
||||
setOffset(0);
|
||||
}}
|
||||
placeholder={t('admin.users.search')}
|
||||
className="w-full rounded-xl border border-dark-700 bg-dark-800 py-2 pl-10 pr-4 text-dark-100 placeholder-dark-500 focus:border-dark-600 focus:outline-none"
|
||||
/>
|
||||
@@ -319,7 +320,10 @@ export default function AdminUsers() {
|
||||
<input
|
||||
type="email"
|
||||
value={emailSearch}
|
||||
onChange={(e) => setEmailSearch(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setEmailSearch(e.target.value);
|
||||
setOffset(0);
|
||||
}}
|
||||
placeholder={t('admin.users.searchEmail')}
|
||||
className="w-full rounded-xl border border-dark-700 bg-dark-800 py-2 pl-10 pr-4 text-dark-100 placeholder-dark-500 focus:border-dark-600 focus:outline-none"
|
||||
/>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function Login() {
|
||||
const [forgotPasswordSent, setForgotPasswordSent] = useState(false);
|
||||
const [forgotPasswordLoading, setForgotPasswordLoading] = useState(false);
|
||||
const [forgotPasswordError, setForgotPasswordError] = useState('');
|
||||
const [showEmailForm, setShowEmailForm] = useState(() => !!referralCode);
|
||||
const [showEmailForm, setShowEmailForm] = useState(true);
|
||||
|
||||
// Telegram safe area insets
|
||||
const { safeAreaInset, contentSafeAreaInset } = useTelegramSDK();
|
||||
|
||||
Reference in New Issue
Block a user