This commit is contained in:
Shusui MOYATANI
2023-03-01 19:36:41 +09:00
parent 471b03eb1d
commit b1aa63d6a3
10 changed files with 247 additions and 68 deletions

View File

@@ -37,7 +37,10 @@ const DeprecatedRepost: Component<DeprecatedRepostProps> = (props) => {
{' Reposted'}
</div>
</div>
<Show when={event() != null} fallback={<Show when={eventQuery.isLoading}>loading</Show>}>
<Show
when={event() != null}
fallback={<Show when={eventQuery.isLoading}>loading {eventId()}</Show>}
>
<TextNote event={event()} />
</Show>
</div>

View File

@@ -11,7 +11,7 @@ import useProfile from '@/clients/useProfile';
import useConfig from '@/clients/useConfig';
import usePubkey from '@/clients/usePubkey';
import useCommands from '@/clients/useCommands';
import useReactions from '@/clients/useReactions';
// import useReactions from '@/clients/useReactions';
import useDatePulser from '@/hooks/useDatePulser';
import { formatRelative } from '@/utils/formatDate';
import ColumnItem from '@/components/ColumnItem';
@@ -33,6 +33,7 @@ const TextNote: Component<TextNoteProps> = (props) => {
pubkey: props.event.pubkey,
}));
/*
const {
reactions,
isReactedBy,
@@ -43,6 +44,8 @@ const TextNote: Component<TextNoteProps> = (props) => {
}));
const isReactedByMe = createMemo(() => isReactedBy(pubkey()));
*/
const isReactedByMe = () => false;
const replyingToPubKeys = createMemo(() =>
props.event.tags.filter((tag) => tag[0] === 'p').map((e) => e[1]),
@@ -61,10 +64,12 @@ const TextNote: Component<TextNoteProps> = (props) => {
};
const handleReaction: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (ev) => {
/*
if (isReactedByMe()) {
// TODO remove reaction
return;
}
*/
ev.preventDefault();
commands
.publishReaction({
@@ -75,7 +80,7 @@ const TextNote: Component<TextNoteProps> = (props) => {
notifyPubkey: props.event.pubkey,
})
.then(() => {
reactionsQuery.refetch();
// reactionsQuery.refetch();
});
};
@@ -141,7 +146,7 @@ const TextNote: Component<TextNoteProps> = (props) => {
<HeartSolid />
</Show>
</button>
<div class="text-sm text-zinc-400">{reactions().length}</div>
{/* <div class="text-sm text-zinc-400">{reactions().length}</div> */}
</div>
<button class="h-4 w-4 text-zinc-400">
<EllipsisHorizontal />

View File

@@ -61,7 +61,7 @@ const Reaction: Component<ReactionProps> = (props) => {
</div>
</div>
<div class="notification-event">
<Show when={reactedEvent() != null} fallback="loading">
<Show when={reactedEvent() != null} fallback={<>loading {eventId()}</>}>
<TextNote event={reactedEvent()} />
</Show>
</div>