RegularToot: supports bot mark
All checks were successful
/ depoly (push) Successful in 1m19s

This commit is contained in:
thislight 2024-11-05 16:20:13 +08:00
parent bda41f0923
commit d2df08f140
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
2 changed files with 26 additions and 16 deletions

View file

@ -20,6 +20,7 @@ import {
StarOutline, StarOutline,
Bookmark, Bookmark,
Share, Share,
SmartToySharp,
} from "@suid/icons-material"; } from "@suid/icons-material";
import { useTimeSource } from "../platform/timesrc.js"; import { useTimeSource } from "../platform/timesrc.js";
import { resolveCustomEmoji } from "../masto/toot.js"; import { resolveCustomEmoji } from "../masto/toot.js";
@ -151,17 +152,22 @@ function TootAuthorGroup(
<div class={tootStyle.tootAuthorGrp} {...rest}> <div class={tootStyle.tootAuthorGrp} {...rest}>
<Img src={toot().account.avatar} class={tootStyle.tootAvatar} /> <Img src={toot().account.avatar} class={tootStyle.tootAvatar} />
<div class={tootStyle.tootAuthorNameGrp}> <div class={tootStyle.tootAuthorNameGrp}>
<Body2 <div class={tootStyle.tootAuthorNamePrimary}>
class={tootStyle.tootAuthorNamePrimary} <Show when={toot().account.bot}>
ref={(e: { innerHTML: string }) => { <SmartToySharp class="bot-mark" aria-label="Bot" />
createRenderEffect(() => { </Show>
e.innerHTML = resolveCustomEmoji( <Body2
toot().account.displayName, component="span"
toot().account.emojis, ref={(e: { innerHTML: string }) => {
); createRenderEffect(() => {
}); e.innerHTML = resolveCustomEmoji(
}} toot().account.displayName,
/> toot().account.emojis,
);
});
}}
/>
</div>
<time datetime={toot().createdAt}> <time datetime={toot().createdAt}>
{formatRelative(toot().createdAt, managed.now, { {formatRelative(toot().createdAt, managed.now, {
locale: dateFnLocale(), locale: dateFnLocale(),

View file

@ -49,10 +49,7 @@
.tootAuthorNameGrp { .tootAuthorNameGrp {
display: grid; display: grid;
grid-template-columns: 1fr auto; grid-template-columns: 1fr auto;
color: var(--tutu-color-secondary-text-on-surface);
>* {
color: var(--tutu-color-secondary-text-on-surface);
}
> :last-child { > :last-child {
grid-column: 1 /3; grid-column: 1 /3;
@ -70,7 +67,14 @@
} }
.tootAuthorNamePrimary { .tootAuthorNamePrimary {
color: revert; color: var(--tutu-color-on-surface);
display: flex;
align-items: center;
gap: 4px;
> :global(.bot-mark) {
font-size: 1.2em;
}
} }
.tootAvatar { .tootAvatar {