/* eslint-disable react-hooks/rules-of-hooks */
import { API } from "revolt.js";
import styles from "./Embed.module.scss";
import { useClient } from "../../../../controllers/client/ClientController";
import { modalController } from "../../../../controllers/modals/ModalController";
interface Props {
embed: API.Embed;
width?: number;
height: number;
}
export default function EmbedMedia({ embed, width, height }: Props) {
if (embed.type !== "Website") return null;
const client = useClient();
switch (embed.special?.type) {
case "YouTube": {
let timestamp = "";
if (embed.special.timestamp) {
timestamp = `&start=${embed.special.timestamp}`;
}
return (
);
}
case "Twitch":
return (
);
case "Lightspeed":
return (
);
case "Spotify":
return (
);
case "Soundcloud":
return (
);
case "Bandcamp": {
return (
);
}
case "Streamable": {
return (
);
}
default: {
if (embed.video) {
const url = embed.video.url;
return (
);
} else if (embed.image) {
const url = embed.image.url;
return (
modalController.push({
type: "image_viewer",
embed: embed.image!,
})
}
onMouseDown={(ev) =>
ev.button === 1 && window.open(url, "_blank")
}
/>
);
}
}
}
return null;
}