fixed build error
This commit is contained in:
@@ -13,7 +13,7 @@ export const CreateChannelModal = () => {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const {
|
||||
register,
|
||||
|
||||
@@ -12,8 +12,8 @@ export default function ChatList() {
|
||||
const router = useRouter();
|
||||
|
||||
const [list, setList] = useState([]);
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const accountProfile = JSON.parse(activeAccount.metadata);
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||
|
||||
const openSelfChat = () => {
|
||||
router.push({
|
||||
@@ -41,7 +41,7 @@ export default function ChatList() {
|
||||
>
|
||||
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
|
||||
<ImageWithFallback
|
||||
src={accountProfile.picture || DEFAULT_AVATAR}
|
||||
src={profile?.picture || DEFAULT_AVATAR}
|
||||
alt={activeAccount.pubkey}
|
||||
fill={true}
|
||||
className="rounded object-cover"
|
||||
@@ -49,7 +49,7 @@ export default function ChatList() {
|
||||
</div>
|
||||
<div>
|
||||
<h5 className="text-sm font-medium text-zinc-400">
|
||||
{accountProfile.display_name || accountProfile.name} <span className="text-zinc-500">(you)</span>
|
||||
{profile?.display_name || profile?.name} <span className="text-zinc-500">(you)</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export const ChatModal = () => {
|
||||
const [plebs, setPlebs] = useState([]);
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const fetchPlebsByAccount = useCallback(async (id) => {
|
||||
const { getPlebs } = await import('@utils/bindings');
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useCallback, useRef } from 'react';
|
||||
import { Virtuoso } from 'react-virtuoso';
|
||||
|
||||
export const MessageList = ({ data }: { data: any }) => {
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const virtuosoRef = useRef(null);
|
||||
|
||||
const itemContent: any = useCallback(
|
||||
|
||||
@@ -17,8 +17,8 @@ export default function EventCollector() {
|
||||
const [isOnline] = useState(true);
|
||||
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [follows] = useLocalStorage('activeAccountFollows');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const [follows] = useLocalStorage('activeAccountFollows', []);
|
||||
|
||||
const now = useRef(new Date());
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function FormBase() {
|
||||
const [value, setValue] = useAtom(noteContentAtom);
|
||||
const resetValue = useResetAtom(noteContentAtom);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const submitEvent = () => {
|
||||
const event: any = {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function FormChannelMessage({ eventId }: { eventId: string | stri
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [value, setValue] = useState('');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const submitEvent = useCallback(() => {
|
||||
const event: any = {
|
||||
|
||||
@@ -9,8 +9,9 @@ import { useCallback, useContext, useState } from 'react';
|
||||
|
||||
export default function FormChat({ receiverPubkey }: { receiverPubkey: string }) {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [value, setValue] = useState('');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const encryptMessage = useCallback(
|
||||
async (privkey: string) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useContext, useState } from 'react';
|
||||
export default function FormComment({ eventID }: { eventID: any }) {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
const profile = JSON.parse(activeAccount.metadata);
|
||||
|
||||
@@ -12,15 +12,18 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export default function MultiAccounts() {
|
||||
const [users, setUsers] = useState([]);
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
|
||||
const renderAccount = useCallback((user: { pubkey: string }) => {
|
||||
if (user.pubkey === activeAccount.pubkey) {
|
||||
return <ActiveAccount key={user.pubkey} user={user} />;
|
||||
} else {
|
||||
return <InactiveAccount key={user.pubkey} user={user} />;
|
||||
}
|
||||
}, []);
|
||||
const renderAccount = useCallback(
|
||||
(user: { pubkey: string }) => {
|
||||
if (user.pubkey === activeAccount.pubkey) {
|
||||
return <ActiveAccount key={user.pubkey} user={user} />;
|
||||
} else {
|
||||
return <InactiveAccount key={user.pubkey} user={user} />;
|
||||
}
|
||||
},
|
||||
[activeAccount.pubkey]
|
||||
);
|
||||
|
||||
const fetchAccounts = useCallback(async () => {
|
||||
const { getAccounts } = await import('@utils/bindings');
|
||||
|
||||
@@ -32,8 +32,8 @@ export const NoteComment = memo(function NoteComment({
|
||||
const [open, setOpen] = useState(false);
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const profile = JSON.parse(activeAccount.metadata);
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||
|
||||
const openThread = () => {
|
||||
router.push(`/newsfeed/${eventID}`);
|
||||
@@ -87,7 +87,7 @@ export const NoteComment = memo(function NoteComment({
|
||||
<div>
|
||||
<div className="relative h-11 w-11 shrink-0 overflow-hidden rounded-md border border-white/10">
|
||||
<ImageWithFallback
|
||||
src={profile.picture}
|
||||
src={profile?.picture}
|
||||
alt="user's avatar"
|
||||
fill={true}
|
||||
className="rounded-md object-cover"
|
||||
|
||||
@@ -20,7 +20,7 @@ export const NoteReaction = memo(function NoteReaction({
|
||||
}) {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const [isReact, setIsReact] = useState(false);
|
||||
const [like, setLike] = useState(0);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import reactStringReplace from 'react-string-replace';
|
||||
export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const [event, setEvent] = useState(null);
|
||||
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
@@ -12,7 +12,7 @@ import reactStringReplace from 'react-string-replace';
|
||||
export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
||||
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||
const [event, setEvent] = useState(null);
|
||||
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
Reference in New Issue
Block a user