bug: reply to
This commit is contained in:
parent
462fc60dfe
commit
dbc853fd8a
@ -21,7 +21,7 @@ export interface NoteCreatorProps {
|
||||
}
|
||||
|
||||
export function NoteCreator(props: NoteCreatorProps) {
|
||||
const { show, setShow } = props
|
||||
const { show, setShow, replyTo, onSend, autoFocus } = props
|
||||
const publisher = useEventPublisher();
|
||||
const [note, setNote] = useState<string>();
|
||||
const [error, setError] = useState<string>();
|
||||
@ -30,13 +30,13 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
|
||||
async function sendNote() {
|
||||
if (note) {
|
||||
let ev = props.replyTo ? await publisher.reply(props.replyTo, note) : await publisher.note(note);
|
||||
let ev = replyTo ? await publisher.reply(replyTo, note) : await publisher.note(note);
|
||||
console.debug("Sending note: ", ev);
|
||||
publisher.broadcast(ev);
|
||||
setNote("");
|
||||
setShow(false);
|
||||
if (typeof props.onSend === "function") {
|
||||
props.onSend();
|
||||
if (typeof onSend === "function") {
|
||||
onSend();
|
||||
}
|
||||
setActive(false);
|
||||
}
|
||||
@ -88,10 +88,10 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
className="note-creator-modal"
|
||||
onClose={() => setShow(false)}
|
||||
>
|
||||
<div className={`flex note-creator ${props.replyTo ? 'note-reply' : ''}`}>
|
||||
<div className={`flex note-creator ${replyTo ? 'note-reply' : ''}`}>
|
||||
<div className="flex f-col mr10 f-grow">
|
||||
<Textarea
|
||||
autoFocus={props.autoFocus}
|
||||
autoFocus={autoFocus}
|
||||
className={`textarea ${active ? "textarea--focused" : ""}`}
|
||||
onChange={onChange}
|
||||
value={note}
|
||||
@ -108,7 +108,7 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
Cancel
|
||||
</button>
|
||||
<button type="button" onClick={onSubmit}>
|
||||
{props.replyTo ? 'Reply' : 'Send'}
|
||||
{replyTo ? 'Reply' : 'Send'}
|
||||
</button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
@ -85,25 +85,25 @@ export default function Thread(props: ThreadProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<BackButton />
|
||||
<div className="thread-container">
|
||||
{renderRoot()}
|
||||
{root ? renderChain(root.Id) : null}
|
||||
{root ? null : <>
|
||||
<h3>Other Replies</h3>
|
||||
{brokenChains.map(a => {
|
||||
return (
|
||||
<>
|
||||
<NoteGhost key={a}>
|
||||
Missing event <Link to={eventLink(a)}>{a.substring(0, 8)}</Link>
|
||||
</NoteGhost>
|
||||
{renderChain(a)}
|
||||
</>
|
||||
)
|
||||
})}
|
||||
</>}
|
||||
</div>
|
||||
</>
|
||||
<>
|
||||
<BackButton />
|
||||
<div className="thread-container">
|
||||
{renderRoot()}
|
||||
{root ? renderChain(root.Id) : null}
|
||||
{root ? null : <>
|
||||
<h3>Other Replies</h3>
|
||||
{brokenChains.map(a => {
|
||||
return (
|
||||
<>
|
||||
<NoteGhost key={a}>
|
||||
Missing event <Link to={eventLink(a)}>{a.substring(0, 8)}</Link>
|
||||
</NoteGhost>
|
||||
{renderChain(a)}
|
||||
</>
|
||||
)
|
||||
})}
|
||||
</>}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import "./Layout.css";
|
||||
import { useEffect, useMemo } from "react"
|
||||
import { useEffect } from "react"
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Outlet, useNavigate } from "react-router-dom";
|
||||
import Envelope from "Icons/Envelope";
|
||||
|
@ -46,7 +46,7 @@ export default function RootPage() {
|
||||
</div></> : null}
|
||||
{followHints()}
|
||||
<Timeline key={tab} subject={timelineSubect} postsOnly={tab === RootTab.Posts} method={"TIME_RANGE"} />
|
||||
<NoteCreator autoFocus={true} show={show} setShow={setShow} />
|
||||
<NoteCreator replyTo={undefined} autoFocus={true} show={show} setShow={setShow} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user