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

View file

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