mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 08:11:13 -05:00
Refactor: Implement Cloudflare Image Variants
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { Header } from '@/components/layout/Header';
|
||||
import { getBannerUrls } from '@/lib/cloudflareImageUtils';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
@@ -214,11 +215,18 @@ export default function OperatorDetail() {
|
||||
<div className="relative mb-8">
|
||||
<div className="aspect-[21/9] bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 rounded-lg overflow-hidden relative">
|
||||
{(operator.banner_image_url || operator.banner_image_id) ? (
|
||||
<img
|
||||
src={operator.banner_image_url || `https://imagedelivery.net/${import.meta.env.VITE_CLOUDFLARE_ACCOUNT_HASH}/${operator.banner_image_id}/public`}
|
||||
alt={operator.name}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
<picture>
|
||||
<source
|
||||
media="(max-width: 768px)"
|
||||
srcSet={getBannerUrls(operator.banner_image_id).mobile || operator.banner_image_url}
|
||||
/>
|
||||
<img
|
||||
src={getBannerUrls(operator.banner_image_id).desktop || operator.banner_image_url}
|
||||
alt={operator.name}
|
||||
className="w-full h-full object-cover"
|
||||
loading="eager"
|
||||
/>
|
||||
</picture>
|
||||
) : operator.logo_url ? (
|
||||
<div className="flex items-center justify-center h-full bg-background/90">
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user