{reviews?.map(review =>
(review.sender.discordID !== myId || !hideOwnReview) &&
)}
{reviews?.length === 0 && (
Looks like nobody reviewed this user yet. You could be the first!
)}
);
}
export function ReviewsInputComponent({ discordId, isAuthor, refetch, name }: { discordId: string, name: string; isAuthor: boolean; refetch(): void; }) {
const { token } = Auth;
const editorRef = useRef(null);
const inputType = ChatInputTypes.FORM;
inputType.disableAutoFocus = true;
const channel = createChannelRecordFromServer({ id: "0", type: 1 });
return (
<>
{
if (!token) {
showToast("Opening authorization window...");
authorize();
}
}}>
editorRef.current = ref}
textValue=""
onSubmit={
async res => {
const response = await addReview({
userid: discordId,
comment: res.value,
});
if (response) {
refetch();
const slateEditor = editorRef.current.ref.current.getSlateEditor();
// clear editor
Transforms.delete(slateEditor, {
at: {
anchor: Editor.start(slateEditor, []),
focus: Editor.end(slateEditor, []),
}
});
}
// even tho we need to return this, it doesnt do anything
return {
shouldClear: false,
shouldRefocus: true,
};
}
}
/>
>
);
}