refactor initial database and state management
This commit is contained in:
@@ -4,14 +4,12 @@ import { NoteConnector } from '@components/connectors/note';
|
||||
import CreatePost from '@components/navigatorBar/createPost';
|
||||
import { ProfileMenu } from '@components/navigatorBar/profileMenu';
|
||||
|
||||
import { currentUser } from '@stores/currentUser';
|
||||
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { PlusIcon } from '@radix-ui/react-icons';
|
||||
import { useLocalStorage } from '@rehooks/local-storage';
|
||||
|
||||
export default function NavigatorBar() {
|
||||
const $currentUser: any = useStore(currentUser);
|
||||
const profile = $currentUser.metadata !== undefined ? JSON.parse($currentUser.metadata) : { display_name: null, username: null };
|
||||
const [currentUser]: any = useLocalStorage('current-user');
|
||||
const profile = currentUser.metadata !== undefined ? JSON.parse(currentUser.metadata) : { display_name: null, username: null };
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col flex-wrap justify-between overflow-hidden px-2 pt-3 pb-4">
|
||||
@@ -25,7 +23,7 @@ export default function NavigatorBar() {
|
||||
<div className="flex flex-col p-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<h5 className="font-semibold leading-tight text-zinc-100">{profile.display_name || ''}</h5>
|
||||
<ProfileMenu pubkey={$currentUser.pubkey} />
|
||||
<ProfileMenu pubkey={currentUser.pubkey} />
|
||||
</div>
|
||||
<span className="text-sm leading-tight text-zinc-500">@{profile.username || ''}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user