add topic widget

This commit is contained in:
2023-11-09 09:12:42 +07:00
parent 108ecafab7
commit cb9006abb2
16 changed files with 489 additions and 96 deletions

View File

@@ -6,7 +6,7 @@ import { NoteReply } from '@shared/notes/actions/reply';
import { NoteRepost } from '@shared/notes/actions/repost';
import { NoteZap } from '@shared/notes/actions/zap';
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { useWidget } from '@utils/hooks/useWidget';
@@ -34,7 +34,7 @@ export function NoteActions({
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.local.thread,
kind: WIDGET_KIND.local.thread,
title: 'Thread',
content: id,
})

View File

@@ -1,4 +1,4 @@
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { useWidget } from '@utils/hooks/useWidget';
@@ -10,7 +10,7 @@ export function Hashtag({ tag }: { tag: string }) {
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.global.hashtag,
kind: WIDGET_KIND.global.hashtag,
title: tag,
content: tag.replace('#', ''),
})

View File

@@ -9,7 +9,7 @@ import {
} from '@shared/notes';
import { User } from '@shared/user';
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { useEvent } from '@utils/hooks/useEvent';
import { useWidget } from '@utils/hooks/useWidget';
@@ -50,7 +50,7 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.local.thread,
kind: WIDGET_KIND.local.thread,
title: 'Thread',
content: data.id,
})

View File

@@ -1,6 +1,6 @@
import { memo } from 'react';
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { useProfile } from '@utils/hooks/useProfile';
import { useWidget } from '@utils/hooks/useWidget';
@@ -14,14 +14,14 @@ export const MentionUser = memo(function MentionUser({ pubkey }: { pubkey: strin
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.local.user,
kind: WIDGET_KIND.local.user,
title: user?.name || user?.display_name || user?.displayName,
content: pubkey,
})
}
onKeyDown={() =>
addWidget.mutate({
kind: WidgetKinds.local.user,
kind: WIDGET_KIND.local.user,
title: user?.name || user?.display_name || user?.displayName,
content: pubkey,
})

View File

@@ -10,7 +10,7 @@ import {
} from '@shared/notes';
import { User } from '@shared/user';
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { formatCreatedAt } from '@utils/createdAt';
import { useEvent } from '@utils/hooks/useEvent';
@@ -91,7 +91,7 @@ export function NotifyNote({ event }: { event: NDKEvent }) {
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.local.thread,
kind: WIDGET_KIND.local.thread,
title: 'Thread',
content: data.id,
})

View File

@@ -4,7 +4,7 @@ import { memo } from 'react';
import { ChildNote, NoteActions } from '@shared/notes';
import { User } from '@shared/user';
import { WidgetKinds } from '@stores/constants';
import { WIDGET_KIND } from '@stores/constants';
import { useNostr } from '@utils/hooks/useNostr';
import { useRichContent } from '@utils/hooks/useRichContent';
@@ -30,7 +30,7 @@ export function TextNote({ event }: { event: NDKEvent }) {
type="button"
onClick={() =>
addWidget.mutate({
kind: WidgetKinds.local.thread,
kind: WIDGET_KIND.local.thread,
title: 'Thread',
content: thread.rootEventId,
})