mirror of
https://github.com/lumehq/lume.git
synced 2025-09-23 04:22:41 +02:00
minor fixes
This commit is contained in:
@@ -28,7 +28,7 @@ export const HideMessageButton = ({ id }: { id: string }) => {
|
|||||||
|
|
||||||
// publish note
|
// publish note
|
||||||
pool.publish(event, MESSAGE_RELAYS);
|
pool.publish(event, MESSAGE_RELAYS);
|
||||||
}, [id, pool, MESSAGE_RELAYS]);
|
}, [activeAccount.pubkey, activeAccount.privkey, id, pool]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AlertDialog.Root>
|
<AlertDialog.Root>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import ChannelMessageItem from '@components/channels/messages/item';
|
import { ChannelMessageItem } from '@components/channels/messages/item';
|
||||||
|
|
||||||
import { sortedChannelMessagesAtom } from '@stores/channel';
|
import { sortedChannelMessagesAtom } from '@stores/channel';
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import { messageParser } from '@utils/parser';
|
|||||||
|
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
const ChannelMessageItem = ({ data }: { data: any }) => {
|
export const ChannelMessageItem = memo(function ChannelMessageItem({ data }: { data: any }) {
|
||||||
const content = messageParser(data.content);
|
const content = messageParser(data.content);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -31,6 +31,4 @@ const ChannelMessageItem = ({ data }: { data: any }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
export default memo(ChannelMessageItem);
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { AccountContext } from '@components/accountProvider';
|
import { AccountContext } from '@components/accountProvider';
|
||||||
import MessageListItem from '@components/chats/messageListItem';
|
import { MessageListItem } from '@components/chats/messageListItem';
|
||||||
|
|
||||||
import { sortedChatMessagesAtom } from '@stores/chat';
|
import { sortedChatMessagesAtom } from '@stores/chat';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export default function MessageList() {
|
|||||||
<MessageListItem data={data[index]} userPubkey={activeAccount.pubkey} userPrivkey={activeAccount.privkey} />
|
<MessageListItem data={data[index]} userPubkey={activeAccount.pubkey} userPrivkey={activeAccount.privkey} />
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[data]
|
[activeAccount.privkey, activeAccount.pubkey, data]
|
||||||
);
|
);
|
||||||
|
|
||||||
const computeItemKey = useCallback(
|
const computeItemKey = useCallback(
|
||||||
|
@@ -4,7 +4,15 @@ import { useDecryptMessage } from '@utils/hooks/useDecryptMessage';
|
|||||||
|
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
const MessageListItem = ({ data, userPubkey, userPrivkey }: { data: any; userPubkey: string; userPrivkey: string }) => {
|
export const MessageListItem = memo(function MessageListItem({
|
||||||
|
data,
|
||||||
|
userPubkey,
|
||||||
|
userPrivkey,
|
||||||
|
}: {
|
||||||
|
data: any;
|
||||||
|
userPubkey: string;
|
||||||
|
userPrivkey: string;
|
||||||
|
}) {
|
||||||
const content = useDecryptMessage(userPubkey, userPrivkey, data.pubkey, data.tags, data.content);
|
const content = useDecryptMessage(userPubkey, userPrivkey, data.pubkey, data.tags, data.content);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -21,6 +29,4 @@ const MessageListItem = ({ data, userPubkey, userPrivkey }: { data: any; userPub
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
export default memo(MessageListItem);
|
|
||||||
|
@@ -104,7 +104,7 @@ export default function EventCollector() {
|
|||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
}, [follows, pool, setHasNewerNote]);
|
}, [activeAccount.id, activeAccount.pubkey, follows, pool, setHasNewerNote]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let ignore = false;
|
let ignore = false;
|
||||||
|
@@ -44,7 +44,7 @@ export default function FormChat({ receiverPubkey }: { receiverPubkey: string })
|
|||||||
resetValue();
|
resetValue();
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}, [encryptMessage, receiverPubkey, resetValue, pool]);
|
}, [activeAccount.privkey, activeAccount.pubkey, receiverPubkey, pool, resetValue, encryptMessage]);
|
||||||
|
|
||||||
const handleEnterPress = (e) => {
|
const handleEnterPress = (e) => {
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
@@ -19,13 +19,16 @@ if (typeof window !== 'undefined') {
|
|||||||
export default function MultiAccounts() {
|
export default function MultiAccounts() {
|
||||||
const activeAccount: any = useContext(AccountContext);
|
const activeAccount: any = useContext(AccountContext);
|
||||||
|
|
||||||
const renderAccount = useCallback((account: { pubkey: string }) => {
|
const renderAccount = useCallback(
|
||||||
if (account.pubkey === activeAccount.pubkey) {
|
(account: { pubkey: string }) => {
|
||||||
return <ActiveAccount key={account.pubkey} user={account} />;
|
if (account.pubkey === activeAccount.pubkey) {
|
||||||
} else {
|
return <ActiveAccount key={account.pubkey} user={account} />;
|
||||||
return <InactiveAccount key={account.pubkey} user={account} />;
|
} else {
|
||||||
}
|
return <InactiveAccount key={account.pubkey} user={account} />;
|
||||||
}, []);
|
}
|
||||||
|
},
|
||||||
|
[activeAccount.pubkey]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col items-center justify-between px-2 pb-4 pt-3">
|
<div className="flex h-full flex-col items-center justify-between px-2 pb-4 pt-3">
|
||||||
|
@@ -54,7 +54,7 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
|||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
}, [id, pool]);
|
}, [activeAccount.id, id, pool]);
|
||||||
|
|
||||||
const checkNoteIsSaved = useCallback(async () => {
|
const checkNoteIsSaved = useCallback(async () => {
|
||||||
getNoteByID(id)
|
getNoteByID(id)
|
||||||
|
@@ -52,7 +52,7 @@ export const NoteQuote = memo(function NoteQuote({ id }: { id: string }) {
|
|||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
}, [id, pool]);
|
}, [activeAccount.id, id, pool]);
|
||||||
|
|
||||||
const checkNoteIsSaved = useCallback(async () => {
|
const checkNoteIsSaved = useCallback(async () => {
|
||||||
getNoteByID(id)
|
getNoteByID(id)
|
||||||
|
@@ -16,6 +16,7 @@ export function PageContextProvider({
|
|||||||
return <Context.Provider value={pageContext}>{children}</Context.Provider>;
|
return <Context.Provider value={pageContext}>{children}</Context.Provider>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export function usePageContext() {
|
export function usePageContext() {
|
||||||
const pageContext = useContext(Context);
|
const pageContext = useContext(Context);
|
||||||
return pageContext;
|
return pageContext;
|
||||||
|
@@ -35,9 +35,9 @@ export const useProfileMetadata = (pubkey: string) => {
|
|||||||
fetchProfileMetadata(pubkey).then((res: any) => {
|
fetchProfileMetadata(pubkey).then((res: any) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
// update state
|
// update state
|
||||||
setProfile(res);
|
setProfile(JSON.parse(res.content));
|
||||||
// insert to db
|
// insert to db
|
||||||
insertPlebToDB(pubkey, JSON.stringify(res));
|
insertPlebToDB(pubkey, res.content);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ export const useProfileMetadata = (pubkey: string) => {
|
|||||||
return () => {
|
return () => {
|
||||||
ignore = true;
|
ignore = true;
|
||||||
};
|
};
|
||||||
}, [insertPlebToDB, pubkey]);
|
}, [getProfileFromDB, insertPlebToDB, pubkey]);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user