Makes entire note clickable #371

Merged
d-r-w merged 2 commits from main into main 2023-03-07 15:29:39 +00:00
2 changed files with 12 additions and 4 deletions
Showing only changes of commit d18fa03f31 - Show all commits

View File

@ -2,6 +2,10 @@
min-height: 110px;
}
.note:hover {
cursor: pointer;
}
.note > .header .reply {
font-size: 13px;
color: var(--font-secondary-color);
@ -132,8 +136,7 @@
}
.note > .header img:hover,
.note > .header .name > .reply:hover,
.note .body:hover {
.note > .header .name > .reply:hover {
cursor: pointer;
}

View File

@ -175,7 +175,11 @@ export default function Note(props: NoteProps) {
}
}, [inView, entry, extendable]);
function goToEvent(e: React.MouseEvent, id: u256) {
function goToEvent(e: React.MouseEvent, id: u256, isTargetAllowed: boolean = e.target === e.currentTarget) {
if (!isTargetAllowed) {
return;
}
e.stopPropagation();
navigate(eventLink(id));
}
@ -287,7 +291,7 @@ export default function Note(props: NoteProps) {
)}
</div>
)}
<div className="body" onClick={e => goToEvent(e, ev.Id)}>
<div className="body" onClick={e => goToEvent(e, ev.Id, true)}>
{transformBody()}
{translation()}
{options.showReactionsLink && (
@ -320,6 +324,7 @@ export default function Note(props: NoteProps) {
const note = (
<div
className={`${baseClassName}${highlight ? " active " : " "}${extendable && !showMore ? " note-expand" : ""}`}
onClick={e => goToEvent(e, ev.Id)}
ref={ref}>
{content()}
</div>