Skip to content

Commit

Permalink
Add Prinzip subpage
Browse files Browse the repository at this point in the history
  • Loading branch information
lsolcher committed Oct 18, 2024
1 parent 2c909b8 commit eaefb52
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import Background from "@digitalcheck/shared/components/Background.tsx";
import Container from "@digitalcheck/shared/components/Container.tsx";
import { json, useLoaderData, useOutletContext } from "@remix-run/react";

import DetailInfo from "@digitalcheck/shared/components/DetailInfo.tsx";
import { LoaderFunction } from "@remix-run/node";
import { type Prinzip } from "../utils/strapiData.server.ts";

export const loader: LoaderFunction = async ({ params }) => {

Check failure on line 9 in packages/dito/app/routes/digitaltauglichkeit.prinzipien.$prinzip.tsx

View workflow job for this annotation

GitHub Actions / check-test-build-deploy (dito) / check-and-test-shared / check-and-test

Async arrow function 'loader' has no 'await' expression
const slug = params.prinzip;
if (!slug) throw new Response("Prinzip not found", { status: 404 });

Check warning on line 11 in packages/dito/app/routes/digitaltauglichkeit.prinzipien.$prinzip.tsx

View workflow job for this annotation

GitHub Actions / check-test-build-deploy (dito) / check-and-test-shared / check-and-test

Expected an error object to be thrown
return json({ slug });
};

export default function Digitaltauglichkeit_Prinzipien_Detail() {
const { slug } = useLoaderData<typeof loader>();

Check warning on line 16 in packages/dito/app/routes/digitaltauglichkeit.prinzipien.$prinzip.tsx

View workflow job for this annotation

GitHub Actions / check-test-build-deploy (dito) / check-and-test-shared / check-and-test

Unsafe assignment of an `any` value
const prinzips: Prinzip[] = useOutletContext();
const prinzip = prinzips.find((prinzip) => prinzip.slug === slug);
if (!prinzip) {
return (
<Background backgroundColor="blue">
<Container>
<h1>Prinzip not found</h1>
<p>Sorry, the requested principle could not be found.</p>
</Container>
</Background>
);
}
return (
<>
<Container>
<DetailInfo label={["asa", "abc"]} />

<h2>All Properties:</h2>
<ul>
{Object.entries(prinzip).map(([key, value]) => (
<li key={key}>
<strong>{key}:</strong> {JSON.stringify(value, null, 2)}
</li>
))}
</ul>
</Container>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import Background from "@digitalcheck/shared/components/Background.tsx";
import Container from "@digitalcheck/shared/components/Container.tsx";
import { redirect } from "@remix-run/node";
import { json, Link, MetaFunction, useLoaderData } from "@remix-run/react";
import {
json,
Link,
MetaFunction,
Outlet,
useLoaderData,
} from "@remix-run/react";
import {
ROUTE_LANDING,
ROUTE_PRINZIPLES,
Expand Down Expand Up @@ -44,13 +50,6 @@ export default function Prinzipien() {
*/}
</Container>
</Background>
{/* <Container>
<DetailInfo
isSelectable={true}
selectOptions={prinzips.map((prinzip: Prinzip) => prinzip.Name)}
onChange={(e) => handleSelectChange(e.target.value)}
/>
</Container>*/}
<div>
<h1>Prinzipien</h1>
<nav>
Expand All @@ -71,7 +70,7 @@ export default function Prinzipien() {
)}
</nav>
</div>
{/*<Outlet />*/}
<Outlet context={prinzips} />
</>
);
}

0 comments on commit eaefb52

Please sign in to comment.