fix: remove fallback content, fix video upload and positioning
- Remove hardcoded fallback data — DB is sole content source - Sections render conditionally when data exists - Hero video slots save after each upload (not only when all 3 filled) - Video positions preserved (left/center/right) with empty string slots - Client-side 10MB hard limit on video uploads with clear error - Server-side upload error handling for body size limits - Guard Team section against empty members array - Clean up old uploaded images and videos
This commit is contained in:
@@ -20,9 +20,10 @@ export function Hero({ data: hero }: HeroProps) {
|
||||
const overlayRef = useRef<HTMLDivElement>(null);
|
||||
const readyCount = useRef(0);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const videos = hero.videos?.length ? hero.videos : DEFAULT_VIDEOS;
|
||||
const centerVideo = videos[Math.floor(videos.length / 2)] || videos[0];
|
||||
const totalVideos = videos.slice(0, 3).length + 1; // desktop (3) + mobile (1)
|
||||
const hasVideos = hero.videos?.some(Boolean);
|
||||
const videos = hasVideos ? hero.videos! : DEFAULT_VIDEOS;
|
||||
const centerVideo = videos[1] || videos[0];
|
||||
const totalVideos = videos.slice(0, 3).filter(Boolean).length + 1; // desktop (filled) + mobile (1)
|
||||
|
||||
const prefersReducedMotion = useRef(false);
|
||||
|
||||
@@ -106,6 +107,7 @@ export function Hero({ data: hero }: HeroProps) {
|
||||
{/* Desktop: diagonal split with all videos */}
|
||||
<div className="absolute inset-0 hidden md:block">
|
||||
{videos.slice(0, 3).map((src, i) => {
|
||||
if (!src) return null;
|
||||
const positions = [
|
||||
{ left: "0%", width: "38%" },
|
||||
{ left: "31%", width: "38%" },
|
||||
@@ -118,7 +120,7 @@ export function Hero({ data: hero }: HeroProps) {
|
||||
];
|
||||
return (
|
||||
<div
|
||||
key={src}
|
||||
key={`video-${i}`}
|
||||
className="absolute top-0 bottom-0 overflow-hidden"
|
||||
style={{
|
||||
left: positions[i].left,
|
||||
|
||||
Reference in New Issue
Block a user