From f46f4530a6234a79c927f2cff5e82234cd9dfe94 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sun, 7 May 2023 09:12:32 +0700 Subject: [PATCH] add note wrapper --- src/app/daily/pages/index.page.tsx | 2 +- src/app/note/components/base.tsx | 25 ++++++------------- src/app/note/components/content.tsx | 2 +- src/app/note/components/quote.tsx | 18 +++++--------- src/app/note/components/quoteRepost.tsx | 11 ++++----- src/app/note/components/replies/form.tsx | 2 +- src/app/note/components/replies/item.tsx | 2 +- src/app/note/components/replies/list.tsx | 6 ++--- src/app/note/components/wrapper.tsx | 26 ++++++++++++++++++++ src/app/note/pages/index.page.tsx | 31 ++++++------------------ 10 files changed, 58 insertions(+), 67 deletions(-) create mode 100644 src/app/note/components/wrapper.tsx diff --git a/src/app/daily/pages/index.page.tsx b/src/app/daily/pages/index.page.tsx index ed0fcaf1..c6c3201a 100644 --- a/src/app/daily/pages/index.page.tsx +++ b/src/app/daily/pages/index.page.tsx @@ -1,5 +1,5 @@ import { Header } from '@lume/app/daily/components/header'; -import NoteBase from '@lume/app/note/components/base'; +import { NoteBase } from '@lume/app/note/components/base'; import { NoteQuoteRepost } from '@lume/app/note/components/quoteRepost'; import { getNotes } from '@lume/utils/storage'; diff --git a/src/app/note/components/base.tsx b/src/app/note/components/base.tsx index 1a9738de..8be72505 100644 --- a/src/app/note/components/base.tsx +++ b/src/app/note/components/base.tsx @@ -2,28 +2,17 @@ import { NoteContent } from '@lume/app/note/components/content'; import NoteMetadata from '@lume/app/note/components/metadata'; import { NoteParent } from '@lume/app/note/components/parent'; import { NoteDefaultUser } from '@lume/app/note/components/user/default'; +import { NoteWrapper } from '@lume/app/note/components/wrapper'; import { noteParser } from '@lume/utils/parser'; -import { navigate } from 'vite-plugin-ssr/client/router'; - -export default function NoteBase({ event }: { event: any }) { +export const NoteBase = ({ event }: { event: any }) => { const content = noteParser(event); - - const openNote = (e) => { - const selection = window.getSelection(); - if (selection.toString().length === 0) { - navigate(`/app/note?id=${event.parent_id}`); - } else { - e.stopPropagation(); - } - }; + const href = event.parent_id ? `/app/note?id=${event.parent_id}` : `/app/note?id=${event.event_id}`; return ( -