fixed build errors

This commit is contained in:
Ren Amamiya 2023-02-24 15:29:40 +07:00
parent 35c50ced5f
commit 4428cc680f
3 changed files with 11 additions and 12 deletions

View File

@ -3,8 +3,6 @@ import ActiveLink from '@components/activeLink';
import CreatePost from '@components/navigatorBar/createPost';
import { ProfileMenu } from '@components/navigatorBar/profileMenu';
import { truncate } from '@utils/truncate';
import { currentUser } from '@stores/currentUser';
import { useStore } from '@nanostores/react';
@ -12,7 +10,10 @@ import { PlusIcon } from '@radix-ui/react-icons';
export default function NavigatorBar() {
const $currentUser: any = useStore(currentUser);
const profile = JSON.parse($currentUser.metadata);
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">
@ -23,13 +24,11 @@ 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 || profile.name}
{profile.display_name || ''}
</h5>
<ProfileMenu pubkey={$currentUser.pubkey} />
</div>
<span className="text-sm leading-tight text-zinc-500">
@{profile.username || truncate($currentUser.pubkey, 16, ' .... ')}
</span>
<span className="text-sm leading-tight text-zinc-500">@{profile.username || ''}</span>
</div>
<div className="p-2">
<CreatePost />

View File

@ -13,10 +13,7 @@ export const ProfileMenu = memo(function ProfileMenu({ pubkey }: { pubkey: strin
};
const updateProfile = () => {
router.push({
pathname: '/profile/update',
query: { pubkey: pubkey },
});
router.push('/profile/update');
};
const copyPubkey = async () => {

View File

@ -29,7 +29,10 @@ export default function Page() {
const [loading, setLoading] = useState(false);
const $currentUser: any = useStore(currentUser);
const profile = JSON.parse($currentUser.metadata);
const profile =
$currentUser.metadata !== undefined
? JSON.parse($currentUser.metadata)
: { display_name: null, username: null };
const {
register,