mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
fix: resolve telegram auth token expiration and clean up codebase
- Fix stale initData comparison in clearStaleSessionIfNeeded that destroyed valid refresh tokens on mobile WebView reopens - Restrict X-Telegram-Init-Data header to auth endpoints only - Close Mini App on auth retry to force fresh initData from Telegram - Merge Connection page error/not-configured states for better UX - Remove unnecessary comments across 40+ files (section dividers, restating comments, noise catch block comments) - Configure ESLint allowEmptyCatch to properly handle intentional empty catch blocks (62 warnings resolved)
This commit is contained in:
@@ -21,10 +21,6 @@ import { getApiErrorMessage } from '../utils/api-error';
|
||||
import { formatPrice } from '../utils/format';
|
||||
import { usePlatform, useHaptic } from '@/platform';
|
||||
|
||||
// ============================================================
|
||||
// SVG Icons
|
||||
// ============================================================
|
||||
|
||||
function GiftIcon({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
@@ -131,10 +127,6 @@ function InboxIcon({ className }: { className?: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Helpers
|
||||
// ============================================================
|
||||
|
||||
function formatPeriodLabel(
|
||||
days: number,
|
||||
t: (key: string, options?: Record<string, unknown>) => string,
|
||||
@@ -181,16 +173,8 @@ function formatGiftDate(dateStr: string | null): string {
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Tab type
|
||||
// ============================================================
|
||||
|
||||
type TabId = 'buy' | 'activate' | 'myGifts';
|
||||
|
||||
// ============================================================
|
||||
// Sub-components: Shared
|
||||
// ============================================================
|
||||
|
||||
function LoadingSkeleton() {
|
||||
return (
|
||||
<div className="flex min-h-dvh items-center justify-center">
|
||||
@@ -263,10 +247,6 @@ function DisabledState() {
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Sub-components: Buy Tab
|
||||
// ============================================================
|
||||
|
||||
function TariffCard({
|
||||
tariff,
|
||||
isSelected,
|
||||
@@ -904,10 +884,6 @@ function BuyTabContent({
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Sub-components: Activate Tab
|
||||
// ============================================================
|
||||
|
||||
function ActivateTabContent({ initialCode }: { initialCode?: string | null }) {
|
||||
const { t } = useTranslation();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -1023,10 +999,6 @@ function ActivateTabContent({ initialCode }: { initialCode?: string | null }) {
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Sub-components: My Gifts Tab
|
||||
// ============================================================
|
||||
|
||||
function CopiedToast({ onDismiss }: { onDismiss: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -1320,20 +1292,12 @@ function MyGiftsTabContent() {
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Tab animation variants
|
||||
// ============================================================
|
||||
|
||||
const tabContentVariants = {
|
||||
initial: { opacity: 0, x: 20 },
|
||||
animate: { opacity: 1, x: 0 },
|
||||
exit: { opacity: 0, x: -20 },
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// Main Component
|
||||
// ============================================================
|
||||
|
||||
export default function GiftSubscription() {
|
||||
const { t } = useTranslation();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
Reference in New Issue
Block a user