fix: FIFO queue for waitlisting; send email for application form; EU logo in contact page in light mode
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
import { useEffect, useRef, type ReactNode } from "react";
|
||||
import { SITE_FACEBOOK_URL } from "~/lib/site-links";
|
||||
import { data, Form, Link, useLocation, useNavigation } from "react-router";
|
||||
import { data, Form, Link, useLocation, useNavigation, useRouteLoaderData } from "react-router";
|
||||
|
||||
import { ArrowIcon, Button } from "~/components/ui/Button";
|
||||
import { EuBadge } from "~/components/ui/EuBadge";
|
||||
@@ -60,6 +60,7 @@ import {
|
||||
} from "./_page-kit/sections";
|
||||
|
||||
import "./_page-kit/motion.css";
|
||||
import { DEFAULT_THEME, type AppTheme } from "~/lib/theme";
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
LOADER
|
||||
@@ -230,7 +231,10 @@ function validate(values: ContactValues, locale: Locale): ContactErrors {
|
||||
* though the browser decides triage state, and the value would be silently
|
||||
* discarded anyway - so the body below is the whitelist and only it.
|
||||
*/
|
||||
async function createContactSubmission(values: ContactValues): Promise<void> {
|
||||
async function createContactSubmission(
|
||||
values: ContactValues,
|
||||
forwardedFor?: string,
|
||||
): Promise<void> {
|
||||
const env = getServerEnv();
|
||||
const url = `${env.STRAPI_URL.replace(/\/+$/, "")}/api/contact-submissions`;
|
||||
|
||||
@@ -240,6 +244,7 @@ async function createContactSubmission(values: ContactValues): Promise<void> {
|
||||
"content-type": "application/json",
|
||||
accept: "application/json",
|
||||
...(env.STRAPI_TOKEN ? { authorization: `Bearer ${env.STRAPI_TOKEN}` } : {}),
|
||||
...(forwardedFor ? { "x-forwarded-for": forwardedFor } : {}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
data: {
|
||||
@@ -282,7 +287,10 @@ export async function action({ params, request }: Route.ActionArgs) {
|
||||
}
|
||||
|
||||
try {
|
||||
await createContactSubmission(values);
|
||||
await createContactSubmission(
|
||||
values,
|
||||
request.headers.get("x-forwarded-for") ?? undefined,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("[contact] submission failed", error);
|
||||
const t = createTranslator(locale);
|
||||
@@ -370,6 +378,9 @@ export default function Contact({
|
||||
const { pathname } = useLocation();
|
||||
const isSubmitting = navigation.state === "submitting";
|
||||
|
||||
const root = useRouteLoaderData<{ theme?: AppTheme }>("root");
|
||||
const theme: AppTheme = root?.theme ?? DEFAULT_THEME;
|
||||
|
||||
const errors = actionData?.errors ?? {};
|
||||
const values = actionData?.values ?? EMPTY_VALUES;
|
||||
const formError =
|
||||
@@ -681,7 +692,7 @@ export default function Contact({
|
||||
size="sm"
|
||||
statement={t("site.euStatement")}
|
||||
locale={locale}
|
||||
surface="dark"
|
||||
surface={theme}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user