Skip to content
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

Iterate the pre-check to include an interoperability check #239

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
78f75c5
Add eu question to pre check
mpanne Dec 11, 2024
6863a57
Update hint for eu question
mpanne Dec 11, 2024
ecfbc0f
Update pre check landing page
mpanne Dec 16, 2024
be4696c
Add missing images
mpanne Dec 16, 2024
87c1fd1
Update images of interop x digital readiness
mpanne Dec 16, 2024
04f5d43
Replace and format image
mpanne Dec 16, 2024
bff29e3
Update content on pre check landing page
mpanne Dec 16, 2024
1f48e43
Add accordion component
mpanne Dec 16, 2024
554efa5
Add faq section on pre check landing page
mpanne Dec 16, 2024
f335252
Fix assessment tests
mpanne Dec 16, 2024
bc7c55f
Update copy of pre-check questions
mpanne Dec 16, 2024
d7e6cd1
Add sidebar navigation to bottom of page
mpanne Dec 16, 2024
0084ebe
Add newline
mpanne Dec 16, 2024
6c1d443
Fix tests
mpanne Dec 16, 2024
c8f4dee
Move constant to fix tests
mpanne Dec 16, 2024
1593dc6
Resolve interoperability check result
mpanne Dec 17, 2024
e308529
Update tests before updating result page (TDD)
mpanne Dec 17, 2024
a5de1da
Resolve todo in test
mpanne Dec 17, 2024
efc5cd0
Fix quotes character
mpanne Dec 17, 2024
76a3a76
Add test case
mpanne Dec 17, 2024
788c01c
Fix test cases
mpanne Dec 17, 2024
2b4d61e
Adapt result header including interop
mpanne Dec 17, 2024
f085672
Add test cases
mpanne Dec 18, 2024
0611e02
New version of result page
mpanne Dec 18, 2024
63d3632
Revert "Add sidebar navigation to bottom of page"
mpanne Dec 18, 2024
430e061
Change behavior of link bar
mpanne Dec 18, 2024
b583f3b
Add result hints to interoperability question
mpanne Dec 18, 2024
d1ae3fd
Fix tests for link bar
mpanne Dec 18, 2024
ab9b5ab
Resolve next steps depending on result
mpanne Dec 18, 2024
7519449
Update heading for nkr step
mpanne Dec 18, 2024
ab2d779
Fix result page heading for unsure case
mpanne Dec 18, 2024
a97945a
Fix some copy and tests accordingly
mpanne Dec 18, 2024
b4f926f
Run pipeline step build-and-push-image on branch
mpanne Dec 18, 2024
608a932
Remove PDF stuff from tests
mpanne Dec 19, 2024
3e24ffb
Some more cleanup of tests
mpanne Dec 19, 2024
5ce1e9f
Fix data-testid of input error
mpanne Dec 19, 2024
0c8adf4
Remove quicksent feature flag code
mpanne Dec 19, 2024
70b82fa
Intercept mailto link redirects
mpanne Dec 19, 2024
40a7f09
Fix typo
mpanne Dec 19, 2024
e235181
Extend validation for email information
mpanne Dec 19, 2024
9c30b6d
Update content.ts
sanni-github Dec 19, 2024
3e4df94
Improve test
mpanne Dec 19, 2024
02839c6
Add tests for updated quicksent form
mpanne Dec 19, 2024
c859506
Fix tests
mpanne Dec 19, 2024
abe8746
Update result form and add email input
mpanne Dec 19, 2024
ed026f6
Include additional email into mailto link
mpanne Dec 19, 2024
98c803d
Update content.ts
sanni-github Jan 2, 2025
1fee58d
Update content.ts
sanni-github Jan 2, 2025
8a286be
Update content.ts
sanni-github Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:

