import React from "react";
import { CloseCircleOutlined } from "@ant-design/icons";
import styles from "./index.module.scss";
import { useSelector } from "react-redux";
import store, { RootState } from "@/store";
import { baseURL } from "@/utils/http";
function VideoLookDom() {
  const videoSrc = useSelector((state: RootState) => state.layoutStore.videoSrc);
  return (
    <div
      className={styles.VideoLookDom}
      style={videoSrc ? { opacity: 1, pointerEvents: "auto" } : {}}
    >
      <div className="viedoBox">
        {videoSrc ? (
          <video autoPlay controls src={baseURL + videoSrc}></video>
        ) : null}
      </div>

      <div
        className="close"
        onClick={() => store.dispatch({ type: "layout/lookVideo", payload: "" })}
      >
        <CloseCircleOutlined />
      </div>
    </div>
  );
}

const MemoVideoLookDom = React.memo(VideoLookDom);

export default MemoVideoLookDom;
