From 416b327152da60344c45452600c9cf3b9778b38d Mon Sep 17 00:00:00 2001 From: shellyear Date: Thu, 16 May 2024 14:46:19 +0200 Subject: [PATCH] [feature] show statistick mock page with graphs instead of a table --- src/components/MainView.jsx | 10 ++++++++++ src/components/statistics/StatisticsMock.jsx | 8 ++++++++ src/utils/Routes.jsx | 4 ++-- vite.config.js | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/components/statistics/StatisticsMock.jsx diff --git a/src/components/MainView.jsx b/src/components/MainView.jsx index 5cb6bee..beba46f 100644 --- a/src/components/MainView.jsx +++ b/src/components/MainView.jsx @@ -20,6 +20,7 @@ import { isAdmin } from "../utils/SecurityUtils"; import Messages from "./message/Messages"; import Footer from "../Footer"; import PropTypes from "prop-types"; +import { ANALYTICS_URL } from "../../config/index.js"; class MainView extends React.Component { constructor(props) { @@ -61,6 +62,14 @@ class MainView extends React.Component { } } + showStatistics = () => { + if (ANALYTICS_URL === "") { + transitionTo(routes.statistics); + } else { + window.location.href = ANALYTICS_URL; + } + }; + render() { if (this.props.status === ACTION_STATUS.PENDING) { return ; @@ -123,6 +132,7 @@ class MainView extends React.Component { this.showStatistics()} isActive={() => path.startsWith(Routes.statistics.path)} to={Routes.statistics.path} > diff --git a/src/components/statistics/StatisticsMock.jsx b/src/components/statistics/StatisticsMock.jsx new file mode 100644 index 0000000..6b66639 --- /dev/null +++ b/src/components/statistics/StatisticsMock.jsx @@ -0,0 +1,8 @@ +import React from "react"; +import StatisticsHtml from "../../../deploy/shared/nginx/statistics.html"; + +const StatisticsMock = () => { + return
; +}; + +export default StatisticsMock; diff --git a/src/utils/Routes.jsx b/src/utils/Routes.jsx index 0cdd247..855eef6 100644 --- a/src/utils/Routes.jsx +++ b/src/utils/Routes.jsx @@ -10,7 +10,7 @@ import requireAuth from "../components/misc/hoc/RequireAuth"; import UsersController from "../components/user/UsersController"; import UserController from "../components/user/UserController"; import PasswordChangeController from "../components/user/PasswordChangeController"; -import Statistics from "../components/statistics/Statistics"; +import StatisticsMock from "../components/statistics/StatisticsMock"; import InstitutionsController from "../components/institution/InstitutionsController"; import InstitutionController from "../components/institution/InstitutionController"; import RecordsController from "../components/record/RecordsController"; @@ -35,7 +35,7 @@ export const authRoutes = ( - + diff --git a/vite.config.js b/vite.config.js index 46e6d61..f048f6f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,6 +16,7 @@ export default defineConfig({ cache: false, }), ], + assetsInclude: ["**/*.html"], build: { sourcemap: true, emptyOutDir: true,