mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:31:12 -05:00
Fix edge function logging and types
This commit is contained in:
@@ -241,7 +241,19 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
return;
|
||||
}
|
||||
|
||||
const signUpOptions: any = {
|
||||
interface SignUpOptions {
|
||||
email: string;
|
||||
password: string;
|
||||
options?: {
|
||||
captchaToken?: string;
|
||||
data?: {
|
||||
username: string;
|
||||
display_name: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
const signUpOptions: SignUpOptions = {
|
||||
email: formData.email,
|
||||
password: formData.password,
|
||||
options: {
|
||||
@@ -253,7 +265,10 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
};
|
||||
|
||||
if (tokenToUse) {
|
||||
signUpOptions.options.captchaToken = tokenToUse;
|
||||
signUpOptions.options = {
|
||||
...signUpOptions.options,
|
||||
captchaToken: tokenToUse
|
||||
};
|
||||
}
|
||||
|
||||
const { data, error } = await supabase.auth.signUp(signUpOptions);
|
||||
|
||||
@@ -362,23 +362,24 @@ export function ContentTabs() {
|
||||
</div>
|
||||
) : openingSoon.length > 0 ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7 3xl:grid-cols-8 gap-4 lg:gap-5 xl:gap-4 2xl:gap-5">
|
||||
{openingSoon.map((entity: any) => (
|
||||
entity.entityType === 'park' ? (
|
||||
<div key={entity.id} className="relative">
|
||||
<ParkCard park={entity} />
|
||||
{openingSoon.map((entity: unknown) => {
|
||||
const typedEntity = entity as { id: string; entityType: string; opening_date: string };
|
||||
return typedEntity.entityType === 'park' ? (
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<ParkCard park={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-blue-500/90 text-white backdrop-blur-sm">
|
||||
{new Date(entity.opening_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
{new Date(typedEntity.opening_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
</Badge>
|
||||
</div>
|
||||
) : (
|
||||
<div key={entity.id} className="relative">
|
||||
<RideCard ride={entity} />
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<RideCard ride={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-blue-500/90 text-white backdrop-blur-sm">
|
||||
{new Date(entity.opening_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
{new Date(typedEntity.opening_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
</Badge>
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-12 text-muted-foreground">
|
||||
@@ -401,23 +402,24 @@ export function ContentTabs() {
|
||||
</div>
|
||||
) : closingSoon.length > 0 ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7 3xl:grid-cols-8 gap-4 lg:gap-5 xl:gap-4 2xl:gap-5">
|
||||
{closingSoon.map((entity: any) => (
|
||||
entity.entityType === 'park' ? (
|
||||
<div key={entity.id} className="relative">
|
||||
<ParkCard park={entity} />
|
||||
{closingSoon.map((entity: unknown) => {
|
||||
const typedEntity = entity as { id: string; entityType: string; closing_date: string };
|
||||
return typedEntity.entityType === 'park' ? (
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<ParkCard park={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-red-500/90 text-white backdrop-blur-sm">
|
||||
Closes {new Date(entity.closing_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
Closes {new Date(typedEntity.closing_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
</Badge>
|
||||
</div>
|
||||
) : (
|
||||
<div key={entity.id} className="relative">
|
||||
<RideCard ride={entity} />
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<RideCard ride={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-red-500/90 text-white backdrop-blur-sm">
|
||||
Closes {new Date(entity.closing_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
Closes {new Date(typedEntity.closing_date).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })}
|
||||
</Badge>
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-12 text-muted-foreground">
|
||||
@@ -440,23 +442,24 @@ export function ContentTabs() {
|
||||
</div>
|
||||
) : recentlyClosed.length > 0 ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7 3xl:grid-cols-8 gap-4 lg:gap-5 xl:gap-4 2xl:gap-5">
|
||||
{recentlyClosed.map((entity: any) => (
|
||||
entity.entityType === 'park' ? (
|
||||
<div key={entity.id} className="relative">
|
||||
<ParkCard park={entity} />
|
||||
{recentlyClosed.map((entity: unknown) => {
|
||||
const typedEntity = entity as { id: string; entityType: string; closing_date: string };
|
||||
return typedEntity.entityType === 'park' ? (
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<ParkCard park={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-gray-500/90 text-white backdrop-blur-sm">
|
||||
Closed {new Date(entity.closing_date).getFullYear()}
|
||||
Closed {new Date(typedEntity.closing_date).getFullYear()}
|
||||
</Badge>
|
||||
</div>
|
||||
) : (
|
||||
<div key={entity.id} className="relative">
|
||||
<RideCard ride={entity} />
|
||||
<div key={typedEntity.id} className="relative">
|
||||
<RideCard ride={entity as never} />
|
||||
<Badge className="absolute top-2 right-2 bg-gray-500/90 text-white backdrop-blur-sm">
|
||||
Closed {new Date(entity.closing_date).getFullYear()}
|
||||
Closed {new Date(typedEntity.closing_date).getFullYear()}
|
||||
</Badge>
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-12 text-muted-foreground">
|
||||
|
||||
@@ -15,7 +15,7 @@ interface EntityEditPreviewProps {
|
||||
/**
|
||||
* Deep equality check for detecting changes in nested objects/arrays
|
||||
*/
|
||||
const deepEqual = (a: any, b: any): boolean => {
|
||||
const deepEqual = <T extends Record<string, unknown>>(a: T, b: T): boolean => {
|
||||
// Handle null/undefined cases
|
||||
if (a === b) return true;
|
||||
if (a == null || b == null) return false;
|
||||
@@ -27,7 +27,7 @@ const deepEqual = (a: any, b: any): boolean => {
|
||||
// Handle arrays
|
||||
if (Array.isArray(a) && Array.isArray(b)) {
|
||||
if (a.length !== b.length) return false;
|
||||
return a.every((item, index) => deepEqual(item, b[index]));
|
||||
return a.every((item, index) => deepEqual(item as Record<string, unknown>, b[index] as Record<string, unknown>));
|
||||
}
|
||||
|
||||
// One is array, other is not
|
||||
@@ -39,7 +39,16 @@ const deepEqual = (a: any, b: any): boolean => {
|
||||
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
|
||||
return keysA.every(key => deepEqual(a[key], b[key]));
|
||||
return keysA.every(key => {
|
||||
const valueA = a[key];
|
||||
const valueB = b[key];
|
||||
|
||||
if (typeof valueA === 'object' && valueA !== null && typeof valueB === 'object' && valueB !== null) {
|
||||
return deepEqual(valueA as Record<string, unknown>, valueB as Record<string, unknown>);
|
||||
}
|
||||
|
||||
return valueA === valueB;
|
||||
});
|
||||
};
|
||||
|
||||
interface ImageAssignments {
|
||||
|
||||
@@ -93,11 +93,17 @@ export function ProfileManager() {
|
||||
setActionLoading(targetUserId);
|
||||
try {
|
||||
// Prepare update data
|
||||
const updateData: any = { banned: ban };
|
||||
interface ProfileUpdateData {
|
||||
banned: boolean;
|
||||
ban_reason?: string | null;
|
||||
ban_expires_at?: string | null;
|
||||
}
|
||||
|
||||
const updateData: ProfileUpdateData = { banned: ban };
|
||||
|
||||
if (ban && banReason) {
|
||||
updateData.ban_reason = banReason;
|
||||
updateData.ban_expires_at = banExpiresAt;
|
||||
updateData.ban_expires_at = banExpiresAt ? banExpiresAt.toISOString() : null;
|
||||
} else if (!ban) {
|
||||
// Clear ban data when unbanning
|
||||
updateData.ban_reason = null;
|
||||
|
||||
Reference in New Issue
Block a user