"use client";

import React from "react";
import {
  REELS_RENDER_WINDOW,
  REELS_SLOT_CLASS,
} from "@/constants/reelsFeed";

type ReelsScrollSlotProps = {
  index: number;
  activeIndex: number;
  windowSize?: number;
  children: React.ReactNode;
};

/** اسلات ثابت‌ارتفاع — snap بومی + virtualization همسایه‌ها */
export default function ReelsScrollSlot({
  index,
  activeIndex,
  windowSize = REELS_RENDER_WINDOW,
  children,
}: ReelsScrollSlotProps) {
  const inWindow = Math.abs(index - activeIndex) <= windowSize;

  return (
    <div className={REELS_SLOT_CLASS}>
      {inWindow ? (
        children
      ) : (
        <div className="h-full w-full bg-black" aria-hidden />
      )}
    </div>
  );
}
