diff --git a/src/index.css b/src/index.css index 88af235d..b81750c8 100644 --- a/src/index.css +++ b/src/index.css @@ -33,6 +33,10 @@ button { @apply outline-fuchsia-500; } +iframe { + height: auto !important; +} + /* For Webkit-based browsers (Chrome, Safari and Opera) */ .scrollbar-hide::-webkit-scrollbar { display: none; diff --git a/src/shared/notes/mentions/note.tsx b/src/shared/notes/mentions/note.tsx index 85ba86b1..ac392ead 100644 --- a/src/shared/notes/mentions/note.tsx +++ b/src/shared/notes/mentions/note.tsx @@ -56,8 +56,8 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) { }, }} > - {data?.content?.parsed?.length > 200 - ? data.content.parsed.substring(0, 200) + '...' + {data?.content?.parsed?.length > 160 + ? data.content.parsed.substring(0, 160) + '...' : data.content.parsed} diff --git a/src/shared/notes/preview/video.tsx b/src/shared/notes/preview/video.tsx index 85a76580..320cd412 100644 --- a/src/shared/notes/preview/video.tsx +++ b/src/shared/notes/preview/video.tsx @@ -2,7 +2,7 @@ import ReactPlayer from 'react-player/es6'; export function VideoPreview({ urls }: { urls: string[] }) { return ( -
+
{urls.map((url) => ( el.pubkey !== pubkey); + const sorted = filterSelf.sort((a, b) => a.created_at - b.created_at); + return sorted as unknown as LumeEvent[]; }, { refetchOnWindowFocus: false, @@ -33,36 +34,13 @@ export function NotificationModal({ pubkey }: { pubkey: string }) { (event: NDKEvent) => { switch (event.kind) { case 1: - return ( -
- -
-

- {event.content} -

-
-
- ); + return ; case 6: - return ( -
- -
- ); + return ; case 7: - return ( -
- -
- ); - case 9735: - return ( -
- -
- ); + return ; default: - return
{event.content}
; + return null; } }, [data] diff --git a/src/shared/notification/types/mention.tsx b/src/shared/notification/types/mention.tsx new file mode 100644 index 00000000..7f730e97 --- /dev/null +++ b/src/shared/notification/types/mention.tsx @@ -0,0 +1,34 @@ +import { NDKEvent } from '@nostr-dev-kit/ndk'; +import { useMemo } from 'react'; + +import { MentionNote, NoteContent } from '@shared/notes'; +import { NotiUser } from '@shared/notification'; + +import { formatCreatedAt } from '@utils/createdAt'; +import { parser } from '@utils/parser'; + +export function NotiMention({ event }: { event: NDKEvent }) { + const replyTo = event.tags.find((e) => e[0] === 'e')?.[1]; + const createdAt = formatCreatedAt(event.created_at); + const content = useMemo(() => parser(event), [event]); + + return ( +
+
+
+ +

reply your post

+
+
+ {createdAt} +
+
+
+
+ +
+ {replyTo && } +
+
+ ); +} diff --git a/src/shared/notification/types/reaction.tsx b/src/shared/notification/types/reaction.tsx new file mode 100644 index 00000000..26b962e2 --- /dev/null +++ b/src/shared/notification/types/reaction.tsx @@ -0,0 +1,26 @@ +import { NDKEvent } from '@nostr-dev-kit/ndk'; + +import { MentionNote } from '@shared/notes'; +import { NotiUser } from '@shared/notification'; + +import { formatCreatedAt } from '@utils/createdAt'; + +export function NotiReaction({ event }: { event: NDKEvent }) { + const root = event.tags.find((e) => e[0] === 'e')?.[1]; + const createdAt = formatCreatedAt(event.created_at); + + return ( +
+
+
+ +

reacted {event.content}

+
+
+ {createdAt} +
+
+
{root && }
+
+ ); +} diff --git a/src/shared/notification/types/repost.tsx b/src/shared/notification/types/repost.tsx new file mode 100644 index 00000000..22a20063 --- /dev/null +++ b/src/shared/notification/types/repost.tsx @@ -0,0 +1,26 @@ +import { NDKEvent } from '@nostr-dev-kit/ndk'; + +import { MentionNote } from '@shared/notes'; +import { NotiUser } from '@shared/notification'; + +import { formatCreatedAt } from '@utils/createdAt'; + +export function NotiRepost({ event }: { event: NDKEvent }) { + const root = event.tags.find((e) => e[0] === 'e')?.[1]; + const createdAt = formatCreatedAt(event.created_at); + + return ( +
+
+
+ +

repost your post

+
+
+ {createdAt} +
+
+
{root && }
+
+ ); +} diff --git a/src/shared/notification/user.tsx b/src/shared/notification/user.tsx index 38841659..41864519 100644 --- a/src/shared/notification/user.tsx +++ b/src/shared/notification/user.tsx @@ -3,39 +3,35 @@ import { Image } from '@shared/image'; import { DEFAULT_AVATAR } from '@stores/constants'; import { useProfile } from '@utils/hooks/useProfile'; -import { shortenKey } from '@utils/shortenKey'; +import { displayNpub } from '@utils/shortenKey'; -export function NotificationUser({ pubkey, desc }: { pubkey: string; desc: string }) { +export function NotiUser({ pubkey }: { pubkey: string }) { const { status, user } = useProfile(pubkey); if (status === 'loading') { return ( -
-
+
+
-
); } return ( -
-
+
+
{pubkey}
-
- - {user.nip05 || user.name || user.displayName || shortenKey(pubkey)} - - {desc} -
+ + {user.nip05 || user.name || user.displayName || displayNpub(pubkey, 16)} +
); } diff --git a/src/utils/hooks/useProfile.tsx b/src/utils/hooks/useProfile.tsx index 7479cc44..eb5a1b2a 100644 --- a/src/utils/hooks/useProfile.tsx +++ b/src/utils/hooks/useProfile.tsx @@ -18,7 +18,6 @@ export function useProfile(pubkey: string, fallback?: string) { const current = Math.floor(Date.now() / 1000); const cache = await getUserMetadata(pubkey); if (cache && parseInt(cache.created_at) + 86400 >= current) { - console.log('cache hit:', cache); return JSON.parse(cache.content); } else { const filter: NDKFilter = { kinds: [0], authors: [pubkey] };