2
0
visuddhinanda 2 жил өмнө
parent
commit
854eec2821

+ 2 - 24
dashboard/src/components/template/Wbw/WbwVideoButton.tsx

@@ -1,9 +1,4 @@
-import { VideoCameraOutlined } from "@ant-design/icons";
-import { useEffect, useState } from "react";
-import { get } from "../../../request";
-import { IAttachmentResponse } from "../../api/Attachments";
-import VideoModal from "../../general/VideoModal";
-import { VideoIcon } from "../../../assets/icon";
+import { VideoCtl } from "../Video";
 
 export interface IVideo {
   videoId: string;
@@ -15,25 +10,8 @@ interface IWidget {
   video: IVideo[];
 }
 const WbwVideoButtonWidget = ({ video }: IWidget) => {
-  const [url, setUrl] = useState<string>();
-  const [curr, setCurr] = useState(0);
-
-  useEffect(() => {
-    if (!video || video.length === 0) {
-      return;
-    }
-    const url = `/v2/attachment/${video[curr].videoId}`;
-    console.info("url", url);
-    get<IAttachmentResponse>(url).then((json) => {
-      console.log(json);
-      if (json.ok) {
-        setUrl(json.data.url);
-      }
-    });
-  }, [curr, video]);
-
   return video && video.length > 0 ? (
-    <VideoModal src={url} type={video[0].type} trigger={<VideoIcon />} />
+    <VideoCtl id={video[0].videoId} type={video[0].type} _style="modal" />
   ) : (
     <></>
   );