Skip to content

Commit 859d015

Browse files
committed
Allow for skipping unanswered questions in /compatibility
1 parent 09a3705 commit 859d015

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

web/components/answers/answer-compatibility-question-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export const SelectAnswer = (props: {
325325
)
326326
}
327327

328-
// TODO: redo with checkbox semantics
328+
// redo with checkbox semantics
329329
export const MultiSelectAnswers = (props: {
330330
values: number[]
331331
setValue: (value: number[]) => void

web/components/answers/compatibility-questions-display.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ import {Subtitle} from '../widgets/profile-subtitle'
2222
import {AddCompatibilityQuestionButton} from './add-compatibility-question-button'
2323
import {
2424
AnswerCompatibilityQuestionButton,
25-
AnswerSkippedCompatibilityQuestionsButton, CompatibilityPageButton,
25+
AnswerSkippedCompatibilityQuestionsButton,
26+
CompatibilityPageButton,
2627
} from './answer-compatibility-question-button'
2728
import {
28-
AnswerCompatibilityQuestionContent, CompatibilityAnswerSubmitType,
29-
deleteCompatibilityAnswer, getEmptyAnswer,
29+
AnswerCompatibilityQuestionContent,
30+
CompatibilityAnswerSubmitType,
31+
deleteCompatibilityAnswer,
32+
getEmptyAnswer,
3033
IMPORTANCE_CHOICES,
3134
IMPORTANCE_DISPLAY_COLORS,
35+
submitCompatibilityAnswer,
3236
} from './answer-compatibility-question-content'
3337
import clsx from 'clsx'
3438
import {shortenName} from 'web/components/widgets/user-link'
@@ -363,6 +367,7 @@ export function CompatibilityAnswerBlock(props: {
363367
answerText && !preferredAnswersText.includes(answerText)
364368

365369
const isAnswered = answer && answer.multiple_choice > -1
370+
const isSkipped = answer && answer.importance == -1
366371
return (
367372
<Col
368373
className={
@@ -411,6 +416,26 @@ export function CompatibilityAnswerBlock(props: {
411416
/>
412417
</>
413418
)}
419+
{isCurrentUser && !isAnswered && !isSkipped && (
420+
<>
421+
<DropdownMenu
422+
items={[
423+
{
424+
name: 'Skip',
425+
icon: <TrashIcon className="h-5 w-5"/>,
426+
onClick: () => {
427+
submitCompatibilityAnswer(getEmptyAnswer(user.id, question.id))
428+
.then(() => {})
429+
.finally(() => {})
430+
refreshCompatibilityAll()
431+
},
432+
},
433+
]}
434+
closeOnClick
435+
menuWidth="w-40"
436+
/>
437+
</>
438+
)}
414439
</Row>
415440
</Row>
416441
{answerText && <Row className="bg-canvas-100 w-fit gap-1 rounded px-2 py-1 text-sm">
@@ -497,7 +522,7 @@ export function CompatibilityAnswerBlock(props: {
497522
refreshCompatibilityAll()
498523
}}
499524
isLastQuestion={true}
500-
noSkip
525+
noSkip={isAnswered}
501526
/>
502527
</Col>
503528
</Modal>

0 commit comments

Comments
 (0)