Skip to content

Commit

Permalink
Add application version number to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
joonashak committed Jul 11, 2024
1 parent 0d8fa22 commit 2c92f49
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/src/components/layout/ContentContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Container, Typography } from "@mui/material";
import { ChildrenProps } from "../../common/types";
import Footer from "./Footer";

const ContentContainer = ({ children }: ChildrenProps) => (
<>
Expand All @@ -14,7 +15,7 @@ const ContentContainer = ({ children }: ChildrenProps) => (
fontWeight: 100,
}}
>
Made with ❤️ by 🦊
<Footer />
</Typography>
</Box>
</>
Expand Down
15 changes: 15 additions & 0 deletions web/src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Box, Typography } from "@mui/material";

const Footer = () => (
<Box component="span" sx={{ color: (theme) => theme.palette.text.secondary }}>
<Typography component="span" variant="overline">
Keijo {import.meta.env.APP_VERSION}
</Typography>
<Typography component="span" variant="caption">
{" "}
&mdash; Made with ❤️ by 🦊
</Typography>
</Box>
);

export default Footer;
4 changes: 4 additions & 0 deletions web/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly APP_VERSION: string;
}
5 changes: 3 additions & 2 deletions web/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
},
"include": ["vite.config.ts"]
"include": ["vite.config.ts", "package.json"]
}
4 changes: 4 additions & 0 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import packageJson from "./package.json";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: {
"import.meta.env.APP_VERSION": JSON.stringify(packageJson.version),
},
});

0 comments on commit 2c92f49

Please sign in to comment.