diff --git a/src/components/messaging/EmbedMedia.tsx b/src/components/messaging/EmbedMedia.tsx
index d82c67c..125809b 100644
--- a/src/components/messaging/EmbedMedia.tsx
+++ b/src/components/messaging/EmbedMedia.tsx
@@ -101,6 +101,13 @@ function EmbedMedia({ embed, width, height, thumbnail }: Props) {
controls={embed.type !== EmbedType.GIFV}
autoPlay={embed.type === EmbedType.GIFV}
muted={embed.type === EmbedType.GIFV ? true : undefined}
+ onClick={() => {
+ modalController.push({
+ type: "image_viewer",
+ attachment: embed.video!,
+ isVideo: true,
+ });
+ }}
/>
);
} else if (embed.image && !thumbnail) {
@@ -113,13 +120,9 @@ function EmbedMedia({ embed, width, height, thumbnail }: Props) {
loading="lazy"
style={{ width: "100%", height: "100%" }}
onClick={() => {
- if (!embed.image) {
- console.error("embed has no image... wtf");
- return;
- }
modalController.push({
type: "image_viewer",
- attachment: embed.image,
+ attachment: embed.image!,
});
}}
/>
@@ -134,13 +137,9 @@ function EmbedMedia({ embed, width, height, thumbnail }: Props) {
loading="lazy"
style={{ width, height }}
onClick={() => {
- if (!embed.thumbnail) {
- console.error("embed has no thumbnail... wtf");
- return;
- }
modalController.push({
type: "image_viewer",
- attachment: embed.thumbnail,
+ attachment: embed.thumbnail!,
});
}}
/>
diff --git a/src/components/messaging/MessageEmbed.tsx b/src/components/messaging/MessageEmbed.tsx
index ec2c772..9a1c7f7 100644
--- a/src/components/messaging/MessageEmbed.tsx
+++ b/src/components/messaging/MessageEmbed.tsx
@@ -74,7 +74,12 @@ function MessageEmbed({ embed }: Props) {
}
const { width, height } = calculateSize(mw, mh);
- if (embed.type === EmbedType.GIFV || EMBEDDABLE_PROVIDERS.includes(embed.provider?.name ?? "")) {
+ if (
+ embed.type === EmbedType.GIFV ||
+ embed.type === EmbedType.Image ||
+ embed.type === EmbedType.Video ||
+ EMBEDDABLE_PROVIDERS.includes(embed.provider?.name ?? "")
+ ) {
return ;
}
diff --git a/src/components/modals/ImageViewerModal.tsx b/src/components/modals/ImageViewerModal.tsx
index dd24ea2..b639c84 100644
--- a/src/components/modals/ImageViewerModal.tsx
+++ b/src/components/modals/ImageViewerModal.tsx
@@ -1,4 +1,4 @@
-import { APIAttachment, APIEmbedImage, APIEmbedThumbnail } from "@spacebarchat/spacebar-api-types/v9";
+import { APIAttachment, APIEmbedImage, APIEmbedThumbnail, APIEmbedVideo } from "@spacebarchat/spacebar-api-types/v9";
import styled from "styled-components";
import { Modal } from "./ModalComponents";
@@ -15,9 +15,10 @@ const Container = styled.div`
`;
interface Props {
- attachment: APIAttachment | APIEmbedImage | APIEmbedThumbnail;
+ attachment: APIAttachment | APIEmbedImage | APIEmbedThumbnail | APIEmbedVideo;
width?: number;
height?: number;
+ isVideo?: boolean; // should only be for gifs
}
export function ImageViewerModal(props: Props) {
@@ -27,7 +28,20 @@ export function ImageViewerModal(props: Props) {
return (
-
+ {props.isVideo ? (
+
+ ) : (
+
+ )}
);
diff --git a/src/controllers/modals/types.ts b/src/controllers/modals/types.ts
index 1e6f5b2..3f973ad 100644
--- a/src/controllers/modals/types.ts
+++ b/src/controllers/modals/types.ts
@@ -1,6 +1,6 @@
// adapted from https://github.com/revoltchat/revite/blob/master/src/controllers/modals/types.ts
-import { APIAttachment, APIEmbedImage, APIEmbedThumbnail } from "@spacebarchat/spacebar-api-types/v9";
+import { APIAttachment, APIEmbedImage, APIEmbedThumbnail, APIEmbedVideo } from "@spacebarchat/spacebar-api-types/v9";
import Channel from "../../stores/objects/Channel";
import Guild from "../../stores/objects/Guild";
import GuildMember from "../../stores/objects/GuildMember";
@@ -45,9 +45,10 @@ export type Modal = {
}
| {
type: "image_viewer";
- attachment: APIAttachment | APIEmbedImage | APIEmbedThumbnail;
+ attachment: APIAttachment | APIEmbedImage | APIEmbedThumbnail | APIEmbedVideo;
width?: number;
height?: number;
+ isVideo?: boolean;
}
);