remove localstorage
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
@@ -6,7 +7,6 @@ import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { ChatLines, OpenNewWindow } from 'iconoir-react';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
import { useContext, useState } from 'react';
|
||||
@@ -26,12 +26,12 @@ export const NoteComment = ({
|
||||
eventContent: any;
|
||||
}) => {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||
const profile = activeAccount ? JSON.parse(activeAccount.metadata) : null;
|
||||
|
||||
const openThread = () => {
|
||||
navigate(`/newsfeed/note?id=${eventID}`);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { Heart } from 'iconoir-react';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
@@ -21,7 +21,7 @@ export const NoteReaction = ({
|
||||
eventPubkey: string;
|
||||
}) => {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const [isReact, setIsReact] = useState(false);
|
||||
const [like, setLike] = useState(0);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { NoteComment } from '@components/note/meta/comment';
|
||||
import { NoteReaction } from '@components/note/meta/reaction';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { DEFAULT_RELAYS } from '@stores/constants';
|
||||
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { memo, useContext, useEffect, useState } from 'react';
|
||||
|
||||
export const NoteMetadata = memo(function NoteMetadata({
|
||||
@@ -19,7 +19,7 @@ export const NoteMetadata = memo(function NoteMetadata({
|
||||
eventContent: any;
|
||||
}) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const [liked, setLiked] = useState(false);
|
||||
const [likeCount, setLikeCount] = useState(0);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { NoteMetadata } from '@components/note/metadata';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
@@ -8,15 +9,13 @@ import { contentParser } from '@utils/parser';
|
||||
import { createNote, getNoteByID } from '@utils/storage';
|
||||
import { getParentID } from '@utils/transform';
|
||||
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { memo, useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const [event, setEvent] = useState(null);
|
||||
|
||||
const content = event ? contentParser(event.content, event.tags) : '';
|
||||
|
||||
const fetchEvent = useCallback(async () => {
|
||||
@@ -55,7 +54,7 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [activeAccount.id, id, pool]);
|
||||
}, [id, pool]);
|
||||
|
||||
const checkNoteIsSaved = useCallback(async () => {
|
||||
getNoteByID(id)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AccountContext } from '@components/accountProvider';
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
import { UserExtend } from '@components/user/extend';
|
||||
|
||||
@@ -7,15 +8,13 @@ import { contentParser } from '@utils/parser';
|
||||
import { createNote, getNoteByID } from '@utils/storage';
|
||||
import { getParentID } from '@utils/transform';
|
||||
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { memo, useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
export const NoteQuote = memo(function NoteQuote({ id }: { id: string }) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const activeAccount: any = useContext(AccountContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const [event, setEvent] = useState(null);
|
||||
|
||||
const content = event ? contentParser(event.content, event.tags) : '';
|
||||
|
||||
const fetchEvent = useCallback(async () => {
|
||||
@@ -53,7 +52,7 @@ export const NoteQuote = memo(function NoteQuote({ id }: { id: string }) {
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [activeAccount.id, id, pool]);
|
||||
}, [id, pool]);
|
||||
|
||||
const checkNoteIsSaved = useCallback(async () => {
|
||||
getNoteByID(id)
|
||||
|
||||
Reference in New Issue
Block a user