From 035726b33fbba40d9fa200591e5d70ee9cebbf43 Mon Sep 17 00:00:00 2001 From: Topvennie Date: Thu, 15 Aug 2024 14:44:40 +0200 Subject: [PATCH 1/2] vinvoor: add retro theme --- vinvoor/src/navbar/NavBarLogo.tsx | 2 +- .../src/providers/CustomSnackbarProvider.tsx | 4 + vinvoor/src/theme.ts | 74 ++++++++++++++++++- 3 files changed, 76 insertions(+), 4 deletions(-) diff --git a/vinvoor/src/navbar/NavBarLogo.tsx b/vinvoor/src/navbar/NavBarLogo.tsx index 88f0fbe..d2a4990 100644 --- a/vinvoor/src/navbar/NavBarLogo.tsx +++ b/vinvoor/src/navbar/NavBarLogo.tsx @@ -26,7 +26,7 @@ export const NavBarLogo: FC = ({ sx }) => { pressedAmount === CLICK_AMOUNT && Date.now() - startTimePress <= CLICK_TIME_MS ) - setTheme("hidden"); + setTheme("kak"); } }; diff --git a/vinvoor/src/providers/CustomSnackbarProvider.tsx b/vinvoor/src/providers/CustomSnackbarProvider.tsx index 689abed..caf051d 100644 --- a/vinvoor/src/providers/CustomSnackbarProvider.tsx +++ b/vinvoor/src/providers/CustomSnackbarProvider.tsx @@ -18,6 +18,9 @@ export const CustomSnackbarProvider: FC = ({ "&.notistack-MuiContent-error": { backgroundColor: theme.palette.error.dark, }, + "&.notistack-MuiContent-info": { + backgroundColor: theme.palette.primary.main, + }, })); return ( @@ -29,6 +32,7 @@ export const CustomSnackbarProvider: FC = ({ Components={{ success: StyledMaterialDesignContent, error: StyledMaterialDesignContent, + info: StyledMaterialDesignContent, }} > {children} diff --git a/vinvoor/src/theme.ts b/vinvoor/src/theme.ts index a268897..4c30633 100644 --- a/vinvoor/src/theme.ts +++ b/vinvoor/src/theme.ts @@ -67,7 +67,7 @@ export const darkTheme = createTheme({ }, }); -export const hiddenTheme = createTheme({ +export const kakTheme = createTheme({ palette: { mode: "light", primary: { @@ -163,6 +163,73 @@ export const hiddenTheme = createTheme({ }, }); +export const retroTheme = createTheme({ + palette: { + mode: "light", + primary: { + main: "#244855", + }, + secondary: { + main: "#E64833", + }, + background: { + default: "#FBE9D0", + paper: "#F3DDC7", + }, + success: { + main: "#008000", + }, + error: { + main: "#ab0c26", + dark: "#7a0f20", + }, + info: { + main: "#024950", + }, + }, + leaderboard: { + first: "#FFE55C", + second: "#E0E0E0", + third: "#DAAA5E", + }, + heatmap: { + color0: { fill: "#e9ded1", stroke: "#ccc1b1" }, + color1: { fill: "#ccc1b1", stroke: "#a5a59b" }, + color2: { fill: "#a5a59b", stroke: "#778482" }, + color3: { fill: "#778482", stroke: "#50686d" }, + color4: { fill: "#50686d", stroke: "#244855" }, + color5: { fill: "#244855", stroke: "#193540" }, + colorActive: { fill: "#50686d", stroke: "#244855" }, + colorInActive: { fill: "#e9ded1", stroke: "#ccc1b1" }, + }, + days: { + color0: "#a3bfd0", + color1: "#7f9dad", + color2: "#5b7c8a", + color3: "#406270", + color4: "#244855", + }, + components: { + MuiTableCell: { + styleOverrides: { + root: { + borderBottom: "1px solid #874F41", + }, + }, + }, + MuiAlert: { + styleOverrides: { + outlinedError: { + borderColor: "#7a0f20", + }, + outlinedSuccess: { + borderColor: "#008000", + }, + }, + }, + }, +}); + export interface HeatmapRectStyle { fill: string; stroke: string; @@ -219,10 +286,11 @@ declare module "@mui/material/styles" { } } -export type ThemeMode = "light" | "dark" | "hidden"; +export type ThemeMode = "light" | "dark" | "kak" | "retro"; export const themeModes: Record = { light: lightTheme, dark: darkTheme, - hidden: hiddenTheme, + kak: kakTheme, + retro: retroTheme, }; From 436cbe5164d7ce1b54541863a13f9467c2e1d679 Mon Sep 17 00:00:00 2001 From: Topvennie Date: Thu, 15 Aug 2024 15:51:04 +0200 Subject: [PATCH 2/2] vinvoor: add navbar selector --- vinvoor/src/navbar/NavBar.tsx | 19 ++++++++++-- vinvoor/src/navbar/NavBarLogo.tsx | 16 +++++++++- vinvoor/src/navbar/NavBarPages.tsx | 17 ++++++++++- vinvoor/src/navbar/NavBarUserMenu.tsx | 44 ++++++++++++++++++++++----- vinvoor/src/theme.ts | 3 +- 5 files changed, 86 insertions(+), 13 deletions(-) diff --git a/vinvoor/src/navbar/NavBar.tsx b/vinvoor/src/navbar/NavBar.tsx index fa3cd7b..a970ba6 100644 --- a/vinvoor/src/navbar/NavBar.tsx +++ b/vinvoor/src/navbar/NavBar.tsx @@ -5,7 +5,7 @@ import { CreditCardMultipleOutline, CreditCardScanOutline, } from "mdi-material-ui"; -import { useContext } from "react"; +import { useContext, useState } from "react"; import { DarkModeToggle } from "../components/DarkModeToggle"; import { UserContext } from "../providers/UserProvider"; import { NavBarLogo } from "./NavBarLogo"; @@ -30,12 +30,15 @@ const userMenuPages: PageIcon[] = [ export const NavBar = () => { const { user } = useContext(UserContext); + const [selectedPage, setSelectedPage] = useState(""); const screenSize = { mobile: { xs: "flex", md: "none" }, desktop: { xs: "none", md: "flex" }, }; + const handleSelectedPage = (page: string) => setSelectedPage(page); + return ( @@ -43,7 +46,11 @@ export const NavBar = () => { {/* Display either the ZeSS logo or a sandwich menu */} - + {user && ( { )} @@ -70,7 +79,11 @@ export const NavBar = () => { - + diff --git a/vinvoor/src/navbar/NavBarLogo.tsx b/vinvoor/src/navbar/NavBarLogo.tsx index d2a4990..7b953fe 100644 --- a/vinvoor/src/navbar/NavBarLogo.tsx +++ b/vinvoor/src/navbar/NavBarLogo.tsx @@ -6,6 +6,8 @@ import { ThemeContext } from "../providers/ThemeProvider"; interface NavBarLogoProps { sx?: SxProps; + selectedPage?: string; + handleSelectedPage?: (page: string) => void; } const CLICK_AMOUNT = 10; @@ -14,9 +16,15 @@ const CLICK_TIME_MS = 1000; let pressedAmount = 0; let startTimePress = 0; -export const NavBarLogo: FC = ({ sx }) => { +export const NavBarLogo: FC = ({ + sx, + selectedPage, + handleSelectedPage, +}) => { const { setTheme } = useContext(ThemeContext); const handleClick = () => { + if (handleSelectedPage) handleSelectedPage("home"); + if (pressedAmount < CLICK_AMOUNT) { if (pressedAmount === 0) startTimePress = Date.now(); @@ -40,6 +48,12 @@ export const NavBarLogo: FC = ({ sx }) => { ...sx, textTransform: "none", color: "secondary.contrastText", + borderTop: "2px solid transparent", + borderBottom: "2px solid transparent", + ...(selectedPage === "home" && { + borderBottom: theme => + `2px solid ${theme.palette.secondary.main}`, + }), }} > diff --git a/vinvoor/src/navbar/NavBarPages.tsx b/vinvoor/src/navbar/NavBarPages.tsx index 721c1bf..1d626c1 100644 --- a/vinvoor/src/navbar/NavBarPages.tsx +++ b/vinvoor/src/navbar/NavBarPages.tsx @@ -6,16 +6,31 @@ import { PageIcon } from "./NavBar"; interface NavBarPagesProps { pageIcons: readonly PageIcon[]; sx?: SxProps; + selectedPage: string; + handleSelectedPage: (page: string) => void; } -export const NavBarPages: FC = ({ pageIcons, sx }) => { +export const NavBarPages: FC = ({ + pageIcons, + sx, + selectedPage, + handleSelectedPage, +}) => { return ( {pageIcons.map(({ page, icon }) => (