build-and-push-image:
needs: [check-and-test-shared]
if: ${{ github.ref == 'refs/heads/main' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this lead to PR branches (e.g. by dependabot) being deployed, too?

runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
23 changes: 23 additions & 0 deletions packages/dito/app/components/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import AccordionItem, { AccordionItemProps } from "./AccordionItem";

export default function Accordion({
items,
boldAppearance,
}: {
items: AccordionItemProps[];
boldAppearance?: boolean;
}) {
return (
<div className="bg-white border-b-2 border-b-blue-800">
{items.map((item, index) => (
<AccordionItem
key={index}
headline={item.headline}
content={item.content}
id={item.id}
boldAppearance={boldAppearance}
/>
))}
</div>
);
}
52 changes: 52 additions & 0 deletions packages/dito/app/components/AccordionItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import RichText from "@digitalcheck/shared/components/RichText.tsx";
import { Add, Remove } from "@digitalservicebund/icons";
import classNames from "classnames";
import { ReactNode, useState } from "react";

export type AccordionItemProps = {
headline: string;
content?: string | ReactNode;
id?: string;
boldAppearance?: boolean;
};

export default function AccordionItem(props: AccordionItemProps) {
const { headline, content, id, boldAppearance } = props;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we destructure in the function()?

const [isExpanded, setIsExpanded] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would allow multiple AccordionItems to be open at the same time, correct? Why do we explicitly need this state here? Shouldn't the native element handle a11y already? Also, have you considered using name to handle the case that only one accordion should be open?


return (
<details
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the implementation through a details tag!

onToggle={() => setIsExpanded(!isExpanded)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment if this is really necessary.

className="border-t-2 border-t-blue-800 group"
id={id}
>
<summary
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also seems superfluous, but unsure?

aria-expanded={isExpanded}
className="accordion-summary w-full p-24 flex items-center justify-between hover:bg-blue-200 focus:bg-blue-200 focus:outline focus:outline-4 focus:outline-blue-800 focus-visible:outline focus-visible:outline-4 focus-visible:outline-blue-800 cursor-pointer group-open:bg-blue-200"
>
<div
className={classNames(
"pr-10 font-bold text-left text-16 leading-22 md:text-18 md:leading-24",
{ "text-blue-800": boldAppearance },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does boldAppearance only change the text color?

)}
>
{headline}
</div>
<Add className="w-24 h-24 flex-shrink-0 fill-blue-800 group-open:hidden" />
<Remove className="w-24 h-24 flex-shrink-0 fill-blue-800 hidden group-open:block" />
</summary>
<div
className={classNames("p-24 pr-24", {
"pr-48 md:pb-64 md:pr-64 text-18": boldAppearance,
})}
>
{typeof content === "string" ? (
<RichText markdown={content} />
) : (
content
)}
</div>
</details>
);
}
32 changes: 19 additions & 13 deletions packages/dito/app/components/LinkBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ const LinkBar = <T extends { url: string }>({
}: {
elements: T[];
currentElement: T;
}) => (
<div className="flex justify-center space-x-8 mt-20">
{elements.map((element) => (
<Link
key={element.url}
to={element.url}
className={`h-6 flex-1 transition-all duration-300 ${
element.url == currentElement.url ? "bg-blue-800" : "bg-blue-300"
}`}
/>
))}
</div>
);
}) => {
const currentIndex = elements.findIndex(
(element) => element.url === currentElement.url,
);

return (
<div className="flex justify-center space-x-8 mt-20">
{elements.map((element, index) => (
<Link
key={element.url}
to={element.url}
className={`h-6 flex-1 transition-all duration-300 ${
index <= currentIndex ? "bg-blue-800" : "bg-blue-300"
}`}
/>
))}
</div>
);
};

export default LinkBar;
1 change: 1 addition & 0 deletions packages/dito/app/resources/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PRE_CHECK_START_BUTTON_ID = "preCheck-start-button";
276 changes: 180 additions & 96 deletions packages/dito/app/resources/content.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/dito/app/resources/staticRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ROUTE_PRECHECK_STATIC_PDF: Route = {

export const ROUTE_PRECHECK: Route = {
url: "/vorpruefung",
title: "Vorprüfung",
title: "Vorprüfung: Digitalbezug einschätzen",
parent: ROUTE_LANDING.url,
};
export const ROUTE_RESULT: Route = {
Expand Down
6 changes: 6 additions & 0 deletions packages/dito/app/routes/vorpruefung.$questionId/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export type TQuestion = {
question: string;
positiveResult: string;
negativeResult: string;
resultHint?: {
positiveResult?: string;
negativeResult?: string;
unsureResult?: string;
};
text?: string;
url: string;
prevLink: string;
Expand All @@ -115,6 +120,7 @@ export type TQuestion = {
title: string;
text: string;
};
interoperability?: boolean;
};

export type PreCheckAnswerOption = {
Expand Down
54 changes: 44 additions & 10 deletions packages/dito/app/routes/vorpruefung._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import Background from "@digitalcheck/shared/components/Background";
import Box from "@digitalcheck/shared/components/Box";
import ButtonContainer from "@digitalcheck/shared/components/ButtonContainer";
import Container from "@digitalcheck/shared/components/Container";
import DetailsSummary from "@digitalcheck/shared/components/DetailsSummary.tsx";
import Heading from "@digitalcheck/shared/components/Heading.tsx";
import Image from "@digitalcheck/shared/components/Image.tsx";
import InfoBox from "@digitalcheck/shared/components/InfoBox";
import InlineNotice from "@digitalcheck/shared/components/InlineNotice";
import RichText from "@digitalcheck/shared/components/RichText.tsx";
import { MetaFunction } from "@remix-run/react";
import Accordion from "components/Accordion.tsx";
import SupportBanner from "components/SupportBanner";
import { PRE_CHECK_START_BUTTON_ID } from "resources/constants";
import { preCheck } from "resources/content";
import { ROUTE_LANDING, ROUTE_PRECHECK } from "resources/staticRoutes";
import prependMetaTitle from "utils/metaTitle";
Expand Down Expand Up @@ -35,10 +40,19 @@ export default function Index() {
></Box>
</Container>
<Container paddingTop="0">
<div className="ds-stack-16 mb-40">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be solved through additionalClassnames in the Container above?

{preCheck.start.hints.map((hint, index) => (
<DetailsSummary
key={index}
title={hint.title}
content={hint.text}
/>
))}
</div>
<ButtonContainer
buttons={[
{
id: "preCheck-start-button",
id: PRE_CHECK_START_BUTTON_ID,
text: preCheck.start.buttonText,
href: preCheck.questions[0].url,
type: "submit",
Expand All @@ -53,14 +67,6 @@ export default function Index() {
/>
</Container>
</Background>
<Container additionalClassNames="max-sm:!p-0">
<InlineNotice
look="tips"
title={preCheck.start.info.title}
tagName="h2"
content={preCheck.start.info.text}
></InlineNotice>
</Container>
<Container>
<InfoBox
heading={{
Expand All @@ -70,6 +76,34 @@ export default function Index() {
items={preCheck.start.summary.items}
></InfoBox>
</Container>
<Container paddingTop="0">
<Background backgroundColor="blue">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Container above can also have a backgroundColor, could that work here?

<div className="px-64 py-40 flex gap-64 items-center max-sm:flex-col-reverse max-sm:px-16 max-sm:gap-48">
<div className="md:pl-32 ds-stack-8 gap-20 md:w-1/3">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classes of the divs could maybe be merged (maybe even with Container above, also see paddingTop and paddingBottom?

<Image
url={preCheck.start.info.image.src}
alternativeText={preCheck.start.info.image.alt}
/>
</div>
<div>
<Heading
tagName="h3"
look="ds-heading-03-reg"
text={preCheck.start.info.title}
/>
<RichText markdown={preCheck.start.info.text} />
</div>
</div>
</Background>
</Container>
<Container>
<Heading
tagName="h2"
look="ds-heading-02-reg text-center mb-64 max-sm:mb-56"
text={preCheck.faq.title}
/>
<Accordion items={preCheck.faq.items} />
</Container>
<SupportBanner />
</>
);
Expand Down
104 changes: 33 additions & 71 deletions packages/dito/app/routes/vorpruefung.ergebnis/ResultForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ButtonContainer from "@digitalcheck/shared/components/ButtonContainer";
import Container from "@digitalcheck/shared/components/Container";
import DetailsSummary from "@digitalcheck/shared/components/DetailsSummary";
import Heading from "@digitalcheck/shared/components/Heading";
import Input from "@digitalcheck/shared/components/Input";
Expand All @@ -10,15 +9,12 @@ import React, { useState } from "react";
import { preCheck } from "resources/content";
import { PreCheckAnswers } from "routes/vorpruefung.$questionId/route";
import getResultValidatorForAnswers from "routes/vorpruefung.ergebnis/resultValidation";
import { useFeatureFlag } from "utils/featureFlags";

export default function ResultForm({
answers,
}: Readonly<{
answers: PreCheckAnswers;
}>) {
const quickSendNkrFlag = useFeatureFlag("digitalcheck.quicksend-nkr");

const form = useForm({
validator: getResultValidatorForAnswers(answers),
method: "post",
Expand All @@ -39,32 +35,13 @@ export default function ResultForm({
const isPositive = !!Object.values(answers).find((a) => a === "yes");

return (
<Container
backgroundColor="white"
additionalClassNames="rounded-lg"
overhangingBackground
>
<>
<form {...form.getFormProps()}>
<fieldset className="ds-stack-32">
<legend>
{quickSendNkrFlag ? (
<Heading tagName="h2" text={preCheck.result.form.formLegend} />
) : (
<Heading
tagName="h2"
text="Vorprüfung ergänzen und herunterladen"
/>
)}
<Heading tagName="h2" text={preCheck.result.form.formLegend} />
</legend>
{quickSendNkrFlag && (
<RichText
markdown={
isPositive
? preCheck.result.form.instructionsPositive
: preCheck.result.form.instructionsNegative
}
/>
)}
<RichText markdown={preCheck.result.form.instructions} />
{Object.keys(answers).map((answer) => (
<input
key={answer}
Expand All @@ -73,6 +50,12 @@ export default function ResultForm({
type="hidden"
/>
))}
<Input
name="email"
type={"email"}
label={preCheck.result.form.emailLabel}
error={form.error("email")}
/>
<Input
name="title"
label={preCheck.result.form.policyTitleLabel}
Expand All @@ -88,54 +71,33 @@ export default function ResultForm({
/>
)}
<ButtonContainer
buttons={
quickSendNkrFlag
? [
{
id: "result-email-button",
name: "_action",
value: "email",
text: preCheck.result.form.sendEmailButton.text,
look: "primary",
className: "plausible-event-name=Quicksend+Click",
},
{
id: "result-download-button",
name: "_action",
value: "download",
text: preCheck.result.form.downloadPdfButton.text,
look: "ghost",
},
]
: [
{
id: "result-download-button",
name: "_action",
value: "download",
text: preCheck.result.form.downloadPdfButton.text,
look: "primary",
},
]
}
buttons={[
{
id: "result-email-button",
name: "_action",
value: "email",
text: preCheck.result.form.sendEmailButton.text,
look: "primary",
className: "plausible-event-name=Quicksend+Click",
},
]}
/>
</fieldset>
</form>
{quickSendNkrFlag && (
<div className="ds-stack-16 mt-40">
<Heading
tagName="h3"
className="ds-label-section"
text={preCheck.result.form.faqs.title}
<div className="ds-stack-16 mt-40">
<Heading
tagName="h3"
className="ds-label-section"
text={preCheck.result.form.faqs.title}
/>
{preCheck.result.form.faqs.details.map((detail) => (
<DetailsSummary
key={detail.label}
title={detail.label}
content={detail.text}
/>
{preCheck.result.form.faqs.details.map((detail) => (
<DetailsSummary
key={detail.label}
title={detail.label}
content={detail.text}
/>
))}
</div>
)}
</Container>
))}
</div>
</>
);
}
Loading
Loading