mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-08 01:45:28 +00:00
Format and automatically fix linted code.
This commit is contained in:
@@ -22,7 +22,7 @@ export default function Embed({ embed }: Props) {
|
||||
// ! FIXME: temp code
|
||||
// ! add proxy function to client
|
||||
function proxyImage(url: string) {
|
||||
return "https://jan.revolt.chat/proxy?url=" + encodeURIComponent(url);
|
||||
return `https://jan.revolt.chat/proxy?url=${encodeURIComponent(url)}`;
|
||||
}
|
||||
|
||||
const { openScreen } = useIntermediate();
|
||||
@@ -35,14 +35,14 @@ export default function Embed({ embed }: Props) {
|
||||
w: number,
|
||||
h: number,
|
||||
): { width: number; height: number } {
|
||||
let limitingWidth = Math.min(maxWidth, w);
|
||||
const limitingWidth = Math.min(maxWidth, w);
|
||||
|
||||
let limitingHeight = Math.min(MAX_EMBED_HEIGHT, h);
|
||||
const limitingHeight = Math.min(MAX_EMBED_HEIGHT, h);
|
||||
|
||||
// Calculate smallest possible WxH.
|
||||
let width = Math.min(limitingWidth, limitingHeight * (w / h));
|
||||
const width = Math.min(limitingWidth, limitingHeight * (w / h));
|
||||
|
||||
let height = Math.min(limitingHeight, limitingWidth * (h / w));
|
||||
const height = Math.min(limitingHeight, limitingWidth * (h / w));
|
||||
|
||||
return { width, height };
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export default function Embed({ embed }: Props) {
|
||||
case "Website": {
|
||||
// Determine special embed size.
|
||||
let mw, mh;
|
||||
let largeMedia =
|
||||
const largeMedia =
|
||||
(embed.special && embed.special.type !== "None") ||
|
||||
embed.image?.size === "Large";
|
||||
switch (embed.special?.type) {
|
||||
@@ -80,7 +80,7 @@ export default function Embed({ embed }: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
let { width, height } = calculateSize(mw, mh);
|
||||
const { width, height } = calculateSize(mw, mh);
|
||||
return (
|
||||
<div
|
||||
className={classNames(styles.embed, styles.website)}
|
||||
@@ -115,7 +115,8 @@ export default function Embed({ embed }: Props) {
|
||||
<a
|
||||
href={embed.url}
|
||||
target={"_blank"}
|
||||
className={styles.title}>
|
||||
className={styles.title}
|
||||
rel="noreferrer">
|
||||
{embed.title}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function EmbedMedia({ embed, width, height }: Props) {
|
||||
// ! FIXME: temp code
|
||||
// ! add proxy function to client
|
||||
function proxyImage(url: string) {
|
||||
return "https://jan.revolt.chat/proxy?url=" + encodeURIComponent(url);
|
||||
return `https://jan.revolt.chat/proxy?url=${encodeURIComponent(url)}`;
|
||||
}
|
||||
|
||||
if (embed.type !== "Website") return null;
|
||||
@@ -75,7 +75,7 @@ export default function EmbedMedia({ embed, width, height }: Props) {
|
||||
}
|
||||
default: {
|
||||
if (embed.image) {
|
||||
let url = embed.image.url;
|
||||
const url = embed.image.url;
|
||||
return (
|
||||
<img
|
||||
className={styles.image}
|
||||
|
||||
@@ -16,9 +16,13 @@ export default function EmbedMediaActions({ embed }: Props) {
|
||||
<div className={styles.actions}>
|
||||
<span className={styles.filename}>{filename}</span>
|
||||
<span className={styles.filesize}>
|
||||
{embed.width + "x" + embed.height}
|
||||
{`${embed.width}x${embed.height}`}
|
||||
</span>
|
||||
<a href={embed.url} class={styles.openIcon} target="_blank">
|
||||
<a
|
||||
href={embed.url}
|
||||
class={styles.openIcon}
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<IconButton>
|
||||
<LinkExternal size={24} />
|
||||
</IconButton>
|
||||
|
||||
Reference in New Issue
Block a user