import { Download, LinkExternal, File, Headphone, Video, } from "@styled-icons/boxicons-regular"; import { Attachment } from "revolt.js/dist/api/objects"; import styles from "./AttachmentActions.module.scss"; import classNames from "classnames"; import { useContext } from "preact/hooks"; import { determineFileSize } from "../../../../lib/fileSize"; import { AppContext } from "../../../../context/revoltjs/RevoltClient"; import IconButton from "../../../ui/IconButton"; interface Props { attachment: Attachment; } export default function AttachmentActions({ attachment }: Props) { const client = useContext(AppContext); const { filename, metadata, size } = attachment; const url = client.generateFileURL(attachment)!; const open_url = `${url}/${filename}`; const download_url = url.replace("attachments", "attachments/download"); const filesize = determineFileSize(size); switch (metadata.type) { case "Image": return (
); case "Audio": return ( ); case "Video": return ( ); default: return ( ); } }