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.
 
 

38 regels
986 B

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