Skip to content

Commit

Permalink
decrease max image width for quote messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Jan 15, 2024
1 parent ad202ef commit cafb41e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/markup/QuoteMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function QuoteMessage(props: { message: Message; quote: Partial<Message>
<Icon class="editIcon" name='edit' size={14} color="rgba(255,255,255,0.4)" title={editedAt()} />
</Show>
</div>
<Embeds hovered={hovered()} message={props.quote} />
<Embeds hovered={hovered()} message={props.quote} maxWidth={160} />

</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/message-pane/message-item/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const youtubeLinkRegex =



export function Embeds(props: { message: Message, hovered: boolean }) {
export function Embeds(props: { message: Message, hovered: boolean; maxWidth?: number; }) {

const inviteEmbedCode = () => props.message.content?.match(inviteLinkRegex)?.[1];

Expand All @@ -346,7 +346,7 @@ export function Embeds(props: { message: Message, hovered: boolean }) {
return (
<div class={styles.embeds}>
<Show when={props.message.attachments?.[0]?.provider === "local"}>
<ImageEmbed attachment={props.message.attachments?.[0]!} widthOffset={-90} />
<ImageEmbed attachment={props.message.attachments?.[0]!} widthOffset={-90} maxWidth={props.maxWidth}/>
</Show>
<Switch>
<Match when={inviteEmbedCode()}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/ImageEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ImageEmbedContainer = styled(FlexRow)`
}
`

export function ImageEmbed(props: { attachment: RawAttachment, widthOffset?: number, customWidth?: number, customHeight?: number}) {
export function ImageEmbed(props: { attachment: RawAttachment, widthOffset?: number, customWidth?: number, customHeight?: number, maxWidth?: number;}) {
const { paneWidth, height, hasFocus } = useWindowProperties();
const { createPortal } = useCustomPortal();

Expand All @@ -47,7 +47,7 @@ export function ImageEmbed(props: { attachment: RawAttachment, widthOffset?: num
}

const style = () => {
const maxWidth = clamp((props.customWidth || paneWidth()!) + (props.widthOffset || 0), 600)
const maxWidth = clamp((props.customWidth || paneWidth()!) + (props.widthOffset || 0), props.maxWidth || 600)
return clampImageSize(props.attachment.width!, props.attachment.height!, maxWidth, (props.customHeight || height()) / 2)
}

Expand Down

0 comments on commit cafb41e

Please sign in to comment.