Skip to content

Commit

Permalink
DIGG-215: Datasamverkan new domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Gasperini authored and Alessandro Gasperini committed Jan 22, 2024
1 parent caa0f37 commit 22ba702
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 7 deletions.
9 changes: 5 additions & 4 deletions components/content/DomainPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ export const DomainPage: React.FC<DomainProps> = (props) => {
return (
<div id="DomainPage">
<Container>
{domain === "data" && (
<Preamble className="max-w-md">{preamble}</Preamble>
)}
{domain === "data" ||
(domain === "datasamverkan" && (
<Preamble className="max-w-md">{preamble}</Preamble>
))}

{puffs && <RelatedContentBlock links={puffs.links as PromoProps[]} />}

Expand Down Expand Up @@ -159,7 +160,7 @@ export const DomainPage: React.FC<DomainProps> = (props) => {
</ContentBox>
)}

{areas && !domain && lang === "sv" && (
{areas && domain === "datasamverkan" && lang === "sv" && (
<div className="py-xl">
<Heading size={"md"} level={2}>
{t("pages|data$data-areas_text")}
Expand Down
6 changes: 4 additions & 2 deletions components/content/Promo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export const Promo: FC<{
<Link
href={
isExternalLink(link.slug)
? link.slug
: pathname === "/" || pathname === "/data"
? "haha"
: pathname === "/" ||
pathname === "/data" ||
pathname === "/datasamverkan"
? `${link.slug}`
: `${pathname}${link.slug}`
}
Expand Down
23 changes: 23 additions & 0 deletions pages/datasamverkan/[...datasamverkanSlug].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { GetStaticPaths, GetStaticProps } from "next/types";
import { getMultiContainer } from "../../utilities";
import { Page } from "../[...containerSlug]";

export const getStaticProps: GetStaticProps = async ({ params, locale }) => {
const slugs = params?.datasamverkanSlug as Array<string>;
return (await getMultiContainer(
slugs,
locale || "sv",
"datasamverkan",
)) as any;
};

export const getStaticPaths: GetStaticPaths = async () => {
const paths: any[] = [];

return {
paths,
fallback: "blocking",
};
};

export default Page;
8 changes: 8 additions & 0 deletions pages/datasamverkan/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { getDomainAggregate } from "@/utilities";
import { DomainPage } from "@/components/content/DomainPage";

export async function getStaticProps({ locale }: any) {
return await getDomainAggregate("datasamverkan", locale);
}

export default DomainPage;
6 changes: 6 additions & 0 deletions pages/drafts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const getQuery = async (
secret,
revalidate: false,
});
case "/datasamverkan":
return await getDomainAggregate("datasamverkan", locale, {
state: Dataportal_ContainerState.Preview,
secret,
revalidate: false,
});
default:
return await getMultiContainer([slug.substring(1)], locale, undefined, {
state: Dataportal_ContainerState.Preview,
Expand Down
7 changes: 6 additions & 1 deletion types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ type CSPDirective =
| "trusted-types"
| "upgrade-insecure-requests";

type DiggDomain = "offentligai" | "data" | "oppen-kallkod" | "open-source";
type DiggDomain =
| "offentligai"
| "data"
| "oppen-kallkod"
| "open-source"
| "datasamverkan";

0 comments on commit 22ba702

Please sign in to comment.