Skip to content

Commit

Permalink
Add feature flag for FeedbackForm
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikSchmidt committed Aug 2, 2024
1 parent 868d407 commit 8e42b7a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/dito/app/routes/methoden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ import RichText from "@digitalcheck/shared/components/RichText";
import ContactSupportOutlined from "@digitalservicebund/icons/ContactSupportOutlined";
import GroupOutlined from "@digitalservicebund/icons/GroupOutlined";
import TimerOutlined from "@digitalservicebund/icons/TimerOutlined";
import { MetaFunction } from "@remix-run/react";
import { json, useLoaderData, type MetaFunction } from "@remix-run/react";
import FeedbackForm from "components/FeedbackForm.tsx";
import SupportBanner from "components/SupportBanner";
import { renderToString } from "react-dom/server";
import { header, methods } from "resources/content";
import { ROUTE_METHODS } from "resources/staticRoutes";
import unleash from "utils/featureFlags.server.ts";
import prependMetaTitle from "utils/metaTitle";
import { iconClassName } from "../utils/iconStyle.ts";

export const meta: MetaFunction = ({ matches }) => {
return prependMetaTitle(ROUTE_METHODS.title, matches);
};

export default function Index() {
export function loader() {
const feedbackFormFlag = unleash.isEnabled("digitalcheck.feedback-form");
console.log("Feedback form flag:", feedbackFormFlag);
return json({ feedbackFormFlag });
}

export default function Methoden() {
const { feedbackFormFlag } = useLoaderData<typeof loader>();

// This messy code is a hacky solution to inject icons into the content, while preserving the ability to modify content easily via Markdown
const timerOutlined = renderToString(
<strong className={iconClassName}>
Expand Down Expand Up @@ -92,7 +101,7 @@ export default function Index() {
items={methods.nextSteps.items}
/>
</Container>
<FeedbackForm />
{feedbackFormFlag && <FeedbackForm />}
<SupportBanner withFeedbackBanner={false} />
</>
);
Expand Down

0 comments on commit 8e42b7a

Please sign in to comment.