ReviewDB: Show edit instead of create review where applicable (#466)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
nick 2023-02-17 21:35:51 -05:00 committed by GitHub
parent e14ec96e21
commit 77c691651e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
fallbackValue: [], fallbackValue: [],
deps: [refetchCount], deps: [refetchCount],
}); });
const username = UserStore.getUser(userId)?.username ?? "";
const dirtyRefetch = () => setRefetchCount(refetchCount + 1); const dirtyRefetch = () => setRefetchCount(refetchCount + 1);
@ -79,7 +80,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
<textarea <textarea
className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")} className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")}
// this produces something like '-_59yqs ...' but since no class exists with that name its fine // this produces something like '-_59yqs ...' but since no class exists with that name its fine
placeholder={"Review @" + UserStore.getUser(userId)?.username ?? ""} placeholder={reviews?.some(r => r.senderdiscordid === UserStore.getCurrentUser().id) ? `Update review for @${username}` : `Review @${username}`}
onKeyDown={onKeyPress} onKeyDown={onKeyPress}
style={{ style={{
marginTop: "6px", marginTop: "6px",