From 14bcc4454ccd4d596e78873fe2c2b2a88ec7a4ed Mon Sep 17 00:00:00 2001
From: wrigglebug <133191472+wrigglebug@users.noreply.github.com>
Date: Sun, 8 Mar 2026 03:47:13 -0700
Subject: [PATCH 1/6] Adjust media sizing and URL preview layout
---
src/app/components/media/media.css.ts | 2 +-
.../components/message/MsgTypeRenderers.tsx | 13 ++-
.../message/attachment/Attachment.css.ts | 2 +-
.../components/url-preview/UrlPreview.css.tsx | 1 -
.../components/url-preview/UrlPreviewCard.tsx | 109 ++++++++----------
5 files changed, 62 insertions(+), 65 deletions(-)
diff --git a/src/app/components/media/media.css.ts b/src/app/components/media/media.css.ts
index b563ef3e..aad194fd 100644
--- a/src/app/components/media/media.css.ts
+++ b/src/app/components/media/media.css.ts
@@ -4,7 +4,7 @@ import { DefaultReset } from 'folds';
export const Image = style([
DefaultReset,
{
- objectFit: 'cover',
+ objectFit: 'contain',
width: '100%',
height: '100%',
},
diff --git a/src/app/components/message/MsgTypeRenderers.tsx b/src/app/components/message/MsgTypeRenderers.tsx
index 275cfefe..66656f94 100644
--- a/src/app/components/message/MsgTypeRenderers.tsx
+++ b/src/app/components/message/MsgTypeRenderers.tsx
@@ -250,19 +250,26 @@ export function MImage({ content, renderImageContent, outlined }: MImageProps) {
if (typeof mxcUrl !== 'string') {
return ;
}
- const height = scaleYDimension(imgInfo?.w || 400, 400, imgInfo?.h || 400);
+ const MAX_SIZE = 400;
+ const imgW = imgInfo?.w ?? MAX_SIZE;
+ const imgH = imgInfo?.h ?? MAX_SIZE;
+ const aspectRatio = imgInfo?.w && imgInfo?.h ? `${imgW} / ${imgH}` : undefined;
+ // this garbage is for portrait images, we cap the width so the card doesn't exceed the bounds of the image
+ const displayWidth = imgH > imgW ? Math.round(MAX_SIZE * (imgW / imgH)) : MAX_SIZE;
return (
{renderImageContent({
@@ -306,7 +313,7 @@ export function MVideo({ content, renderAsFile, renderVideoContent, outlined }:
return ;
}
- const height = scaleYDimension(videoInfo.w || 400, 400, videoInfo.h || 400);
+ const height = Math.min(scaleYDimension(videoInfo.w || 400, 400, videoInfo.h || 400), 400);
const filename = content.filename ?? content.body ?? 'Video';
diff --git a/src/app/components/message/attachment/Attachment.css.ts b/src/app/components/message/attachment/Attachment.css.ts
index 4c417611..dad95f61 100644
--- a/src/app/components/message/attachment/Attachment.css.ts
+++ b/src/app/components/message/attachment/Attachment.css.ts
@@ -23,7 +23,7 @@ export const Attachment = recipe({
export type AttachmentVariants = RecipeVariants;
export const AttachmentHeader = style({
- padding: config.space.S300,
+ padding: config.space.S100,
});
export const AttachmentBox = style([
diff --git a/src/app/components/url-preview/UrlPreview.css.tsx b/src/app/components/url-preview/UrlPreview.css.tsx
index 3192dc49..90adc127 100644
--- a/src/app/components/url-preview/UrlPreview.css.tsx
+++ b/src/app/components/url-preview/UrlPreview.css.tsx
@@ -5,7 +5,6 @@ export const UrlPreview = style([
DefaultReset,
{
width: toRem(400),
- minHeight: toRem(102),
backgroundColor: color.SurfaceVariant.Container,
color: color.SurfaceVariant.OnContainer,
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
diff --git a/src/app/components/url-preview/UrlPreviewCard.tsx b/src/app/components/url-preview/UrlPreviewCard.tsx
index 3855085d..2d59eed4 100644
--- a/src/app/components/url-preview/UrlPreviewCard.tsx
+++ b/src/app/components/url-preview/UrlPreviewCard.tsx
@@ -54,69 +54,14 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s
return (
- {(prev['og:video'] && (
- }
- renderThumbnail={() => }
- />
- )) ||
- (prev['og:image'] && (
-
- {' '}
- }
- renderImage={(p) => (
-
- )}
- />
-
- )) ||
- (prev['og:audio'] && (
-
- }
- />
-
- ))}
)}
+ {prev['og:video'] && (
+ }
+ renderThumbnail={() => }
+ />
+ )}
+ {!prev['og:video'] && prev['og:image'] && (
+
+ }
+ renderImage={(p) => (
+
+ )}
+ />
+
+ )}
+ {!prev['og:video'] && !prev['og:image'] && prev['og:audio'] && (
+
+ }
+ />
+
+ )}
);
};
@@ -197,9 +190,7 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s
maxWidth: '100%',
margin: 0,
}
- : {
- width: '600px',
- }
+ : undefined
}
>
{previewContent}
From 387d28fb771470a2b5c819d2eb184e130b7cb415 Mon Sep 17 00:00:00 2001
From: wrigglebug <133191472+wrigglebug@users.noreply.github.com>
Date: Sun, 8 Mar 2026 03:54:48 -0700
Subject: [PATCH 2/6] forgot about url preview images
---
.../components/url-preview/UrlPreviewCard.tsx | 58 ++++++++++++-------
1 file changed, 36 insertions(+), 22 deletions(-)
diff --git a/src/app/components/url-preview/UrlPreviewCard.tsx b/src/app/components/url-preview/UrlPreviewCard.tsx
index 2d59eed4..0aaa5f7d 100644
--- a/src/app/components/url-preview/UrlPreviewCard.tsx
+++ b/src/app/components/url-preview/UrlPreviewCard.tsx
@@ -108,28 +108,42 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s
renderThumbnail={() => }
/>
)}
- {!prev['og:video'] && prev['og:image'] && (
-
- }
- renderImage={(p) => (
-
- )}
- />
-
- )}
+ {!prev['og:video'] && prev['og:image'] && (() => {
+ const ogW = prev['og:image:width'] as number | undefined;
+ const ogH = prev['og:image:height'] as number | undefined;
+ const aspectRatio = ogW && ogH ? `${ogW} / ${ogH}` : undefined;
+ return (
+
+ }
+ renderImage={(p) => (
+
+ )}
+ />
+
+ );
+ })()}
{!prev['og:video'] && !prev['og:image'] && prev['og:audio'] && (
Date: Sun, 8 Mar 2026 03:58:46 -0700
Subject: [PATCH 3/6] is this what knope wanted
---
.changeset/embeddeningpt1.md | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 .changeset/embeddeningpt1.md
diff --git a/.changeset/embeddeningpt1.md b/.changeset/embeddeningpt1.md
new file mode 100644
index 00000000..292a3937
--- /dev/null
+++ b/.changeset/embeddeningpt1.md
@@ -0,0 +1,28 @@
+---
+sable: minor
+---
+
+# The embeddening part 1
+
+#241 by @wrigglebug
+
+### Description
+
+
+
+Adjust media sizing and URL preview layout
+
+#### Type of change
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ x] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] This change requires a documentation update
+
+### Checklist:
+
+- [ ] My code follows the style guidelines of this project
+- [ ] I have performed a self-review of my own code
+- [ ] I have commented my code, particularly in hard-to-understand areas
+- [ ] I have made corresponding changes to the documentation
+- [ ] My changes generate no new warnings
From a68832ea48cbef792a5224653081c929795e2fee Mon Sep 17 00:00:00 2001
From: wrigglebug <133191472+wrigglebug@users.noreply.github.com>
Date: Sun, 8 Mar 2026 04:00:57 -0700
Subject: [PATCH 4/6] prettier
---
.../components/url-preview/UrlPreviewCard.tsx | 74 ++++++++++---------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/app/components/url-preview/UrlPreviewCard.tsx b/src/app/components/url-preview/UrlPreviewCard.tsx
index 0aaa5f7d..4c12486c 100644
--- a/src/app/components/url-preview/UrlPreviewCard.tsx
+++ b/src/app/components/url-preview/UrlPreviewCard.tsx
@@ -108,42 +108,44 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s
renderThumbnail={() => }
/>
)}
- {!prev['og:video'] && prev['og:image'] && (() => {
- const ogW = prev['og:image:width'] as number | undefined;
- const ogH = prev['og:image:height'] as number | undefined;
- const aspectRatio = ogW && ogH ? `${ogW} / ${ogH}` : undefined;
- return (
-
- }
- renderImage={(p) => (
-
- )}
- />
-
- );
- })()}
+ {!prev['og:video'] &&
+ prev['og:image'] &&
+ (() => {
+ const ogW = prev['og:image:width'] as number | undefined;
+ const ogH = prev['og:image:height'] as number | undefined;
+ const aspectRatio = ogW && ogH ? `${ogW} / ${ogH}` : undefined;
+ return (
+
+ }
+ renderImage={(p) => (
+
+ )}
+ />
+
+ );
+ })()}
{!prev['og:video'] && !prev['og:image'] && prev['og:audio'] && (
Date: Sun, 8 Mar 2026 04:04:31 -0700
Subject: [PATCH 5/6] eslint
---
src/app/components/url-preview/UrlPreviewCard.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/components/url-preview/UrlPreviewCard.tsx b/src/app/components/url-preview/UrlPreviewCard.tsx
index 4c12486c..129614ce 100644
--- a/src/app/components/url-preview/UrlPreviewCard.tsx
+++ b/src/app/components/url-preview/UrlPreviewCard.tsx
@@ -111,8 +111,8 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s
{!prev['og:video'] &&
prev['og:image'] &&
(() => {
- const ogW = prev['og:image:width'] as number | undefined;
- const ogH = prev['og:image:height'] as number | undefined;
+ const ogW = prev['og:image:width'];
+ const ogH = prev['og:image:height'];
const aspectRatio = ogW && ogH ? `${ogW} / ${ogH}` : undefined;
return (
Date: Sun, 8 Mar 2026 13:15:49 -0500
Subject: [PATCH 6/6] satisfy knope
---
.changeset/embeddeningpt1.md | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/.changeset/embeddeningpt1.md b/.changeset/embeddeningpt1.md
index 292a3937..0e3f6979 100644
--- a/.changeset/embeddeningpt1.md
+++ b/.changeset/embeddeningpt1.md
@@ -1,28 +1,5 @@
---
-sable: minor
+sable: patch
---
-# The embeddening part 1
-
-#241 by @wrigglebug
-
-### Description
-
-
-
Adjust media sizing and URL preview layout
-
-#### Type of change
-
-- [ ] Bug fix (non-breaking change which fixes an issue)
-- [ x] New feature (non-breaking change which adds functionality)
-- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
-- [ ] This change requires a documentation update
-
-### Checklist:
-
-- [ ] My code follows the style guidelines of this project
-- [ ] I have performed a self-review of my own code
-- [ ] I have commented my code, particularly in hard-to-understand areas
-- [ ] I have made corresponding changes to the documentation
-- [ ] My changes generate no new warnings