This commit is contained in:
Shusui MOYATANI
2023-05-16 12:48:42 +09:00
parent b343e21bfb
commit 12e38f85d9
4 changed files with 30 additions and 22 deletions

View File

@@ -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>

View File

@@ -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}
/> />
); );
} }

View File

@@ -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,15 +6,19 @@ 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) => (
<Show when={!shouldMuteEvent(event)}>
<Switch fallback={<div>unknown event</div>}> <Switch fallback={<div>unknown event</div>}>
<Match when={event.kind === Kind.Text}> <Match when={event.kind === Kind.Text}>
<ColumnItem> <ColumnItem>
@@ -33,6 +37,7 @@ const Notification: Component<NotificationProps> = (props) => {
</ColumnItem> </ColumnItem>
</Match> </Match>
</Switch> </Switch>
</Show>
)} )}
</For> </For>
); );

View File

@@ -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;
} }