Repository navigation
Detect what replies have changed #229
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
Changes from all commits
7545e47
403a29c
8224477
c3373b1
0d842d3
53bdaf3
9fc7814
4982239
09ee4a0
934230a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,15 @@ | |
| color: var(--ui-text); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, the warning about the change in the questionnaire is caused also by unrelated changes - like adding a TODO. Maybe we should find out what else can provoke the warning, just to be sure, we don't show it with the empty change list |
||
|
|
||
| /* The body takes the height the header and footer leave, so the dialog does not resize with its content. */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only thing I don’t like that much is that we store replies in our DB even though they are already stored in the DSW. However, I really like the change list, and we need the replies for that. I looked into the DB, and I think we store a whole snapshot of the replies for every run? It is a lot of data, maybe we could store only the changes from the last version? Maybe that would be an issue when we delete a run? |
||
| .fullHeight { | ||
| height: calc(100vh - 3.5rem); | ||
| } | ||
|
|
||
| .fullHeight .body { | ||
| flex: 1; | ||
| } | ||
|
|
||
| .content:focus { | ||
| outline: none; | ||
| } | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /* The alert's content fills the row, so the button can sit at the end. */ | ||
| .note :global(.ui-alert__content) { | ||
| flex: 1; | ||
| min-width: 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { Alert } from '@ds-wizard/plugin-sdk/ui/Alert' | ||
| import { Button } from '@ds-wizard/plugin-sdk/ui/Button' | ||
| import { Inline } from '@ds-wizard/plugin-sdk/ui/Layout' | ||
| import { useState } from 'react' | ||
|
|
||
| import styles from '@/components/QuestionnaireChangeNote.module.css' | ||
| import { QuestionnaireChangesModal } from '@/components/QuestionnaireChangesModal' | ||
| import type { RunRecord } from '@/hooks/useGenerationHistory' | ||
| import { | ||
| isQuestionnaireChanged, | ||
| type LatestQuestionnaireEvent, | ||
| } from '@/hooks/useLatestQuestionnaireEvent' | ||
|
|
||
| type QuestionnaireChangeNoteProps = { | ||
| run: Pick<RunRecord, 'runId' | 'status' | 'sourceEventUuid'> | ||
| latestEvent: LatestQuestionnaireEvent | ||
| } | ||
|
|
||
| /** | ||
| * A note, shown when the questionnaire answers may have changed since the document was generated, that lists | ||
| * what changed when clicked. | ||
| */ | ||
| export function QuestionnaireChangeNote({ run, latestEvent }: QuestionnaireChangeNoteProps) { | ||
| const [isOpen, setIsOpen] = useState(false) | ||
|
|
||
| if (run.status !== 'succeeded') return null | ||
|
|
||
| // Still checking, unchanged, or not verifiable (older run, DSW unreachable): nothing to show. | ||
| if (!isQuestionnaireChanged(run.sourceEventUuid, latestEvent)) return null | ||
|
|
||
| return ( | ||
| <> | ||
| <Alert tone="warning" className={styles.note}> | ||
| <Inline align="between"> | ||
| <span>DMP is outdated</span> | ||
| <Button size="small" variant="secondary" onClick={() => setIsOpen(true)}> | ||
| Show changes | ||
| </Button> | ||
| </Inline> | ||
| </Alert> | ||
| {isOpen && ( | ||
| <QuestionnaireChangesModal runId={run.runId} onClose={() => setIsOpen(false)} /> | ||
| )} | ||
| </> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| .tree { | ||
| --tree-indent: 1.25rem; | ||
| --tree-line: var(--ui-border-strong); | ||
| /* Where a line of text is cut by its connector, about the middle of the first line. */ | ||
| --tree-elbow: 0.75em; | ||
|
|
||
| font-size: 0.875rem; | ||
| line-height: 1.5; | ||
| } | ||
|
|
||
| .root, | ||
| .level { | ||
| margin: 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| } | ||
|
|
||
| /* Chapters start at the left edge; everything under them hangs off guide lines. */ | ||
| .level { | ||
| margin-left: 0.35rem; | ||
| } | ||
|
|
||
| .level > .node { | ||
| position: relative; | ||
| padding-left: var(--tree-indent); | ||
| } | ||
|
|
||
| /* The vertical guide, running down past every sibling but the last. */ | ||
| .level > .node::before { | ||
| content: ''; | ||
| position: absolute; | ||
| top: 0; | ||
| bottom: 0; | ||
| left: 0; | ||
| border-left: 1px solid var(--tree-line); | ||
| } | ||
|
|
||
| /* The last sibling's guide stops at its own connector, drawing an elbow. */ | ||
| .level > .node:last-child::before { | ||
| bottom: auto; | ||
| height: calc(var(--tree-elbow) + 0.15rem); | ||
| } | ||
|
|
||
| /* The horizontal connector into the node's line. */ | ||
| .level > .node::after { | ||
| content: ''; | ||
| position: absolute; | ||
| top: calc(var(--tree-elbow) + 0.15rem); | ||
| left: 0; | ||
| width: calc(var(--tree-indent) - 0.35rem); | ||
| border-top: 1px solid var(--tree-line); | ||
| } | ||
|
|
||
| .line { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-items: baseline; | ||
| gap: 0.25rem var(--ui-space-2); | ||
| padding: 0.15rem 0; | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| .root > .node + .node { | ||
| margin-top: var(--ui-space-2); | ||
| } | ||
|
|
||
| .chapter { | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .question { | ||
| font-weight: 600; | ||
| } | ||
|
|
||
| .item { | ||
| color: var(--ui-text-muted); | ||
| font-style: italic; | ||
| } | ||
|
|
||
| .values { | ||
| display: inline-flex; | ||
| flex-wrap: wrap; | ||
| align-items: baseline; | ||
| gap: 0.25rem var(--ui-space-2); | ||
| min-width: 0; | ||
| } | ||
|
|
||
| .removed, | ||
| .added, | ||
| .answer { | ||
| padding: 0 0.25rem; | ||
| border-radius: var(--ui-radius-control); | ||
| white-space: pre-wrap; | ||
| } | ||
|
|
||
| .removed { | ||
| background: var(--ui-danger-subtle); | ||
| color: var(--ui-danger-on-subtle); | ||
| text-decoration: line-through; | ||
| } | ||
|
|
||
| .added { | ||
| background: var(--ui-success-subtle); | ||
| color: var(--ui-success-on-subtle); | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| /* The answer an unchanged options question has, which its changed follow-up questions follow from. */ | ||
| .answer { | ||
| background: var(--ui-surface-sunken); | ||
| color: var(--ui-text-muted); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visualisation of the changed replies is awesome. I have one suggestion, we could add a link to the question that would open in another tab. When the user opens the change list, they might notice that they made a mistake or make their answer clearer in the questionnaire.