From 473f474e2045be3fa7e0cbeed9930d692ceef4ef Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sat, 6 May 2023 16:59:06 +0700 Subject: [PATCH] redesign daily page --- src/app/daily/layout.tsx | 2 +- src/app/daily/pages/index.page.tsx | 60 +++++++++++---------- src/app/note/components/base.tsx | 23 ++++---- src/app/note/components/metadata.tsx | 2 +- src/app/note/components/metadata/like.tsx | 2 +- src/app/note/components/metadata/reply.tsx | 2 +- src/app/note/components/metadata/repost.tsx | 2 +- src/app/note/components/parent.tsx | 27 +++++----- src/app/note/components/preview/image.tsx | 2 +- src/app/note/components/quote.tsx | 27 ++++------ src/app/note/components/quoteRepost.tsx | 11 ++-- src/app/note/components/rootNote.tsx | 4 +- src/shared/appHeader.tsx | 2 +- 13 files changed, 80 insertions(+), 86 deletions(-) diff --git a/src/app/daily/layout.tsx b/src/app/daily/layout.tsx index bb0a7235..864acfa6 100644 --- a/src/app/daily/layout.tsx +++ b/src/app/daily/layout.tsx @@ -20,7 +20,7 @@ export function LayoutNewsfeed({ children }: { children: React.ReactNode }) {
-
{children}
+
{children}
diff --git a/src/app/daily/pages/index.page.tsx b/src/app/daily/pages/index.page.tsx index 18a38919..ee0a4e4e 100644 --- a/src/app/daily/pages/index.page.tsx +++ b/src/app/daily/pages/index.page.tsx @@ -45,46 +45,48 @@ export function Page() { }, [fetchNextPage, allRows.length, rowVirtualizer.getVirtualItems()]); return ( -
+
-
+
{status === 'loading' ? ( ) : status === 'error' ? (
{error.message}
) : ( -
+
-
- {rowVirtualizer.getVirtualItems().map((virtualRow) => { - const note = allRows[virtualRow.index]; - if (note) { - if (note.kind === 1) { - return ( -
- -
- ); - } else { - return ( -
- -
- ); - } + {rowVirtualizer.getVirtualItems().map((virtualRow) => { + const note = allRows[virtualRow.index]; + if (note) { + if (note.kind === 1) { + return ( +
+ +
+ ); + } else { + return ( +
+ +
+ ); } - })} -
+ } + })}
)} diff --git a/src/app/note/components/base.tsx b/src/app/note/components/base.tsx index 64d9b9bc..de607f25 100644 --- a/src/app/note/components/base.tsx +++ b/src/app/note/components/base.tsx @@ -19,18 +19,17 @@ export default function NoteBase({ event }: { event: any }) { }; return ( -
openNote(e)} - className="relative z-10 flex h-min min-h-min w-full select-text flex-col border-b border-zinc-800 px-3 py-5 hover:bg-black/20" - > - {event.parent_id && event.parent_id !== event.event_id && ( - - )} -
- -
- - +
openNote(e)} className="h-min w-full select-text px-3 py-1.5"> +
+ {event.parent_id && event.parent_id !== event.event_id && ( + + )} +
+ +
+ + +
diff --git a/src/app/note/components/metadata.tsx b/src/app/note/components/metadata.tsx index 0b5e20c5..1109799b 100644 --- a/src/app/note/components/metadata.tsx +++ b/src/app/note/components/metadata.tsx @@ -51,7 +51,7 @@ export default function NoteMetadata({ id, eventPubkey }: { id: string; eventPub }); return ( -
+
diff --git a/src/app/note/components/metadata/like.tsx b/src/app/note/components/metadata/like.tsx index c052e85e..a9ea0881 100644 --- a/src/app/note/components/metadata/like.tsx +++ b/src/app/note/components/metadata/like.tsx @@ -44,7 +44,7 @@ export default function NoteLike({ id, pubkey, likes }: { id: string; pubkey: st return ( ); diff --git a/src/app/note/components/metadata/reply.tsx b/src/app/note/components/metadata/reply.tsx index bafc362c..0a4f6f93 100644 --- a/src/app/note/components/metadata/reply.tsx +++ b/src/app/note/components/metadata/reply.tsx @@ -56,7 +56,7 @@ export default function NoteReply({ id, replies }: { id: string; replies: number return ( <> diff --git a/src/app/note/components/metadata/repost.tsx b/src/app/note/components/metadata/repost.tsx index 7b907d7a..9a65e180 100644 --- a/src/app/note/components/metadata/repost.tsx +++ b/src/app/note/components/metadata/repost.tsx @@ -44,7 +44,7 @@ export default function NoteRepost({ id, pubkey, reposts }: { id: string; pubkey return ( ); diff --git a/src/app/note/components/parent.tsx b/src/app/note/components/parent.tsx index b8723843..14b95540 100644 --- a/src/app/note/components/parent.tsx +++ b/src/app/note/components/parent.tsx @@ -38,21 +38,18 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) { const content = !error && data ? noteParser(data) : null; return ( -
-
-
- {data ? ( - <> - -
- - -
- - ) : ( - - )} -
+
+ {data ? ( + <> + +
+ + +
+ + ) : ( + + )}
); }); diff --git a/src/app/note/components/preview/image.tsx b/src/app/note/components/preview/image.tsx index 47204a09..7a03c5fa 100644 --- a/src/app/note/components/preview/image.tsx +++ b/src/app/note/components/preview/image.tsx @@ -3,7 +3,7 @@ import { Image } from '@lume/shared/image'; export default function ImagePreview({ urls }: { urls: string[] }) { return (
-
+
image openNote(e)} - className="relative mb-2 mt-3 rounded-lg border border-zinc-700 bg-zinc-800 p-2 py-3" - > -
- {data ? ( - <> - -
- -
- - ) : ( - - )} -
+
openNote(e)} className="mb-2 mt-3 flex flex-col rounded-lg border border-zinc-800 p-2 py-3"> + {data ? ( + <> + +
+ +
+ + ) : ( + + )}
); }); diff --git a/src/app/note/components/quoteRepost.tsx b/src/app/note/components/quoteRepost.tsx index 9250f059..2a03125b 100644 --- a/src/app/note/components/quoteRepost.tsx +++ b/src/app/note/components/quoteRepost.tsx @@ -8,12 +8,13 @@ export const NoteQuoteRepost = memo(function NoteQuoteRepost({ event }: { event: const rootID = getQuoteID(event.tags); return ( -
-
-
- +
+
+
+ +
+
-
); }); diff --git a/src/app/note/components/rootNote.tsx b/src/app/note/components/rootNote.tsx index c02a39ae..5c39c520 100644 --- a/src/app/note/components/rootNote.tsx +++ b/src/app/note/components/rootNote.tsx @@ -61,7 +61,7 @@ export const RootNote = memo(function RootNote({ id, fallback }: { id: string; f const contentFallback = noteParser(parseFallback); return ( -
openNote(e)} className="relative z-10 flex flex-col"> +
openNote(e)} className="flex flex-col">
@@ -72,7 +72,7 @@ export const RootNote = memo(function RootNote({ id, fallback }: { id: string; f } return ( -
openNote(e)} className="relative z-10 flex flex-col"> +
openNote(e)} className="flex flex-col"> {data ? ( <> diff --git a/src/shared/appHeader.tsx b/src/shared/appHeader.tsx index be5d5b87..9ad4187c 100644 --- a/src/shared/appHeader.tsx +++ b/src/shared/appHeader.tsx @@ -17,7 +17,7 @@ export default function AppHeader() { return (
-
+