1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 02:12:38 +01:00

some fixes for gifs

This commit is contained in:
Puyodead1 2023-12-22 23:00:45 -05:00
parent 70ff143c36
commit f810397861
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
3 changed files with 3 additions and 11 deletions

View File

@ -98,7 +98,7 @@ function EmbedMedia({ embed, width, height, thumbnail }: Props) {
style={{ width, height }}
src={url}
loop={embed.type === EmbedType.GIFV}
controls={embed.type === EmbedType.GIFV}
controls={embed.type !== EmbedType.GIFV}
autoPlay={embed.type === EmbedType.GIFV}
muted={embed.type === EmbedType.GIFV ? true : undefined}
/>

View File

@ -64,7 +64,6 @@ export const MessageInfo = styled.div`
export const MessageContent = styled.div`
position: relative;
min-width: 0;
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;

View File

@ -9,7 +9,7 @@ import styles from "./Embed.module.css";
import EmbedMedia from "./EmbedMedia";
import { MESSAGE_AREA_PADDING, MessageAreaWidthContext } from "./MessageList";
const MAX_EMBED_WIDTH = 400;
const MAX_EMBED_WIDTH = 300;
const MAX_EMBED_HEIGHT = 640;
const THUMBNAIL_MAX_WIDTH = 80;
const CONTAINER_PADDING = 24;
@ -26,7 +26,6 @@ function MessageEmbed({ embed }: Props) {
function calculateSize(w: number, h: number): { width: number; height: number } {
const limitingWidth = Math.min(w, maxWidth);
const limitingHeight = Math.min(MAX_EMBED_HEIGHT, h);
// Calculate smallest possible WxH.
@ -76,13 +75,7 @@ function MessageEmbed({ embed }: Props) {
const { width, height } = calculateSize(mw, mh);
if (embed.type === EmbedType.GIFV || EMBEDDABLE_PROVIDERS.includes(embed.provider?.name ?? "")) {
return (
<EmbedMedia
embed={embed}
width={height * ((embed.image?.width ?? 0) / (embed.image?.height ?? 0))}
height={height}
/>
);
return <EmbedMedia embed={embed} width={height} height={height} />;
}
return (