-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
587 additions
and
464 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {notFound} from 'next/navigation'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
export default function CatchAllPage() { | ||
notFound(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
'use client' | ||
'use client'; | ||
|
||
import ErrorPanel from "@/app/components/ErrorPanel"; | ||
import { useTranslations } from "use-intl"; | ||
import ErrorPanel from '@/app/components/ErrorPanel'; | ||
import { useTranslations } from 'use-intl'; | ||
|
||
export default function Error() { | ||
const t = useTranslations('Error') | ||
const t = useTranslations('Error'); | ||
return ( | ||
<ErrorPanel> | ||
<h2>{t('header')}</h2> | ||
</ErrorPanel> | ||
) | ||
} | ||
); | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { getTranslations } from "next-intl/server"; | ||
import ErrorPanel from "@/app/components/ErrorPanel"; | ||
import { getTranslations } from 'next-intl/server'; | ||
import ErrorPanel from '@/app/components/ErrorPanel'; | ||
|
||
export default async function NotFound() { | ||
const t = await getTranslations('NotFound') | ||
const t = await getTranslations('NotFound'); | ||
|
||
return ( | ||
<ErrorPanel> | ||
<h2>{t('header')}</h2> | ||
<span>{t('body1')}</span> | ||
<span>{t('body2')}</span> | ||
</ErrorPanel> | ||
) | ||
} | ||
); | ||
} |
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 |
---|---|---|
@@ -1,37 +1,38 @@ | ||
import { fetchLaskutBySecret } from "@/app/lib/data"; | ||
import MaksutPanel from "@/app/components/MaksutPanel"; | ||
import { notFound, redirect } from "next/navigation"; | ||
import Header from "@/app/components/Header"; | ||
import { routing } from "@/i18n/routing"; | ||
import { getLocale } from "next-intl/server"; | ||
import ExpiredPanel from "@/app/components/ExpiredPanel"; | ||
import { Locale } from '@/app/lib/types' | ||
import { fetchLaskutBySecret } from '@/app/lib/data'; | ||
import MaksutPanel from '@/app/components/MaksutPanel'; | ||
import { notFound, redirect } from 'next/navigation'; | ||
import Header from '@/app/components/Header'; | ||
import { routing } from '@/i18n/routing'; | ||
import { getLocale } from 'next-intl/server'; | ||
import ExpiredPanel from '@/app/components/ExpiredPanel'; | ||
import { Locale } from '@/app/lib/types'; | ||
|
||
export default async function Page({ searchParams }: {searchParams: Promise<{secret?: string}>}) { | ||
const { secret } = await searchParams | ||
const locale = await getLocale() | ||
export default async function Page({ | ||
searchParams, | ||
}: { | ||
searchParams: Promise<{ secret?: string }>; | ||
}) { | ||
const { secret } = await searchParams; | ||
const locale = await getLocale(); | ||
|
||
if (!routing.locales.includes(locale as Locale)) { | ||
redirect(`/fi?secret=${secret}`) | ||
redirect(`/fi?secret=${secret}`); | ||
} | ||
|
||
if (!secret) { | ||
notFound() | ||
notFound(); | ||
} | ||
const { laskut, contact } = await fetchLaskutBySecret(secret) | ||
const activeLasku = laskut.find((lasku) => lasku.secret === secret) | ||
const { laskut, contact } = await fetchLaskutBySecret(secret); | ||
const activeLasku = laskut.find((lasku) => lasku.secret === secret); | ||
|
||
if (!laskut.length || !activeLasku) { | ||
return ( | ||
<ExpiredPanel contact={contact}/> | ||
) | ||
return <ExpiredPanel contact={contact} />; | ||
} | ||
|
||
|
||
return ( | ||
<> | ||
<Header lasku={activeLasku}></Header> | ||
<MaksutPanel laskut={laskut} secret={secret}/> | ||
<MaksutPanel laskut={laskut} secret={secret} /> | ||
</> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
'use client' | ||
'use client'; | ||
|
||
import Panel from "@/app/components/Panel"; | ||
import AlertIcon from "@/app/components/AlertIcon"; | ||
import Panel from '@/app/components/Panel'; | ||
import AlertIcon from '@/app/components/AlertIcon'; | ||
|
||
const ErrorPanel = ({children}: {children: React.ReactNode}) => { | ||
const ErrorPanel = ({ children }: { children: React.ReactNode }) => { | ||
return ( | ||
<div style={{marginTop: '72px'}}> | ||
<div style={{ marginTop: '72px' }}> | ||
<Panel> | ||
<AlertIcon></AlertIcon> | ||
{children} | ||
</Panel> | ||
</div> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default ErrorPanel | ||
export default ErrorPanel; |
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 |
---|---|---|
@@ -1,19 +1,22 @@ | ||
'use client' | ||
'use client'; | ||
|
||
import ErrorPanel from "@/app/components/ErrorPanel"; | ||
import { useTranslations } from "use-intl"; | ||
import { OphLink } from "@opetushallitus/oph-design-system"; | ||
import ErrorPanel from '@/app/components/ErrorPanel'; | ||
import { useTranslations } from 'use-intl'; | ||
import { OphLink } from '@opetushallitus/oph-design-system'; | ||
|
||
const ExpiredPanel = ({contact}: {contact: string | undefined}) => { | ||
const t = useTranslations('ExpiredPanel') | ||
const ExpiredPanel = ({ contact }: { contact: string | undefined }) => { | ||
const t = useTranslations('ExpiredPanel'); | ||
|
||
return ( | ||
<ErrorPanel> | ||
<h2>{t('header')}</h2> | ||
<span>{t('body1')}</span> | ||
<span>{t('body2')}<OphLink href={`mailto:${contact}`}>{contact}</OphLink>.</span> | ||
<span> | ||
{t('body2')} | ||
<OphLink href={`mailto:${contact}`}>{contact}</OphLink>. | ||
</span> | ||
</ErrorPanel> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default ExpiredPanel; | ||
export default ExpiredPanel; |
Oops, something went wrong.