From 19e13ecce2aaf9026a23ca047bf3686d66c08d60 Mon Sep 17 00:00:00 2001 From: Tibor Djurica Potpara Date: Thu, 28 Nov 2024 20:39:02 +0000 Subject: [PATCH] feat: Remove statistics from front page --- Dockerfile | 6 +- pages/api/stats.js | 34 - pages/index.js | 98 +- server/serialization.js | 19 - src/PaginationPanel.js | 2 +- src/VotePanel.js | 2 +- src/theme.js | 4 +- .../client/__snapshots__/Footer.test.js.snap | 6 +- .../client/__snapshots__/Session.test.js.snap | 24 +- yarn.lock | 6230 +++++++++-------- 10 files changed, 3261 insertions(+), 3164 deletions(-) delete mode 100644 pages/api/stats.js diff --git a/Dockerfile b/Dockerfile index ed0b0a8..cfca19a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,17 @@ FROM node:current-alpine as build WORKDIR /app -ENV PATH /app/node_modules/.bin:$PATH +ENV PATH=/app/node_modules/.bin:$PATH COPY package.json /app/package.json COPY yarn.lock /app/yarn.lock RUN yarn --silent COPY . /app + +ENV NODE_OPTIONS=--openssl-legacy-provider RUN yarn build # Running the app -ENV NODE_ENV production +ENV NODE_ENV=production CMD ["node", "server"] diff --git a/pages/api/stats.js b/pages/api/stats.js deleted file mode 100644 index fc7b245..0000000 --- a/pages/api/stats.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2020 Tibor Djurica Potpara - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -const state = require("../../server/state").state; -const { serializeStats } = require("../../server/serialization"); - -export default (req, res) => { - if (req.method !== "GET") { - res.status(405).json({ errorCode: "method-not-supported" }); - return; - } - - res.status(200).json(serializeStats(state)); -}; diff --git a/pages/index.js b/pages/index.js index ad3c17a..aa7662e 100644 --- a/pages/index.js +++ b/pages/index.js @@ -25,106 +25,38 @@ import React from "react"; import Container from "@material-ui/core/Container"; import Box from "@material-ui/core/Box"; import Button from "@material-ui/core/Button"; -import { makeStyles } from "@material-ui/core/styles"; import Logo from "../src/Logo"; import Link from "next/link"; import Footer from "../src/Footer"; import PropTypes from "prop-types"; +import Typography from "@material-ui/core/Typography"; +import { makeStyles } from "@material-ui/core/styles"; -import Table from "@material-ui/core/Table"; -import TableBody from "@material-ui/core/TableBody"; -import TableCell from "@material-ui/core/TableCell"; -import TableContainer from "@material-ui/core/TableContainer"; -import Skeleton from "@material-ui/lab/Skeleton"; -import Alert from "@material-ui/lab/Alert"; -import AlertTitle from "@material-ui/lab/AlertTitle"; -import TableRow from "@material-ui/core/TableRow"; -import Paper from "@material-ui/core/Paper"; -import useSWR from "swr"; -import { state } from "../server/state"; -import { serializeStats } from "../server/serialization"; - -const useStyles = makeStyles((theme) => ({ - tableContainer: { - marginTop: theme.spacing(2), +export const useStyles = makeStyles((theme) => ({ + description: { + paddingBottom: theme.spacing(1), }, })); -function Statistics({ initialData }) { +export default function Index() { const classes = useStyles(); - const fetcher = (url) => fetch(url).then((r) => r.json()); - const { data, error } = useSWR("/api/stats", fetcher, { initialData, revalidateOnMount: true }); - - return ( - <> - {error && ( - - - Could not load statistics! - It's your fault probably. - - - )} - {!error && ( - - {!data && ( - - - - - - )} - {data && ( - - - - - Number of active sessions - - {data.numSessions} - - - - Total number of players - - {data.numPlayers} - - - - Number of voters - - {data.numVoters} - - - - Number of observers - - {data.numObservers} - - -
- )} -
- )} - - ); -} - -Statistics.propTypes = { - initialData: PropTypes.object, -}; -export default function Index({ initialData }) { return ( + + This is a a Planning Poker app, useful for Scrum grooming sessions to avoid anchoring in + point estimates. + + + To start a new session, click the button below. + -