mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 22:14:26 +01:00
fix
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { Show } from 'solid-js';
|
import { Show } from 'solid-js';
|
||||||
|
|
||||||
|
import { Kind } from 'nostr-tools';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-cycle
|
// eslint-disable-next-line import/no-cycle
|
||||||
import EventDisplayById from '@/components/event/EventDisplayById';
|
import EventDisplayById from '@/components/event/EventDisplayById';
|
||||||
import EventLink from '@/components/EventLink';
|
import EventLink from '@/components/EventLink';
|
||||||
@@ -20,6 +22,7 @@ const MentionedEventDisplay = (props: MentionedEventDisplayProps) => {
|
|||||||
eventId={props.mentionedEvent.eventId}
|
eventId={props.mentionedEvent.eventId}
|
||||||
embedding={false}
|
embedding={false}
|
||||||
actions={false}
|
actions={false}
|
||||||
|
ensureKinds={[Kind.Text]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ const TextNoteContentDisplay = (props: TextNoteContentDisplayProps) => {
|
|||||||
if (emojiUrl == null) return <span>{item.content}</span>;
|
if (emojiUrl == null) return <span>{item.content}</span>;
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
class="inline-block h-7 max-w-[64px] align-middle"
|
class="inline-block h-8 max-w-[128px] align-middle"
|
||||||
src={emojiUrl}
|
src={emojiUrl}
|
||||||
alt={item.shortcode}
|
alt={item.content}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { For, Switch, Match, type Component } from 'solid-js';
|
import { For, Switch, Match, type Component, Show } from 'solid-js';
|
||||||
|
|
||||||
import { Kind, type Event as NostrEvent } from 'nostr-tools';
|
import { Kind, type Event as NostrEvent } from 'nostr-tools';
|
||||||
|
|
||||||
@@ -6,33 +6,38 @@ import ColumnItem from '@/components/ColumnItem';
|
|||||||
import Reaction from '@/components/event/Reaction';
|
import Reaction from '@/components/event/Reaction';
|
||||||
import Repost from '@/components/event/Repost';
|
import Repost from '@/components/event/Repost';
|
||||||
import TextNote from '@/components/event/TextNote';
|
import TextNote from '@/components/event/TextNote';
|
||||||
|
import useConfig from '@/core/useConfig';
|
||||||
|
|
||||||
export type NotificationProps = {
|
export type NotificationProps = {
|
||||||
events: NostrEvent[];
|
events: NostrEvent[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const Notification: Component<NotificationProps> = (props) => {
|
const Notification: Component<NotificationProps> = (props) => {
|
||||||
|
const { shouldMuteEvent } = useConfig();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<For each={props.events}>
|
<For each={props.events}>
|
||||||
{(event) => (
|
{(event) => (
|
||||||
<Switch fallback={<div>unknown event</div>}>
|
<Show when={!shouldMuteEvent(event)}>
|
||||||
<Match when={event.kind === Kind.Text}>
|
<Switch fallback={<div>unknown event</div>}>
|
||||||
<ColumnItem>
|
<Match when={event.kind === Kind.Text}>
|
||||||
<TextNote event={event} />
|
<ColumnItem>
|
||||||
</ColumnItem>
|
<TextNote event={event} />
|
||||||
</Match>
|
</ColumnItem>
|
||||||
<Match when={event.kind === Kind.Reaction}>
|
</Match>
|
||||||
<ColumnItem>
|
<Match when={event.kind === Kind.Reaction}>
|
||||||
<Reaction event={event} />
|
<ColumnItem>
|
||||||
</ColumnItem>
|
<Reaction event={event} />
|
||||||
</Match>
|
</ColumnItem>
|
||||||
{/* TODO ちゃんとnotification用のコンポーネント使う */}
|
</Match>
|
||||||
<Match when={(event.kind as number) === 6}>
|
{/* TODO ちゃんとnotification用のコンポーネント使う */}
|
||||||
<ColumnItem>
|
<Match when={(event.kind as number) === 6}>
|
||||||
<Repost event={event} />
|
<ColumnItem>
|
||||||
</ColumnItem>
|
<Repost event={event} />
|
||||||
</Match>
|
</ColumnItem>
|
||||||
</Switch>
|
</Match>
|
||||||
|
</Switch>
|
||||||
|
</Show>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const isImageUrl = (urlString: string): boolean => {
|
export const isImageUrl = (urlString: string): boolean => {
|
||||||
try {
|
try {
|
||||||
const url = new URL(urlString);
|
const url = new URL(urlString);
|
||||||
return /\.(jpeg|jpg|png|gif|webp|apng)$/i.test(url.pathname);
|
return /\.(jpeg|jpg|png|gif|webp|apng|svg)$/i.test(url.pathname);
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user