import Head from "next/head"; import Menu from "../components/Menu"; import Image from "next/image"; import { Alert, AlertColor, AlertTitle, Pagination, useTheme, Box, } from "@mui/material"; import { useContext, useEffect, useState } from "react"; import version from "./../package.json"; import Link from "../components/Link"; import { GetStaticProps, InferGetStaticPropsType } from "next"; import { TranslateContext } from "../Modules/context"; import { getData } from "./api/theme"; interface InnerUpdateType { type: AlertColor; title: string; text: string; link?: string; } type UpdateType = InnerUpdateType | object; interface CurrentPictureProps { picture: number; } // Turns the number into the correct screenshot function CurrentPicture({ picture }: CurrentPictureProps) { // Gets the name of the picture function picturePicker(picture: number) { switch (picture) { case 1: return "Main"; case 2: return "Standings"; case 3: return "Squad"; case 4: return "Transfer"; case 5: return "DetailedPlayer"; case 6: return "Predictions"; case 7: return "LeagueAdmin"; case 8: return "HistoricalSquad"; default: return "Usermenu"; } } const theme = useTheme(); const name = picturePicker(picture); const actualSrc = "/screenshots/" + name + (theme.palette.mode === "dark" ? "Dark" : "Light") + ".png"; return ( <> {"Screenshot {"Screenshot ); } // Shows all the screenshots and allows the user to pick screenshots they would like to see function Carrousel() { const pictures = 9; const [picture, setPicture] = useState(1); useEffect(() => { const interval = setInterval(() => { picture < pictures ? setPicture(picture + 1) : setPicture(1); }, 5000); return () => { clearInterval(interval); }; }, [picture]); return ( <> setPicture(value)} /> ); } export default function Home({ update, }: // For some reason the inference does not work here InferGetStaticPropsType) { const t = useContext(TranslateContext); return ( <> {t("Open Source Fantasy Manager")}

{t("Open Source Fantasy Manager")}

{t("A modern open source Fantasy Manager. ")} {t("The source code is available here. ")} {t( "The goal of this site is to be the best place to play a Fantasy Manager with your friends and family. ", )} {t( "To play you must have an account which is free to do in the log in button in the top right of the screen. ", )}

{t("Features")}

  1. {t("Completely free and open source. ")}
  2. {t("Many different leagues to use(Bundesliga, EPL, etc). ")}
  3. {t("Unlimited users and unlimited leagues for every user. ")}
  4. {t("Customize starting money. ")}
  5. {t("Customize starred player bonus. ")}
  6. {t("Limit transfer amount. ")}
  7. {t( "Ability to allow players to be bought by multiple users in the same league. ", )}
  8. {t("Ranking tables for matchday points and total points. ")}
  9. {t( "Many ways to search through players including price, points, position, club, name, etc. ", )}
  10. {t("Predict match results to earn more points. ")}
  11. {t("Customize point earnings for match predictions. ")}
  12. {t("Download historical player data as json or csv. ")}
  13. {t( "View historical data for a player and what leagues player played in. ", )}
  14. {t("See historical squads for every league. ")}
  15. {t( "And all of these features in a Modern Responsive UI available in a light and dark theme and multiple languages. ", )}

{t("Community")}

{t( "You can go to the Github Discussions to ask questions or find leagues to join. ", )} {" "}

{t("Screenshots")}

{update.type && ( {t(update.title)} {update.link === undefined &&

{t(update.text)}

} {update.link && ( {t(update.text)} )}
)} ); } export const getStaticProps: GetStaticProps = async (context) => { let update: UpdateType = {}; // Checks if this is running in a non production setup if (process.env.APP_ENV === "development" || process.env.APP_ENV === "test") { update = { type: "info", title: "Not for Production", text: "This is the development or testing version of this software. Do not use in production.", }; } else { // Checks if this is the latest version and if it does adds data console.log("Checking for updates"); interface data { name: string; version: string; } const data: data | undefined = await fetch( "https://git.lschaefer.xyz/lukasdotcom/fantasy-manager/raw/branch/stable/package.json", ).then((res) => (res.ok ? res.json() : undefined)); if (!data) { console.log("Failed to get version data from update server."); update = { type: "error", title: "Failure", text: "Failing to check for updates.", link: "/error/update", }; } else if (version.version !== data.version) { update = { type: "warning", title: "Out of Date", text: "New Update Available for more info Click Here", link: `https://git.lschaefer.xyz/lukasdotcom/fantasy-manager/releases/tag/${data.version}`, }; } } return { props: { update, t: await getData(context), }, // Checks at max every day revalidate: 3600 * 24, }; };