rename blocks to widgets
This commit is contained in:
@@ -7,8 +7,8 @@ import { NoteReply } from '@shared/notes/actions/reply';
|
||||
import { NoteRepost } from '@shared/notes/actions/repost';
|
||||
import { NoteZap } from '@shared/notes/actions/zap';
|
||||
|
||||
import { useBlocks } from '@stores/blocks';
|
||||
import { BLOCK_KINDS } from '@stores/constants';
|
||||
import { useWidgets } from '@stores/widgets';
|
||||
|
||||
import { useAccount } from '@utils/hooks/useAccount';
|
||||
|
||||
@@ -24,7 +24,7 @@ export function NoteActions({
|
||||
root?: string;
|
||||
}) {
|
||||
const { account } = useAccount();
|
||||
const setBlock = useBlocks((state) => state.setBlock);
|
||||
const setWidget = useWidgets((state) => state.setWidget);
|
||||
|
||||
return (
|
||||
<Tooltip.Provider>
|
||||
@@ -43,7 +43,7 @@ export function NoteActions({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setBlock({
|
||||
setWidget({
|
||||
kind: BLOCK_KINDS.thread,
|
||||
title: 'Thread',
|
||||
content: id,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useBlocks } from '@stores/blocks';
|
||||
import { BLOCK_KINDS } from '@stores/constants';
|
||||
import { useWidgets } from '@stores/widgets';
|
||||
|
||||
export function Hashtag({ tag }: { tag: string }) {
|
||||
const setBlock = useBlocks((state) => state.setBlock);
|
||||
const setWidget = useWidgets((state) => state.setWidget);
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setBlock({
|
||||
setWidget({
|
||||
kind: BLOCK_KINDS.hashtag,
|
||||
title: tag,
|
||||
content: tag.replace('#', ''),
|
||||
|
||||
@@ -5,19 +5,19 @@ import remarkGfm from 'remark-gfm';
|
||||
import { MentionUser, NoteSkeleton } from '@shared/notes';
|
||||
import { User } from '@shared/user';
|
||||
|
||||
import { useBlocks } from '@stores/blocks';
|
||||
import { BLOCK_KINDS } from '@stores/constants';
|
||||
import { useWidgets } from '@stores/widgets';
|
||||
|
||||
import { useEvent } from '@utils/hooks/useEvent';
|
||||
|
||||
export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
|
||||
const { status, data } = useEvent(id);
|
||||
const setBlock = useBlocks((state) => state.setBlock);
|
||||
const setWidget = useWidgets((state) => state.setWidget);
|
||||
|
||||
const openThread = (event, thread: string) => {
|
||||
const selection = window.getSelection();
|
||||
if (selection.toString().length === 0) {
|
||||
setBlock({ kind: BLOCK_KINDS.thread, title: 'Thread', content: thread });
|
||||
setWidget({ kind: BLOCK_KINDS.thread, title: 'Thread', content: thread });
|
||||
} else {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { useBlocks } from '@stores/blocks';
|
||||
import { BLOCK_KINDS } from '@stores/constants';
|
||||
import { useWidgets } from '@stores/widgets';
|
||||
|
||||
import { useProfile } from '@utils/hooks/useProfile';
|
||||
import { displayNpub } from '@utils/shortenKey';
|
||||
|
||||
export function MentionUser({ pubkey }: { pubkey: string }) {
|
||||
const { user } = useProfile(pubkey);
|
||||
const setBlock = useBlocks((state) => state.setBlock);
|
||||
const setWidget = useWidgets((state) => state.setWidget);
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setBlock({
|
||||
setWidget({
|
||||
kind: BLOCK_KINDS.user,
|
||||
title: user?.nip05 || user?.name || user?.displayNam,
|
||||
content: pubkey,
|
||||
|
||||
@@ -8,13 +8,13 @@ import { createReplyNote } from '@libs/storage';
|
||||
import { LoaderIcon } from '@shared/icons';
|
||||
import { MiniUser } from '@shared/notes/users/mini';
|
||||
|
||||
import { useBlocks } from '@stores/blocks';
|
||||
import { BLOCK_KINDS } from '@stores/constants';
|
||||
import { useWidgets } from '@stores/widgets';
|
||||
|
||||
import { compactNumber } from '@utils/number';
|
||||
|
||||
export function NoteMetadata({ id }: { id: string }) {
|
||||
const setBlock = useBlocks((state) => state.setBlock);
|
||||
const setWidget = useWidgets((state) => state.setWidget);
|
||||
|
||||
const { ndk } = useNDK();
|
||||
const { status, data } = useQuery(
|
||||
@@ -96,7 +96,7 @@ export function NoteMetadata({ id }: { id: string }) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setBlock({ kind: BLOCK_KINDS.thread, title: 'Thread', content: id })
|
||||
setWidget({ kind: BLOCK_KINDS.thread, title: 'Thread', content: id })
|
||||
}
|
||||
className="text-white/50"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user