diff --git a/src/profiles/Profile.tsx b/src/profiles/Profile.tsx index 9024820..2711a63 100644 --- a/src/profiles/Profile.tsx +++ b/src/profiles/Profile.tsx @@ -116,6 +116,13 @@ const Profile: Component = () => { gap: 16px; } + .description { + & :global(a) { + color: inherit; + font-style: italic; + } + } + .acct-grp { display: flex; flex-flow: row wrap; @@ -274,6 +281,7 @@ const Profile: Component = () => { average: colors.hex, text: colors.isDark ? "white" : "black", }); + ins.destroy(); }} > @@ -309,6 +317,7 @@ const Profile: Component = () => {
createRenderEffect(() => (e.innerHTML = description() || "")) } diff --git a/src/timelines/MediaAttachmentGrid.tsx b/src/timelines/MediaAttachmentGrid.tsx index dcc5af1..c9da6a3 100644 --- a/src/timelines/MediaAttachmentGrid.tsx +++ b/src/timelines/MediaAttachmentGrid.tsx @@ -2,6 +2,7 @@ import type { mastodon } from "masto"; import { type Component, For, + Index, createMemo, createRenderEffect, createSignal, @@ -103,6 +104,31 @@ const MediaAttachmentGrid: Component<{ }; }); + const itemStyle = (item: mastodon.v1.MediaAttachment) => { + const { width, height } = constraintedSize( + item.meta?.small || { width: 1, height: 1 }, + { width: 2, height: 2 }, + itemMaxSize(), + ); + + // I don't know why mastodon does not return this + // and the condition for it to return this. + // Anyway, It is useless now. + // My hope is the FastAverageColor, but + // we may need better tool to manage the performance impact + // before using this. See #37. + // TODO: use fast average color to extract accent color + const accentColor = item.meta?.colors?.accent; + + return Object.assign( + { + width: `${width}px`, + height: `${height}px`, + }, + accentColor ? { "--media-color-accent": accentColor } : {}, + ); + }; + css` .attachments { column-count: ${columnCount().toString()}; @@ -118,68 +144,48 @@ const MediaAttachmentGrid: Component<{ } }} > - + {(item, index) => { - // I don't know why mastodon does not return this - // and the condition for it to return this. - // Anyway, It is useless now. - // My hope is the FastAverageColor, but - // we may need better tool to manage the performance impact - // before using this. See #37. - // TODO: use fast average color to extract accent color - const accentColor = item.meta?.colors?.accent; - const { width, height } = item.meta?.small || {}; - - const size = () => { - return constraintedSize( - item.meta?.small || { width: 1, height: 1 }, - { width: 2, height: 2 }, - itemMaxSize(), - ); - }; - - switch (item.type) { + switch (item().type) { case "image": return ( {item.description ); case "video": return ( + ); };