You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 regels
927 B

  1. 'use client';
  2. import { Card } from '@/types';
  3. const VIDEO_RE = /\.(mp4|m4v|webm|mov|qt|ogv|ogg)(\?|$)/i;
  4. export default function FullscreenLock({ card }: { card: Card }) {
  5. const url = card.imageUrl;
  6. const isVideo = !!url && VIDEO_RE.test(url);
  7. return (
  8. <div
  9. className="fixed inset-0 z-[9999] bg-black flex items-center justify-center select-none"
  10. onContextMenu={(e) => e.preventDefault()}
  11. >
  12. {!url ? (
  13. <p className="text-white/70 text-lg">Lock card senza contenuto. Apri /admin per aggiungere immagine o video.</p>
  14. ) : isVideo ? (
  15. <video
  16. src={url}
  17. className="w-full h-full object-contain"
  18. autoPlay
  19. loop
  20. muted
  21. playsInline
  22. />
  23. ) : (
  24. <img
  25. src={url}
  26. alt=""
  27. className="w-full h-full object-contain"
  28. draggable={false}
  29. />
  30. )}
  31. </div>
  32. );
  33. }