fix #35: pass correct value to TootActionGroup
All checks were successful
/ depoly (push) Successful in 1m19s

* add createDefaultTootEnv
This commit is contained in:
thislight 2024-12-26 22:06:15 +08:00
parent 6dd6065711
commit 5742932c86
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
7 changed files with 179 additions and 235 deletions

View file

@ -24,13 +24,19 @@ function isolatedCallback(e: MouseEvent) {
e.stopPropagation();
}
/**
* The actions of the toot card.
*
* The `value` must be the original toot (contains `reblog` if
* it's a boost), since the value will be passed to the callbacks.
*/
function TootActionGroup<T extends mastodon.v1.Status>(props: {
value: T;
class?: string;
}) {
const { reply, boost, favourite, bookmark } = useTootEnv();
let actGrpElement: HTMLDivElement;
const toot = () => props.value;
const toot = () => props.value.reblog ?? props.value;
return (
<div
ref={actGrpElement!}