From d1701eff2085a8226e21e9a21d09b2f7106982cd Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:14:45 +0700 Subject: [PATCH] add focus button to note actionbar --- src/app/notes/article.tsx | 2 +- src/app/notes/text.tsx | 2 +- src/app/space/components/widgets/thread.tsx | 6 +- src/shared/icons/focus.tsx | 22 +++++++ src/shared/icons/index.tsx | 1 + src/shared/notes/actions.tsx | 73 +++++++++++++-------- src/shared/notes/actions/more.tsx | 10 +-- src/utils/hooks/useEvent.ts | 21 ++++++ 8 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 src/shared/icons/focus.tsx diff --git a/src/app/notes/article.tsx b/src/app/notes/article.tsx index d020465f..9a20abc6 100644 --- a/src/app/notes/article.tsx +++ b/src/app/notes/article.tsx @@ -103,7 +103,7 @@ export function ArticleNoteScreen() {
{renderKind(data)}
- +
diff --git a/src/app/notes/text.tsx b/src/app/notes/text.tsx index 4fce67d4..93884486 100644 --- a/src/app/notes/text.tsx +++ b/src/app/notes/text.tsx @@ -109,7 +109,7 @@ export function TextNoteScreen() {
{renderKind(data)}
- +
diff --git a/src/app/space/components/widgets/thread.tsx b/src/app/space/components/widgets/thread.tsx index 6d3d42cd..c0e81ba5 100644 --- a/src/app/space/components/widgets/thread.tsx +++ b/src/app/space/components/widgets/thread.tsx @@ -55,7 +55,11 @@ export function ThreadBlock({ params }: { params: Widget }) {
{renderKind(data)}
- +
diff --git a/src/shared/icons/focus.tsx b/src/shared/icons/focus.tsx new file mode 100644 index 00000000..085fa6ff --- /dev/null +++ b/src/shared/icons/focus.tsx @@ -0,0 +1,22 @@ +import { SVGProps } from 'react'; + +export function FocusIcon(props: JSX.IntrinsicAttributes & SVGProps) { + return ( + + + + ); +} diff --git a/src/shared/icons/index.tsx b/src/shared/icons/index.tsx index c6cbd08c..babf8484 100644 --- a/src/shared/icons/index.tsx +++ b/src/shared/icons/index.tsx @@ -52,3 +52,4 @@ export * from './hashtag'; export * from './file'; export * from './share'; export * from './expand'; +export * from './focus'; diff --git a/src/shared/notes/actions.tsx b/src/shared/notes/actions.tsx index 11cd3d7d..2e536888 100644 --- a/src/shared/notes/actions.tsx +++ b/src/shared/notes/actions.tsx @@ -1,8 +1,9 @@ import * as Tooltip from '@radix-ui/react-tooltip'; +import { Link } from 'react-router-dom'; import { useStorage } from '@libs/storage/provider'; -import { ThreadIcon } from '@shared/icons'; +import { FocusIcon, ThreadIcon } from '@shared/icons'; import { MoreActions } from '@shared/notes/actions/more'; import { NoteReaction } from '@shared/notes/actions/reaction'; import { NoteReply } from '@shared/notes/actions/reply'; @@ -14,12 +15,12 @@ import { WidgetKinds, useWidgets } from '@stores/widgets'; export function NoteActions({ id, pubkey, - noOpenThread, + extraButtons = true, root, }: { id: string; pubkey: string; - noOpenThread?: boolean; + extraButtons?: boolean; root?: string; }) { const { db } = useStorage(); @@ -34,32 +35,50 @@ export function NoteActions({ - {!noOpenThread && ( + {extraButtons && ( <>
- - - - - - - Open thread - - - - +
+ + + + + + + + + Open thread + + + + + + + + + + + Open thread + + + + +
)} diff --git a/src/shared/notes/actions/more.tsx b/src/shared/notes/actions/more.tsx index 61b5a40f..72976f99 100644 --- a/src/shared/notes/actions/more.tsx +++ b/src/shared/notes/actions/more.tsx @@ -45,15 +45,7 @@ export function MoreActions({ id, pubkey }: { id: string; pubkey: string }) { - - - - Focus mode - - +