diff --git a/client/src/components/app.tsx b/client/src/components/app.tsx index 8189502..6cf94a4 100644 --- a/client/src/components/app.tsx +++ b/client/src/components/app.tsx @@ -5,6 +5,7 @@ import Home from "../routes/home/index"; import Project from "../routes/project/index"; import NotFoundPage from '../routes/notfound/index'; import Header from "./header/index"; +import Footer from "./footer"; const App: FunctionalComponent = () => { let currentUrl: string; @@ -13,14 +14,15 @@ const App: FunctionalComponent = () => { }; return ( -
-
- - - - - -
+
+
+ + + + + +
); }; diff --git a/client/src/components/footer/index.tsx b/client/src/components/footer/index.tsx new file mode 100644 index 0000000..53d4ef1 --- /dev/null +++ b/client/src/components/footer/index.tsx @@ -0,0 +1,30 @@ +import { FunctionalComponent, h } from "preact"; +import style from "./style.module.css"; + +declare var __BUILD__: any; + +export interface FooterProps { + class?: string +} + +const Footer: FunctionalComponent = ({ ...props}) => { + console.log(__BUILD__) + return ( +
+
+
+

+ Propulsé par Guesstimate et publié sous licence AGPL-3.0. +

+

+ Version: {__BUILD__.version} - + Réf.: {__BUILD__.gitRef ? __BUILD__.gitRef : '??'} - + Date de construction: {__BUILD__.buildDate ? __BUILD__.buildDate : '??'} +

+
+
+
+ ); +}; + +export default Footer; diff --git a/client/src/components/footer/style.module.css b/client/src/components/footer/style.module.css new file mode 100644 index 0000000..c1ea79f --- /dev/null +++ b/client/src/components/footer/style.module.css @@ -0,0 +1,3 @@ +.footer { + display: inherit; +} \ No newline at end of file diff --git a/client/src/components/footer/style.module.css.d.ts b/client/src/components/footer/style.module.css.d.ts new file mode 100644 index 0000000..980cacc --- /dev/null +++ b/client/src/components/footer/style.module.css.d.ts @@ -0,0 +1,12 @@ +declare namespace StyleModuleCssModule { + export interface IStyleModuleCss { + footer: string; + } +} + +declare const StyleModuleCssModule: StyleModuleCssModule.IStyleModuleCss & { + /** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */ + locals: StyleModuleCssModule.IStyleModuleCss; +}; + +export = StyleModuleCssModule; diff --git a/client/webpack.config.js b/client/webpack.config.js index 272ddb7..0d0950b 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const webpack = require('webpack'); const path = require('path'); const env = process.env; +const exec = require('child_process').execSync; module.exports = { mode: `${env.NODE_ENV ? env.NODE_ENV : 'production'}`, @@ -73,5 +74,24 @@ module.exports = { new MiniCssExtractPlugin({ filename: '[name].[hash].css' }), + new webpack.DefinePlugin({ + __BUILD__: JSON.stringify({ + version: getCurrentVersion(), + gitRef: getCurrentGitRef(), + buildDate: new Date(), + }) + }) ] -}; \ No newline at end of file +}; + +function getCurrentVersion() { + let version + try { + version = exec("git describe --abbrev=0 2>/dev/null") + } catch(err) {} + return version ? version : "0.0.0"; +} + +function getCurrentGitRef() { + return exec("git log -n 1 --pretty='format:%h'").toString() +} \ No newline at end of file