parent
31b27237cd
commit
f4c0104d48
7 changed files with 179 additions and 150 deletions
src/timelines
|
@ -4,7 +4,6 @@ import {
|
|||
createRenderEffect,
|
||||
createResource,
|
||||
createSignal,
|
||||
For,
|
||||
Show,
|
||||
type Component,
|
||||
} from "solid-js";
|
||||
|
@ -17,7 +16,7 @@ import {
|
|||
} from "@suid/icons-material";
|
||||
import { useSessionForAcctStr } from "../masto/clients";
|
||||
import { resolveCustomEmoji } from "../masto/toot";
|
||||
import RegularToot from "./RegularToot";
|
||||
import RegularToot, { findElementActionable } from "./RegularToot";
|
||||
import type { mastodon } from "masto";
|
||||
import cards from "../material/cards.module.css";
|
||||
import { css } from "solid-styled";
|
||||
|
@ -186,6 +185,33 @@ const TootBottomSheet: Component = (props) => {
|
|||
return Array.from(new Set(values).keys());
|
||||
};
|
||||
|
||||
const handleMainTootClick = (
|
||||
event: MouseEvent & { currentTarget: HTMLElement },
|
||||
) => {
|
||||
const actionableElement = findElementActionable(
|
||||
event.target as HTMLElement,
|
||||
event.currentTarget,
|
||||
);
|
||||
|
||||
if (actionableElement) {
|
||||
if (actionableElement.dataset.action === "acct") {
|
||||
event.stopPropagation();
|
||||
|
||||
const target = actionableElement as HTMLAnchorElement;
|
||||
|
||||
const acct = encodeURIComponent(
|
||||
target.dataset.client || `@${new URL(target.href).origin}`,
|
||||
);
|
||||
|
||||
navigate(`/${acct}/profile/${target.dataset.acctId}`);
|
||||
|
||||
return;
|
||||
} else {
|
||||
console.warn("unknown action", actionableElement.dataset.rel);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
css`
|
||||
.name :global(img) {
|
||||
max-height: 1em;
|
||||
|
@ -258,6 +284,7 @@ const TootBottomSheet: Component = (props) => {
|
|||
onBookmark={onBookmark}
|
||||
onRetoot={onBoost}
|
||||
onFavourite={onFav}
|
||||
onClick={handleMainTootClick}
|
||||
></RegularToot>
|
||||
</Show>
|
||||
</article>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue