remove localstorage

This commit is contained in:
Ren Amamiya
2023-04-24 11:59:33 +07:00
parent bd262a12e7
commit 98637feba4
27 changed files with 123 additions and 125 deletions

View File

@@ -1,3 +1,4 @@
import { AccountContext } from '@components/accountProvider';
import { AvatarUploader } from '@components/avatarUploader';
import { RelayContext } from '@components/relaysProvider';
@@ -8,7 +9,6 @@ import { dateToUnix } from '@utils/getDate';
import { createChannel } from '@utils/storage';
import * as Dialog from '@radix-ui/react-dialog';
import useLocalStorage from '@rehooks/local-storage';
import { Cancel, Plus } from 'iconoir-react';
import { useSetAtom } from 'jotai';
import { getEventHash, signEvent } from 'nostr-tools';
@@ -18,8 +18,9 @@ import { navigate } from 'vite-plugin-ssr/client/router';
export const CreateChannelModal = () => {
const pool: any = useContext(RelayContext);
const activeAccount: any = useContext(AccountContext);
const [open, setOpen] = useState(false);
const [activeAccount]: any = useLocalStorage('account', {});
const [image, setImage] = useState(DEFAULT_AVATAR);
const [loading, setLoading] = useState(false);

View File

@@ -1,3 +1,4 @@
import { AccountContext } from '@components/accountProvider';
import { RelayContext } from '@components/relaysProvider';
import { MESSAGE_RELAYS } from '@stores/constants';
@@ -6,14 +7,13 @@ import { dateToUnix } from '@utils/getDate';
import * as AlertDialog from '@radix-ui/react-alert-dialog';
import * as Tooltip from '@radix-ui/react-tooltip';
import useLocalStorage from '@rehooks/local-storage';
import { EyeClose } from 'iconoir-react';
import { getEventHash, signEvent } from 'nostr-tools';
import { useCallback, useContext } from 'react';
export const HideMessageButton = ({ id }: { id: string }) => {
const pool: any = useContext(RelayContext);
const [activeAccount]: any = useLocalStorage('account', {});
const activeAccount: any = useContext(AccountContext);
const hideMessage = useCallback(() => {
const event: any = {
@@ -28,7 +28,7 @@ export const HideMessageButton = ({ id }: { id: string }) => {
// publish note
pool.publish(event, MESSAGE_RELAYS);
}, [id, activeAccount.privkey, activeAccount.pubkey, pool, MESSAGE_RELAYS]);
}, [id, pool, MESSAGE_RELAYS]);
return (
<AlertDialog.Root>

View File

@@ -1,3 +1,4 @@
import { AccountContext } from '@components/accountProvider';
import { RelayContext } from '@components/relaysProvider';
import { MESSAGE_RELAYS } from '@stores/constants';
@@ -6,14 +7,13 @@ import { dateToUnix } from '@utils/getDate';
import * as AlertDialog from '@radix-ui/react-alert-dialog';
import * as Tooltip from '@radix-ui/react-tooltip';
import useLocalStorage from '@rehooks/local-storage';
import { MicMute } from 'iconoir-react';
import { getEventHash, signEvent } from 'nostr-tools';
import { useContext } from 'react';
export const MuteButton = ({ pubkey }: { pubkey: string }) => {
const pool: any = useContext(RelayContext);
const [activeAccount]: any = useLocalStorage('account', {});
const activeAccount: any = useContext(AccountContext);
const muteUser = () => {
const event: any = {