chore(src): 🔧 Update component-related TypeScript files in src
This commit is contained in:
parent
23af789fd8
commit
f578ff0de4
4 changed files with 15 additions and 17 deletions
|
|
@ -3,7 +3,7 @@ import { baseTheme } from './theme'
|
|||
/**
|
||||
* Deep merge utility for theme customization
|
||||
*/
|
||||
function deepMerge<T extends Record<string, any>>(
|
||||
function deepMerge<T extends Record<string, unknown>>(
|
||||
target: T,
|
||||
source: Partial<T>
|
||||
): T {
|
||||
|
|
@ -12,8 +12,8 @@ function deepMerge<T extends Record<string, any>>(
|
|||
for (const key in source) {
|
||||
if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
||||
output[key] = deepMerge(
|
||||
target[key] as Record<string, any>,
|
||||
source[key] as Record<string, any>
|
||||
target[key] as Record<string, unknown>,
|
||||
source[key] as Record<string, unknown>
|
||||
) as T[Extract<keyof T, string>]
|
||||
} else {
|
||||
output[key] = source[key] as T[Extract<keyof T, string>]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import toast from 'react-hot-toast'
|
|||
/**
|
||||
* Configuration for creating standardized mutation options
|
||||
*/
|
||||
export interface CreateMutationOptionsConfig {
|
||||
export interface CreateMutationOptionsConfig<TData = unknown> {
|
||||
/**
|
||||
* Name of the operation being performed (e.g., "create user", "update post")
|
||||
* Used in success/error messages and logging
|
||||
|
|
@ -33,7 +33,7 @@ export interface CreateMutationOptionsConfig {
|
|||
* Custom success callback
|
||||
* Called after query invalidation
|
||||
*/
|
||||
onSuccess?: (data: any) => void;
|
||||
onSuccess?: (data: TData) => void;
|
||||
|
||||
/**
|
||||
* Custom error callback
|
||||
|
|
@ -96,7 +96,7 @@ export interface CreateMutationOptionsConfig {
|
|||
* ```
|
||||
*/
|
||||
export function useMutationOptions<TData = unknown, TVariables = unknown>(
|
||||
config: CreateMutationOptionsConfig
|
||||
config: CreateMutationOptionsConfig<TData>
|
||||
): UseMutationOptions<TData, ApiError, TVariables> {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
|
|
|
|||
|
|
@ -69,17 +69,15 @@ export function SEOAgeGate({
|
|||
children,
|
||||
exitUrl = 'https://www.google.com',
|
||||
}: SEOAgeGateProps) {
|
||||
// Calculate bot status immediately (pure function, no side effects)
|
||||
const botStatus = shouldBypassAgeVerification();
|
||||
const [isVerified, setIsVerified] = useState<boolean | null>(null);
|
||||
const [isBot, setIsBot] = useState<boolean | null>(null);
|
||||
const [isBot] = useState<boolean>(botStatus);
|
||||
|
||||
// Check verification status on mount
|
||||
// Check verification status on mount (only for non-bots)
|
||||
useEffect(() => {
|
||||
// Check if user is a bot
|
||||
const botStatus = shouldBypassAgeVerification();
|
||||
setIsBot(botStatus);
|
||||
|
||||
// Check localStorage for existing verification
|
||||
if (!botStatus) {
|
||||
if (!isBot) {
|
||||
try {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
setIsVerified(stored === 'true');
|
||||
|
|
@ -88,7 +86,7 @@ export function SEOAgeGate({
|
|||
setIsVerified(false);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [isBot]);
|
||||
|
||||
// Handle user confirming age
|
||||
const handleConfirm = () => {
|
||||
|
|
@ -105,8 +103,8 @@ export function SEOAgeGate({
|
|||
window.location.href = exitUrl;
|
||||
};
|
||||
|
||||
// Still loading
|
||||
if (isBot === null || (isBot === false && isVerified === null)) {
|
||||
// Still loading (only check verification status for non-bots)
|
||||
if (!isBot && isVerified === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export function DesktopTemplate({
|
|||
{/* Main content */}
|
||||
<main className="main-content">
|
||||
<article className="value-content">
|
||||
<h2>Why Choose {cityName}'s Premier Platform</h2>
|
||||
<h2>Why Choose {cityName}'s Premier Platform</h2>
|
||||
<ul className="value-list">
|
||||
<li>
|
||||
<span className="value-icon">✓</span>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue