@geekapps/silo-elements-nextjs 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -185,6 +185,7 @@ function Video({
185
185
  const ageRatingTextRef = useRef(null);
186
186
  const ageRatingShownRef = useRef(false);
187
187
  const ageRatingQueuedRef = useRef(false);
188
+ const ageRatingPendingRef = useRef(false);
188
189
  const [clickIcon, setClickIcon] = useState(null);
189
190
  const clickIconTimerRef = useRef(null);
190
191
  const clickIconRef = useRef(null);
@@ -334,7 +335,13 @@ function Video({
334
335
  gsap.to(el, {
335
336
  opacity: controlsVisible ? 1 : 0,
336
337
  duration: 0.2,
337
- ease: "power1.inOut"
338
+ ease: "power1.inOut",
339
+ onComplete: () => {
340
+ if (!controlsVisible && ageRatingPendingRef.current) {
341
+ ageRatingPendingRef.current = false;
342
+ showAgeRatingRef.current?.();
343
+ }
344
+ }
338
345
  });
339
346
  el.style.pointerEvents = controlsVisible ? "" : "none";
340
347
  if (player) {
@@ -410,7 +417,7 @@ function Video({
410
417
  if (!wrap) return;
411
418
  if (ageRatingTlRef.current) ageRatingTlRef.current.kill();
412
419
  const HOLD = 12;
413
- const tl = gsap.timeline({ delay: 0.6 });
420
+ const tl = gsap.timeline({ delay: 0.3 });
414
421
  tl.fromTo(wrap, { opacity: 0 }, { opacity: 1, duration: 0.5, ease: "power2.out" });
415
422
  if (icon) {
416
423
  tl.fromTo(
@@ -443,7 +450,7 @@ function Video({
443
450
  }
444
451
  const shouldShow = !ageRatingShownRef.current || ageRatingQueuedRef.current;
445
452
  ageRatingQueuedRef.current = false;
446
- if (shouldShow) showAgeRating();
453
+ if (shouldShow) ageRatingPendingRef.current = true;
447
454
  setHasPlayed(true);
448
455
  showControlsTemporarily();
449
456
  };
@@ -2042,7 +2049,20 @@ function Video({
2042
2049
  activeCue && /* @__PURE__ */ jsx(
2043
2050
  "div",
2044
2051
  {
2045
- className: `pointer-events-none absolute inset-x-0 z-40 flex justify-center px-4 transition-all duration-200${controlsVisible ? "bottom-20 @sm:bottom-24 @lg:bottom-28" : "bottom-4 @sm:bottom-6"}`,
2052
+ className: "pointer-events-none absolute inset-x-0 z-40 flex justify-center px-4",
2053
+ style: {
2054
+ bottom: (() => {
2055
+ if (preview) {
2056
+ const frameW = preview.cue.w ?? 160;
2057
+ const frameH = preview.cue.h ?? 90;
2058
+ const thumbH = Math.round(200 * (frameH / frameW));
2059
+ return `${80 + thumbH + 32 + 10}px`;
2060
+ }
2061
+ if (controlsVisible) return "5rem";
2062
+ return "1rem";
2063
+ })(),
2064
+ transition: "bottom 0.2s ease"
2065
+ },
2046
2066
  children: /* @__PURE__ */ jsx(
2047
2067
  "div",
2048
2068
  {