diff --git a/packages/backend/src/routes/userRoutes.ts b/packages/backend/src/routes/userRoutes.ts index 52d64a85..a1e7cd41 100644 --- a/packages/backend/src/routes/userRoutes.ts +++ b/packages/backend/src/routes/userRoutes.ts @@ -23,7 +23,7 @@ export const createUserTSchema = { response: { 200: userAndTokenTSchema }, }; export const loginTSchema = { - body: Type.Pick(userInput, ["email", "password", "udap"]), + body: Type.Pick(userInput, ["email", "password"]), response: { 200: userAndTokenTSchema }, }; export const verifyTokenTSchema = { diff --git a/packages/frontend/panda.config.ts b/packages/frontend/panda.config.ts index f33534a1..ef14d51c 100644 --- a/packages/frontend/panda.config.ts +++ b/packages/frontend/panda.config.ts @@ -31,7 +31,12 @@ export default defineConfig({ "100%": { transform: "rotate(360deg)" }, }, }, - tokens: {}, + tokens: { + colors: { + "yellow-waiting": { value: "#FEECC2" }, + "red-offline": { value: "#FFE9E6" }, + }, + }, semanticTokens: {}, }, }, diff --git a/packages/frontend/src/components/Banner.tsx b/packages/frontend/src/components/Banner.tsx index be31e49a..717141d3 100644 --- a/packages/frontend/src/components/Banner.tsx +++ b/packages/frontend/src/components/Banner.tsx @@ -1,5 +1,19 @@ import { type CenterProps, Center } from "#styled-system/jsx"; +import { cva } from "#styled-system/css"; +import { SyncFormStatus } from "./SyncForm"; -export const Banner = (props: CenterProps) => { - return
; +export const Banner = ({ status, ...props }: CenterProps & { status: SyncFormStatus }) => { + return
; }; + +const banner = cva({ + base: { bgColor: "background-open-blue-france" }, + variants: { + status: { + offline: { bgColor: "red-offline" }, + pending: { bgColor: "yellow-waiting" }, + saved: {}, + saving: {}, + }, + }, +}); diff --git a/packages/frontend/src/components/SyncForm.tsx b/packages/frontend/src/components/SyncForm.tsx index 31e96809..27c79105 100644 --- a/packages/frontend/src/components/SyncForm.tsx +++ b/packages/frontend/src/components/SyncForm.tsx @@ -8,7 +8,7 @@ import Button from "@codegouvfr/react-dsfr/Button"; import { styled } from "#styled-system/jsx"; import { fr } from "@codegouvfr/react-dsfr"; import { css } from "#styled-system/css"; - +import { useNetworkState } from "react-use"; export function SyncFormBanner({ form, baseObject, @@ -25,9 +25,12 @@ export function SyncFormBanner({ const router = useRouter(); const goBack = () => router.history.back(); + const { online } = useNetworkState(); + + const status = !online ? "offline" : Object.keys(diff).length ? "pending" : "saved"; return ( - + {/* @ts-ignore dsfr buttons props must have children */}