-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: deactivated account component, routes, translations and image
- Loading branch information
1 parent
dde4364
commit f794281
Showing
10 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 |
---|---|---|
|
@@ -74,4 +74,14 @@ i18n.addResourceBundle("fi", "forms", { | |
invalidEmail: "Sähköpostin tulee olla oikeassa muodossa (sisältäen @-merkin)", | ||
}); | ||
|
||
i18n.addResourceBundle("fi", "errors", { | ||
deactivatedAccount: { | ||
heading: "Käyttäjätunnuksesi ei ole voimassa.", | ||
subHeadingA: "Ota yhteyttä asiakaspalveluun sähköpostitse", | ||
subHeadingB: "tai Ota yhteyttä-lomakkeella.", | ||
email: "[email protected]", | ||
button: "Ota yhteyttä", | ||
}, | ||
}); | ||
|
||
export default i18n; |
This file contains 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 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,27 @@ | ||
import React from "react"; | ||
import { getCommonServerSideProps } from "@/modules/serverUtils"; | ||
import { GetServerSidePropsContext } from "next"; | ||
import { serverSideTranslations } from "next-i18next/serverSideTranslations"; | ||
import DeactivatedAccount from "common/src/components/DeactivatedAccount"; | ||
|
||
export async function getServerSideProps({ | ||
locale, | ||
}: GetServerSidePropsContext) { | ||
return { | ||
props: { | ||
...getCommonServerSideProps(), | ||
...(await serverSideTranslations(locale ?? "fi")), | ||
}, | ||
}; | ||
} | ||
|
||
const DeactivatedAccountPage = ({ feedbackUrl }: { feedbackUrl: string }) => { | ||
return ( | ||
<DeactivatedAccount | ||
feedbackUrl={feedbackUrl} | ||
imgSrc="/images/deactivated-account.png" | ||
/> | ||
); | ||
}; | ||
|
||
export default DeactivatedAccountPage; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 |
---|---|---|
|
@@ -5,6 +5,13 @@ | |
"500": { | ||
"body": "Something unexpected happened" | ||
}, | ||
"deactivatedAccount": { | ||
"heading": "Your User ID is not valid.", | ||
"subHeadingA": "Please contact support via email at", | ||
"subHeadingB": "or via the Contact us form.", | ||
"email": "[email protected]", | ||
"button": "Contact us" | ||
}, | ||
"applicationMutation": { | ||
"Validation error": "Error in the API call", | ||
"Form validation error": "Form validation error", | ||
|
This file contains 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 |
---|---|---|
|
@@ -5,6 +5,13 @@ | |
"500": { | ||
"body": "Jotain meni pieleen" | ||
}, | ||
"deactivatedAccount": { | ||
"heading": "Käyttäjätunnuksesi ei ole voimassa.", | ||
"subHeadingA": "Ota yhteyttä asiakaspalveluun sähköpostitse", | ||
"subHeadingB": "tai Ota yhteyttä-lomakkeella.", | ||
"email": "[email protected]", | ||
"button": "Ota yhteyttä" | ||
}, | ||
"applicationMutation": { | ||
"Validation error": "Virheellinen rajapintakutsu", | ||
"Form validation error": "Virheellinen lomake", | ||
|
This file contains 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 |
---|---|---|
|
@@ -5,6 +5,13 @@ | |
"500": { | ||
"body": "Något oväntat hände" | ||
}, | ||
"deactivatedAccount": { | ||
"heading": "Ditt användar-ID är inte giltigt.", | ||
"subHeadingA": "Var god och kontakta vår kundtjänst via email på", | ||
"subHeadingB": "eller via Ta kontakt-formuläret.", | ||
"email": "[email protected]", | ||
"button": "Ta kontakt" | ||
}, | ||
"applicationMutation": { | ||
"Validation error": "Ett fel uppstod i API-anropet", | ||
"Form validation error": "Formuläret innehåller fel", | ||
|
This file contains 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,116 @@ | ||
import React from "react"; | ||
import { useTranslation } from "next-i18next"; | ||
import styled from "styled-components"; | ||
import IconButton from "./IconButton"; | ||
import { IconArrowRight } from "hds-react"; | ||
import { fontBold, fontRegular } from "../common/typography"; | ||
|
||
const ErrorContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
max-width: var(--container-width-xl); | ||
margin: 0 auto; | ||
gap: 42px; | ||
padding-block: 42px; | ||
padding-inline: var(--spacing-s); | ||
--spacing-hz: var(--spacing-s); | ||
img { | ||
width: 185px; | ||
height: auto; | ||
margin: 0 auto; | ||
} | ||
@media (min-width: 768px) { | ||
flex-direction: row; | ||
padding-inline: var(--spacing-m); | ||
--spacing-hz: var(--spacing-m); | ||
img { | ||
display: flex; | ||
margin: 0; | ||
margin-inline: auto; | ||
width: auto; | ||
max-height: 418px; | ||
max-width: 350px; | ||
flex-grow: 1; | ||
} | ||
} | ||
`; | ||
|
||
const TextContent = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 42px; | ||
justify-content: center; | ||
@media (min-width: 768px) { | ||
order: -1; | ||
} | ||
`; | ||
|
||
const Heading = styled.h1` | ||
margin: 0; | ||
line-height: 1; | ||
font-size: 40px; | ||
${fontRegular} | ||
`; | ||
|
||
const Body = styled.p` | ||
margin: 0; | ||
`; | ||
|
||
const Email = styled.a` | ||
margin: 8px 0 0; | ||
${fontBold} | ||
`; | ||
|
||
// NOTE: This is a copy of the Footer component from the common package | ||
const constructFeedbackUrl = ( | ||
feedbackUrl: string, | ||
i18n: { language: string } | ||
) => { | ||
try { | ||
const url = new URL(feedbackUrl); | ||
url.searchParams.set("lang", i18n.language); | ||
return url.toString(); | ||
} catch (e) { | ||
return null; | ||
} | ||
}; | ||
|
||
const DeactivatedAccount = ({ | ||
feedbackUrl, | ||
imgSrc, | ||
}: { | ||
feedbackUrl: string; | ||
imgSrc: string; | ||
}) => { | ||
console.log(feedbackUrl); | ||
Check failure on line 85 in packages/common/src/components/DeactivatedAccount.tsx GitHub Actions / Lint admin ui
|
||
const { t, i18n } = useTranslation(); | ||
return ( | ||
<ErrorContainer> | ||
<img | ||
src={imgSrc} | ||
alt={t("errors:deactivatedAccount.heading")} | ||
width="350" | ||
height="418" | ||
aria-hidden="true" | ||
/> | ||
<TextContent> | ||
<Heading>{t("errors:deactivatedAccount.heading")}</Heading> | ||
<Body> | ||
{`${t("errors:deactivatedAccount.subHeadingA")} `} | ||
<Email href={`mailto:${t("errors:deactivatedAccount.email")}`}> | ||
{t("errors:deactivatedAccount.email")} | ||
</Email> | ||
{` ${t("errors:deactivatedAccount.subHeadingB")}`} | ||
</Body> | ||
<IconButton | ||
label={t("errors:deactivatedAccount.button")} | ||
icon={<IconArrowRight aria-hidden="true" />} | ||
href={constructFeedbackUrl(feedbackUrl, i18n) ?? feedbackUrl} | ||
rel="noopener noreferrer" | ||
/> | ||
</TextContent> | ||
</ErrorContainer> | ||
); | ||
}; | ||
|
||
export default DeactivatedAccount; |