From 0017f48e7b3119cf9323cdf8dc647955b82db28b Mon Sep 17 00:00:00 2001 From: Paulina Tirante Date: Wed, 20 Aug 2025 12:37:22 -0300 Subject: [PATCH 1/2] Modificaciones de video y FAQ --- .../videoBackground/VideoBackground.js | 172 ++++++++++++++---- src/templates/LandingPage.js | 54 +++++- 2 files changed, 187 insertions(+), 39 deletions(-) diff --git a/src/components/videoBackground/VideoBackground.js b/src/components/videoBackground/VideoBackground.js index 8f2a14f..2592970 100644 --- a/src/components/videoBackground/VideoBackground.js +++ b/src/components/videoBackground/VideoBackground.js @@ -4,7 +4,6 @@ import CustomLink from "../CustomLink/CustomLink" import PropTypes from "prop-types" import { GatsbyImage, getImage } from "gatsby-plugin-image" -// ✅ CAMBIO: detectar versión de iOS function getIOSVersion() { if (typeof window === "undefined" || typeof navigator === "undefined") return null const userAgent = navigator.userAgent @@ -25,6 +24,39 @@ function isIOSPriorTo(version) { if (currentVersion.major > majorVersion) return false return currentVersion.minor < minorVersion } +function getQS(name) { + if (typeof window === "undefined") return null + return new URLSearchParams(window.location.search).get(name) +} + + +function resolvePoster(poster, image) { + const posterLocal = + poster?.localFile || + poster?.data?.attributes?.localFile || + null + const sharp = posterLocal ? getImage(posterLocal) : null + + const rawUrl = + poster?.url || + poster?.data?.attributes?.url || + poster?.formats?.large?.url || + poster?.formats?.medium?.url || + poster?.formats?.small?.url || + poster?.formats?.thumbnail?.url || + null + + const toAbs = u => + !u ? null : (u.startsWith("http") + ? u + : `https://strapi-s3-bitlogic.s3.sa-east-1.amazonaws.com${u}`) + + const url = toAbs(rawUrl) + + const imageSharp = image?.localFile ? getImage(image.localFile) : null + + return { sharp: sharp || imageSharp, url } +} function getVideoContent( video, @@ -36,29 +68,14 @@ function getVideoContent( image, posterData ) { - const posterUrl = posterData?.url?.startsWith("http") - ? getImage(posterData.url) - : getImage(`https://strapi-s3-bitlogic.s3.sa-east-1.amazonaws.com${posterData?.url}`) - const posterSharp = posterData?.localFile && getImage(posterData.localFile) + const { sharp: pSharp, url: pUrl } = resolvePoster(posterData, image) + const posterUrl = pUrl || pSharp?.images?.fallback?.src const url = videoUrl?.replace("watch?v=", "embed/") let code = url?.substring(url.lastIndexOf("/") + 1) || "" const codeIndex = code.indexOf("?") if (codeIndex !== -1) code = code.substring(0, codeIndex) - const isOldIOS = isIOSPriorTo("17.4") - if (isOldIOS && posterSharp) { - return ( - - ) - } - if (video?.url) { return (