import { LinkExternal, Headphone, Download, } from "@styled-icons/boxicons-regular"; import { File, Video } from "@styled-icons/boxicons-solid"; import { isFirefox } from "react-device-detect"; import { API } from "revolt.js"; import styles from "./AttachmentActions.module.scss"; import classNames from "classnames"; import { useContext } from "preact/hooks"; import { IconButton } from "@revoltchat/ui"; import { determineFileSize } from "../../../../lib/fileSize"; import { useClient } from "../../../../controllers/client/ClientController"; interface Props { attachment: API.File; } export default function AttachmentActions({ attachment }: Props) { const client = useClient(); const { filename, metadata, size } = attachment; const url = client.generateFileURL(attachment); const open_url = `${url}/${filename}`; const download_url = url; const filesize = determineFileSize(size); switch (metadata.type) { case "Image": return (
); case "Audio": return ( ); case "Video": return ( ); default: return ( ); } }