Skip to content

Commit

Permalink
feat: add version component
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Sep 27, 2024
1 parent 05583ed commit 898729d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/frontend/src/envVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const ENV = envSchema.parse(isDev ? import.meta.env : window.ENV);
declare global {
interface Window {
ENV: typeof ENV;
APP_VERSION?: string;
}
}
10 changes: 9 additions & 1 deletion packages/frontend/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReportSearch } from "#components/ReportSearch.js";
import { css } from "#styled-system/css";
import { Box, Flex, Stack } from "#styled-system/jsx";
import { Box, Flex, Stack, styled } from "#styled-system/jsx";
import Badge from "@codegouvfr/react-dsfr/Badge";
import Button from "@codegouvfr/react-dsfr/Button";
import Footer from "@codegouvfr/react-dsfr/Footer";
Expand Down Expand Up @@ -139,3 +139,11 @@ const Layout = ({ children }: PropsWithChildren) => {
</Flex>
);
};

const VersionDisplay = () => {
const version = window.APP_VERSION;

if (!version) return null;

return <styled.div>Version {version}</styled.div>;
};

0 comments on commit 898729d

Please sign in to comment.