{props.header}
{props.questions.length === 0 && (
No one has asked anything yet.
)}
{rows(
inState("pending"),
(q) => (
<>
{stateButton(q, "hidden", "Hide")}
{stateButton(q, "accepted", "Accept")}
>
),
"light-container p-2",
)}
{rows(inState("accepted"), (q) => stateButton(q, "hidden", "Hide"))}
{hidden.length > 0 && (
setShowHidden(!showHidden)}
>
{hidden.length} hidden
{showHidden &&
rows(hidden, (q) => stateButton(q, "pending", "Unhide"))}
)}
);
}
// Whether to show handles, judged across everyone the whole list shows: the
// askers and whoever answered.
function showHandlesFor(questions: DocumentQuestion[]) {
return hasSeveralAuthors(
questions.flatMap((q) =>
q.answer ? [q.asker, q.answer.author] : [q.asker],
),
);
}
type RenderAnswer = (
question: DocumentQuestion,
showHandle?: boolean,
) => React.ReactNode;
function QuestionRows(props: {
questions: DocumentQuestion[];
className?: string;
showHandles?: boolean;
renderAnswer: RenderAnswer;
renderControl: (question: DocumentQuestion) => React.ReactNode;
}) {
if (props.questions.length === 0) return null;
return (