name component fix

This commit is contained in:
Martti Malmi 2023-04-10 14:43:54 +03:00
parent 46fc215ee1
commit 241a278555
3 changed files with 9 additions and 15 deletions

View File

@ -2701,7 +2701,4 @@ input[type='text'] {
.visible-xs-flex {
display: none !important;
}
.msg.standalone:not(.quoting) {
margin-bottom: 4px;
}
}

View File

@ -23,16 +23,11 @@ const Name = (props: Props) => {
let initialName = '';
let initialDisplayName;
let isGenerated = false;
const profileEvent = Events.db.find({ kind: 0, pubkey: nostrAddr });
const profile = SocialNetwork.profiles.get(nostrAddr);
// should we change SocialNetwork.getProfile() and use it here?
if (profileEvent) {
try {
const profile = JSON.parse(profileEvent.content);
initialName = profile.name?.trim().slice(0, 100) || '';
initialDisplayName = profile.display_name?.trim().slice(0, 100);
} catch (e) {
// ignore
}
if (profile) {
initialName = profile.name?.trim().slice(0, 100) || '';
initialDisplayName = profile.display_name?.trim().slice(0, 100);
}
if (!initialDisplayName) {
initialDisplayName = AnimalName(Key.toNostrBech32Address(props.pub, 'npub') || props.pub);

View File

@ -44,6 +44,10 @@ const Note = ({
const [translatedText, setTranslatedText] = useState('');
showReplies = showReplies || 0;
if (showRepliedMsg === undefined) {
showRepliedMsg = standalone;
}
// TODO fetch replies in useEffect
let text = event.content || '';
@ -253,9 +257,7 @@ const Note = ({
function renderReplies() {
return replies
.slice(0, showReplies)
.map((r) => (
<EventComponent key={r} id={r} asReply={!standalone} showReplies={showReplies} />
));
.map((r) => <EventComponent key={r} id={r} asReply={!standalone} showReplies={0} />);
}
function renderReplyForm() {