mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 22:44:26 +01:00
fixed bugs
This commit is contained in:
@@ -50,7 +50,7 @@ const Column: Component<ColumnProps> = (props) => {
|
||||
{/* <span class="column-icon">🏠</span> */}
|
||||
<span class="column-name">{props.name}</span>
|
||||
</div>
|
||||
<div class="flex flex-col overflow-y-scroll scroll-smooth">{props.children}</div>
|
||||
<ul class="block flex flex-col overflow-y-scroll scroll-smooth">{props.children}</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ type ColumnItemProps = {
|
||||
};
|
||||
|
||||
const ColumnItem: Component<ColumnItemProps> = (props) => {
|
||||
return <div class="shrink-0 overflow-hidden border-b p-1">{props.children}</div>;
|
||||
return <li class="block shrink-0 overflow-hidden border-b p-1">{props.children}</li>;
|
||||
};
|
||||
|
||||
export default ColumnItem;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Component } from 'solid-js';
|
||||
import { noteEncode } from 'nostr-tools/nip19';
|
||||
|
||||
type EventLinkProps = {
|
||||
eventId: string;
|
||||
};
|
||||
|
||||
const EventLink: Component<EventLinkProps> = (props) => (
|
||||
<span class="text-blue-500 underline">{props.eventId}</span>
|
||||
<span class="text-blue-500 underline">{noteEncode(props.eventId)}</span>
|
||||
);
|
||||
|
||||
export default EventLink;
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { createSignal, createMemo, onMount, For, type Component, type JSX, Show } from 'solid-js';
|
||||
import {
|
||||
createSignal,
|
||||
createMemo,
|
||||
onMount,
|
||||
Show,
|
||||
For,
|
||||
type Component,
|
||||
type JSX,
|
||||
type Accessor,
|
||||
} from 'solid-js';
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import PaperAirplane from 'heroicons/24/solid/paper-airplane.svg';
|
||||
@@ -41,7 +50,14 @@ const NotePostForm: Component<NotePostFormProps> = (props) => {
|
||||
|
||||
const replyTo = () => props.replyTo && eventWrapper(props.replyTo);
|
||||
const mode = () => props.mode ?? 'normal';
|
||||
const notifyPubkeys = createMemo(() => replyTo()?.mentionedPubkeys() ?? []);
|
||||
|
||||
const mentionedPubkeys: Accessor<string[]> = createMemo(
|
||||
() => replyTo()?.mentionedPubkeysWithoutAuthor() ?? [],
|
||||
);
|
||||
const notifyPubkeys = (pubkey: string): string[] | undefined => {
|
||||
if (mentionedPubkeys().length === 0) return undefined;
|
||||
return [...mentionedPubkeys(), pubkey];
|
||||
};
|
||||
|
||||
const handleChangeText: JSX.EventHandler<HTMLTextAreaElement, Event> = (ev) => {
|
||||
setText(ev.currentTarget.value);
|
||||
@@ -58,7 +74,7 @@ const NotePostForm: Component<NotePostFormProps> = (props) => {
|
||||
relayUrls: config().relayUrls,
|
||||
pubkey,
|
||||
content: text(),
|
||||
notifyPubkeys: notifyPubkeys(),
|
||||
notifyPubkeys: notifyPubkeys(pubkey),
|
||||
rootEventId: replyTo()?.rootEvent()?.id ?? replyTo()?.id,
|
||||
replyEventId: replyTo()?.id,
|
||||
})
|
||||
@@ -95,9 +111,9 @@ const NotePostForm: Component<NotePostFormProps> = (props) => {
|
||||
|
||||
return (
|
||||
<div class="p-1">
|
||||
<Show when={notifyPubkeys().length > 0}>
|
||||
<Show when={mentionedPubkeys().length > 0}>
|
||||
<div>
|
||||
<For each={notifyPubkeys()}>
|
||||
<For each={mentionedPubkeys()}>
|
||||
{(pubkey) => (
|
||||
<>
|
||||
<UserNameDisplay pubkey={pubkey} />{' '}
|
||||
|
||||
@@ -15,10 +15,7 @@ const MentionedEventDisplay = (props: MentionedEventDisplayProps) => {
|
||||
props.mentionedEvent.marker.length === 0 ||
|
||||
props.mentionedEvent.marker === 'mention'
|
||||
}
|
||||
fallback={() => {
|
||||
console.log(props.mentionedEvent);
|
||||
return <EventLink eventId={props.mentionedEvent.eventId} />;
|
||||
}}
|
||||
fallback={() => <EventLink eventId={props.mentionedEvent.eventId} />}
|
||||
>
|
||||
<div class="my-1 rounded border p-1">
|
||||
<TextNoteDisplayById
|
||||
|
||||
@@ -51,6 +51,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
const pubkey = usePubkey();
|
||||
|
||||
const [showReplyForm, setShowReplyForm] = createSignal(false);
|
||||
const [showMenu, setShowMenu] = createSignal(false);
|
||||
const [postingRepost, setPostingRepost] = createSignal(false);
|
||||
const [postingReaction, setPostingReaction] = createSignal(false);
|
||||
|
||||
@@ -172,7 +173,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
</div>
|
||||
<Show when={showReplyEvent()} keyed>
|
||||
{(id) => (
|
||||
<div class="rounded border p-1">
|
||||
<div class="relative border p-1">
|
||||
<TextNoteDisplayById eventId={id} actions={false} embedding={false} />
|
||||
</div>
|
||||
)}
|
||||
@@ -197,13 +198,13 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
<Show when={actions()}>
|
||||
<div class="actions flex w-48 items-center justify-between gap-8 pt-1">
|
||||
<button
|
||||
class="h-4 w-4 text-zinc-400"
|
||||
class="h-4 w-4 shrink-0 text-zinc-400"
|
||||
onClick={() => setShowReplyForm((current) => !current)}
|
||||
>
|
||||
<ChatBubbleLeft />
|
||||
</button>
|
||||
<div
|
||||
class="flex items-center gap-1"
|
||||
class="flex shrink-0 items-center gap-1"
|
||||
classList={{
|
||||
'text-zinc-400': !isRepostedByMe(),
|
||||
'text-green-400': isRepostedByMe(),
|
||||
@@ -217,7 +218,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
</Show>
|
||||
</div>
|
||||
<div
|
||||
class="flex items-center gap-1"
|
||||
class="flex shrink-0 items-center gap-1"
|
||||
classList={{
|
||||
'text-zinc-400': !isReactedByMe(),
|
||||
'text-rose-400': isReactedByMe(),
|
||||
@@ -232,9 +233,14 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
<div class="text-sm text-zinc-400">{reactions().length}</div>
|
||||
</Show>
|
||||
</div>
|
||||
<button class="h-4 w-4 text-zinc-400">
|
||||
<EllipsisHorizontal />
|
||||
</button>
|
||||
<div class="relative">
|
||||
<button
|
||||
class="h-4 w-4 text-zinc-400"
|
||||
onClick={() => setShowMenu((current) => !current)}
|
||||
>
|
||||
<EllipsisHorizontal />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Switch, Match, type Component } from 'solid-js';
|
||||
import { noteEncode } from 'nostr-tools/nip19';
|
||||
|
||||
import TextNoteDisplay, { type TextNoteDisplayProps } from '@/components/textNote/TextNoteDisplay';
|
||||
|
||||
@@ -6,6 +7,7 @@ import useConfig from '@/nostr/useConfig';
|
||||
import useEvent from '@/nostr/useEvent';
|
||||
|
||||
import ensureNonNull from '@/utils/ensureNonNull';
|
||||
import EventLink from '../EventLink';
|
||||
|
||||
type TextNoteDisplayByIdProps = Omit<TextNoteDisplayProps, 'event'> & {
|
||||
eventId: string | undefined;
|
||||
@@ -25,11 +27,13 @@ const TextNoteDisplayById: Component<TextNoteDisplayByIdProps> = (props) => {
|
||||
<Match when={event()} keyed>
|
||||
{(ev) => <TextNoteDisplay event={ev} {...props} />}
|
||||
</Match>
|
||||
<Match when={eventQuery.isLoading}>
|
||||
<div class="truncate">
|
||||
{'読み込み中 '}
|
||||
<span>{props.eventId}</span>
|
||||
</div>
|
||||
<Match when={eventQuery.isLoading && props.eventId} keyed>
|
||||
{(id) => (
|
||||
<div class="truncate">
|
||||
{'読み込み中 '}
|
||||
<EventLink eventId={id} />
|
||||
</div>
|
||||
)}
|
||||
</Match>
|
||||
</Switch>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user