// MyBoost: Engagement Circle how-to video (loaded after circle.jsx)
const CIRCLE_VIDEO = SB_URL + "/storage/v1/object/public/myboost-media/circle-howto.mp4";
const CIRCLE_POSTER = SB_URL + "/storage/v1/object/public/myboost-media/circle-howto-poster.jpg";

function CircleVideo({ startOpen }) {
  const [open, setOpen] = useState(!!startOpen);
  return <div style={{ ...S.card, textAlign: "center" }}>
    <button style={{ ...S.bgh, fontSize: 14, padding: "10px 16px" }} onClick={() => setOpen(!open)}>
      {open ? "Hide video" : "▶️ Watch how the Circle works (1 min)"}
    </button>
    {open && <video src={CIRCLE_VIDEO} poster={CIRCLE_POSTER} controls playsInline preload="metadata"
      style={{ display: "block", width: "100%", maxWidth: 340, margin: "14px auto 0", borderRadius: 16, border: "1px solid #2a2a4a", background: "#000" }} />}
  </div>;
}

const __BaseCircleForVideo = window.Circle;
window.Circle = function CircleWithVideo(props) {
  return <>
    <CircleVideo startOpen={!props.profile.circle_joined} />
    <__BaseCircleForVideo {...props} />
  </>;
};

const __BaseGuideForVideo = window.Guide;
window.Guide = function GuideWithVideo(props) {
  return <>
    <div style={{ ...S.card }}>
      <div style={{ fontWeight: 700, marginBottom: 6 }}>🤝 Engagement Circle: how it works</div>
      <div style={{ ...S.muted, marginBottom: 6 }}>Real members like and comment on each other's new posts. Find it at the top of the Store.</div>
      <CircleVideo startOpen={false} />
    </div>
    <__BaseGuideForVideo {...props} />
  </>;
};
