-
Notifications
You must be signed in to change notification settings - Fork 0
#354 Preserve Stored Answers When A Question Type Or Options Change #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
b-at-neu
merged 6 commits into
dev
from
354-preserve-stored-answers-on-question-shape-change
Aug 14, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8cfd804
#354 preserve stored answers when a question shape changes
b-at-neu eb5c659
#354 address review feedback
b-at-neu 46ee187
#354 restore format keyboard hint on short_answer input
b-at-neu 9bd2e53
#354 rebase onto dev and trim comments to ENGINEERING §7 bar
b-at-neu 08b9f4f
#354 trim comments to ENGINEERING §7 bar
b-at-neu 2b1e872
#354 drop remaining cross-ref/two-line comments
b-at-neu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { TriangleAlert } from 'lucide-react'; | ||
|
|
||
| import type { QuestionType } from '@/prisma/client'; | ||
|
|
||
| interface AnswerMismatchNoticeProps { | ||
| id: string; | ||
| values: string[]; | ||
| questionType: QuestionType; | ||
| } | ||
|
|
||
| // Callers wire `id` to the control's `aria-describedby`. | ||
| export function AnswerMismatchNotice({ | ||
| id, | ||
| values, | ||
| questionType, | ||
| }: AnswerMismatchNoticeProps) { | ||
| if (values.length === 0) return null; | ||
|
|
||
| return ( | ||
| <div | ||
| id={id} | ||
| className="border-warning/40 bg-warning/10 text-warning-foreground mb-2 flex gap-2 rounded-lg border p-3 text-sm" | ||
| > | ||
| <TriangleAlert className="mt-0.5 size-4 shrink-0" aria-hidden="true" /> | ||
| <div className="flex flex-col gap-1"> | ||
| <p className="font-medium">This question has changed</p> | ||
| <p> | ||
| Your previous answer no longer matches the available choices. | ||
| It's saved below until you answer again. | ||
| </p> | ||
| {questionType === 'multiple_choice' ? ( | ||
| <div className="mt-1 flex flex-wrap gap-1.5"> | ||
| {values.map((v, i) => ( | ||
| <span | ||
| key={i} | ||
| className="bg-warning/20 rounded-md px-2 py-0.5 text-xs font-medium" | ||
| > | ||
| {v} | ||
| </span> | ||
| ))} | ||
| </div> | ||
| ) : ( | ||
| <ul className="mt-1 flex flex-col gap-0.5"> | ||
| {values.map((v, i) => ( | ||
| <li key={i} className="font-medium"> | ||
| {v} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.