diff --git a/src/components/FooterBar.tsx b/src/components/FooterBar.tsx index e69de29..ec4951f 100644 --- a/src/components/FooterBar.tsx +++ b/src/components/FooterBar.tsx @@ -0,0 +1,59 @@ +import { Settings } from "@mui/icons-material"; +import { Box, Stack } from "@mui/material"; +import { useRouter } from "next/router"; +import { WindowButtons } from "./HeaderBar/WindowButtons"; + +export const FooterBar = () => { + const router = useRouter(); + + return ( + + + hello this is the left side + + + + + + + + + ); +}; diff --git a/src/components/Generic/FloatingDialog.tsx b/src/components/Generic/FloatingDialog.tsx index 95c8ad0..97ded8b 100644 --- a/src/components/Generic/FloatingDialog.tsx +++ b/src/components/Generic/FloatingDialog.tsx @@ -41,10 +41,10 @@ export const FloatingDialog: FC = ({ = ({ top: "50%", transform: "translate(-50%, -50%)", transition: "all ease-in-out", - transitionDuration: settings.display.transition_duration + "ms", - width: maximisedState ? "100vw" : settings.display.window_width + "px", + transitionDuration: settings.style.transition_duration + "ms", + width: maximisedState ? "100vw" : settings.style.window_width + "px", }} > { return ( - + + + kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+ kdfjdlfjdkfjdlfldkfj
+
+
); }; diff --git a/src/components/HeaderBar/HeaderBar.tsx b/src/components/HeaderBar/HeaderBar.tsx index 1a37de1..31c4591 100644 --- a/src/components/HeaderBar/HeaderBar.tsx +++ b/src/components/HeaderBar/HeaderBar.tsx @@ -1,12 +1,8 @@ -import { BugReportOutlined } from "@mui/icons-material"; -import { Box, IconButton, Stack } from "@mui/material"; -import { useRouter } from "next/router"; +import { Box, Stack } from "@mui/material"; import { Settings } from "./Settings/Settings"; import { WindowButtons } from "./WindowButtons"; export const HeaderBar = () => { - const router = useRouter(); - return ( { + return ( + + ); +}; diff --git a/src/components/HeaderBar/Settings/SettingsCategoryTitle.tsx b/src/components/HeaderBar/Settings/CategoryTitle.tsx similarity index 69% rename from src/components/HeaderBar/Settings/SettingsCategoryTitle.tsx rename to src/components/HeaderBar/Settings/CategoryTitle.tsx index eecec4e..0f8dda5 100644 --- a/src/components/HeaderBar/Settings/SettingsCategoryTitle.tsx +++ b/src/components/HeaderBar/Settings/CategoryTitle.tsx @@ -1,11 +1,11 @@ import { Box, Typography } from "@mui/material"; import { FC } from "react"; -interface SettingsCategoryTitleProps { +interface CategoryTitleProps { title: string; } -export const SettingsCategoryTitle: FC = ({ title }) => { +export const CategoryTitle: FC = ({ title }) => { return ( { @@ -82,7 +82,7 @@ export const Settings = () => { { variant="scrollable" > { > - + = ({ sx }) => { + // atoms + const [stagedSettings, setStagedSettings] = useAtom(stagedSettingsAtom); + + const handleSettingsBackgroundValueChange = ( + settingKey: string, + settingValue: boolean | number | string | number[], + ) => { + const newSettings = { + ...stagedSettings, + background: { + ...stagedSettings.background, + [settingKey]: settingValue, + }, + }; + setStagedSettings(newSettings); + }; + + return ( + + + + + Dark mode + + } + settingsInput={ + { + handleSettingsBackgroundValueChange(e.target.name, e.target.checked); + }} + /> + } + /> + + Accent color + + Default: #8ab4f8 + + + } + settingsInput={ + { + handleSettingsBackgroundValueChange(e.target.name, e.target.value); + }} + sx={{ + width: "100%", + }} + size="small" + type="color" + value={stagedSettings.style.accent_color} + variant="standard" + /> + } + /> + + Font family + + Default: Monospace + + + } + settingsInputLong={ + { + handleSettingsBackgroundValueChange(e.target.name, e.target.value); + }} + select + size="small" + sx={{ + maxWidth: "100%", + }} + value={stagedSettings.style.font_family || "monospace"} + variant="outlined" + > + Monospace + Sans Serif + Comic Sans + System font + + } + /> + + Font scaling + + Default: 100% + + + } + settingsInputBottom={ + { + handleSettingsBackgroundValueChange("font_scaling", value); + }} + step={10} + value={stagedSettings.style.font_scaling} + valueLabelDisplay="auto" + /> + } + /> + + + + + Transition duration + + + Default: 200ms + + + } + settingsInput={ + ms, + inputProps: { min: 0, max: 100, step: 1 }, + }} + name="transition_duration" + onChange={(e) => { + handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); + }} + sx={{ + width: "100%", + }} + size="small" + type="number" + value={stagedSettings.style.transition_duration} + variant="standard" + /> + } + /> + + + + Radius + + + Default: 8px + + + } + settingsInput={ + px, + inputProps: { min: 0, max: 100, step: 1 }, + }} + name="radius" + onChange={(e) => { + handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); + }} + sx={{ + width: "100%", + }} + size="small" + type="number" + value={stagedSettings.style.radius} + variant="standard" + /> + } + /> + + + + Window height + + + Default: 60% + + + } + settingsInput={ + %, + inputProps: { min: 0, max: 100, step: 1 }, + }} + name="window_height" + onChange={(e) => { + handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); + }} + sx={{ + width: "100%", + }} + size="small" + type="number" + value={stagedSettings.style.window_height} + variant="standard" + /> + } + /> + + + + Window width + + + Default: 400px + + + } + settingsInput={ + px, + inputProps: { min: 0, max: 10000, step: 1 }, + }} + name="window_width" + onChange={(e) => { + handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); + }} + sx={{ + width: "100%", + }} + size="small" + type="number" + value={stagedSettings.style.window_width} + variant="standard" + /> + } + /> + + ); +}; diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabDisplay.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx similarity index 90% rename from src/components/HeaderBar/Settings/SettingsTabs/SettingsTabDisplay.tsx rename to src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx index 52b9a2c..f50ed36 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabDisplay.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx @@ -2,14 +2,15 @@ import { Box, Chip, InputAdornment, MenuItem, Slider, Switch, TextField, Typogra import { useAtom } from "jotai"; import { FC } from "react"; import { stagedSettingsAtom } from "../../../../lib/store/jotai/settings"; -import { SettingsCategoryTitle } from "../SettingsCategoryTitle"; +import { BetaChip } from "../BetaChip"; +import { CategoryTitle } from "../CategoryTitle"; import { SettingsItem } from "../SettingsItem"; -interface SettingsTabDisplayProps { +interface SettingsTabStyleProps { sx?: any; } -export const SettingsTabDisplay: FC = ({ sx }) => { +export const SettingsTabStyle: FC = ({ sx }) => { // atoms const [stagedSettings, setStagedSettings] = useAtom(stagedSettingsAtom); @@ -17,7 +18,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { const newSettings = { ...stagedSettings, display: { - ...stagedSettings.display, + ...stagedSettings.style, [settingKey]: settingValue, }, }; @@ -26,16 +27,21 @@ export const SettingsTabDisplay: FC = ({ sx }) => { return ( - + + + Dark mode - + } settingsInput={ { handleSettingsDisplayValueChange(e.target.name, e.target.checked); @@ -66,7 +72,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { }} size="small" type="color" - value={stagedSettings.display.accent_color} + value={stagedSettings.style.accent_color} variant="standard" /> } @@ -95,7 +101,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { sx={{ maxWidth: "100%", }} - value={stagedSettings.display.font_family || "monospace"} + value={stagedSettings.style.font_family || "monospace"} variant="outlined" > Monospace @@ -148,12 +154,12 @@ export const SettingsTabDisplay: FC = ({ sx }) => { handleSettingsDisplayValueChange("font_scaling", value); }} step={10} - value={stagedSettings.display.font_scaling} + value={stagedSettings.style.font_scaling} valueLabelDisplay="auto" /> } /> - + @@ -192,7 +198,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { }} size="small" type="number" - value={stagedSettings.display.transition_duration} + value={stagedSettings.style.transition_duration} variant="standard" /> } @@ -235,7 +241,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { }} size="small" type="number" - value={stagedSettings.display.radius} + value={stagedSettings.style.radius} variant="standard" /> } @@ -278,7 +284,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { }} size="small" type="number" - value={stagedSettings.display.window_height} + value={stagedSettings.style.window_height} variant="standard" /> } @@ -321,7 +327,7 @@ export const SettingsTabDisplay: FC = ({ sx }) => { }} size="small" type="number" - value={stagedSettings.display.window_width} + value={stagedSettings.style.window_width} variant="standard" /> } diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx index e136272..a68e0c7 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx @@ -2,7 +2,7 @@ import { Box, Chip, InputAdornment, MenuItem, Slider, Switch, TextField, Typogra import { useAtom } from "jotai"; import { FC } from "react"; import { stagedSettingsAtom } from "../../../../lib/store/jotai/settings"; -import { SettingsCategoryTitle } from "../SettingsCategoryTitle"; +import { CategoryTitle } from "../CategoryTitle"; import { SettingsItem } from "../SettingsItem"; interface SettingsTabWindowProps { @@ -26,7 +26,7 @@ export const SettingsTabWindow: FC = ({ sx }) => { return ( - + @@ -43,7 +43,7 @@ export const SettingsTabWindow: FC = ({ sx }) => { /> } /> - + diff --git a/src/contexts/ThemeContext.tsx b/src/contexts/ThemeContext.tsx index a08d906..2b9f792 100644 --- a/src/contexts/ThemeContext.tsx +++ b/src/contexts/ThemeContext.tsx @@ -8,67 +8,67 @@ interface UserThemeProviderProps { children: ReactNode; } -// palette and accent settings -export const userPalette = { - primary: { - // light: '#a1c3f9', - main: "#8ab4f8", - // dark: '#4285f4', - }, - secondary: { - // light: '#a1c3f9', - main: "#8ab4f8", - // dark: '#4285f4', - }, - error: { - light: "#e57373", - main: "#f44336", - dark: "#d32f2f", - }, - warning: { - light: "#ffb74d", - main: "#ffa726", - dark: "#f57c00", - }, - info: { - light: "#a1c3f9", - main: "#8ab4f8", - dark: "#4285f4", - }, - success: { - light: "#81c784", - main: "#66bb6a", - dark: "#388e3c", - }, - grey: { - 50: "#fafafa", - 100: "#f5f5f5", - 200: "#eeeeee", - 300: "#e0e0e0", - 400: "#bdbdbd", - 500: "#9e9e9e", - 600: "#757575", - 700: "#616161", - 800: "#424242", - 900: "#212121", - A100: "#f5f5f5", - A200: "#eeeeee", - A400: "#bdbdbd", - A700: "#616161", - }, - background: { - paper: "#303134", - default: "#202124", - }, -}; - export const UserThemeProvider: FC = ({ children }) => { const { settings } = useSettings(); + // palette and accent settings + const userPalette = { + primary: { + // light: '#a1c3f9', + main: settings.style.accent_color || "#8ab4f8", + // dark: '#4285f4', + }, + secondary: { + // light: '#a1c3f9', + main: settings.style.accent_color || "#8ab4f8", + // dark: '#4285f4', + }, + error: { + light: "#e57373", + main: "#f44336", + dark: "#d32f2f", + }, + warning: { + light: "#ffb74d", + main: "#ffa726", + dark: "#f57c00", + }, + info: { + light: "#a1c3f9", + main: "#8ab4f8", + dark: "#4285f4", + }, + success: { + light: "#81c784", + main: "#66bb6a", + dark: "#388e3c", + }, + grey: { + 50: "#fafafa", + 100: "#f5f5f5", + 200: "#eeeeee", + 300: "#e0e0e0", + 400: "#bdbdbd", + 500: "#9e9e9e", + 600: "#757575", + 700: "#616161", + 800: "#424242", + 900: "#212121", + A100: "#f5f5f5", + A200: "#eeeeee", + A400: "#bdbdbd", + A700: "#616161", + }, + background: { + paper: settings.style.dark_mode ? "#303134" : "#fff", + default: settings.style.dark_mode ? "#202124" : "#fff", + }, + }; + // font family settings // TODO: figure out how to bundle fonts in tauri let fontFamily = "GoogleSans"; - switch (settings.display.font_family) { + switch (settings.style.font_family) { case "sans_serif": fontFamily = "GoogleSans, sans-serif"; break; @@ -84,7 +84,7 @@ export const UserThemeProvider: FC = ({ children }) => { } // font scaling settings - const fontSize = (settings.display.font_scaling / 100) * 14; + const fontSize = (settings.style.font_scaling / 100) * 14; const userTheme = createTheme({ typography: { @@ -92,22 +92,22 @@ export const UserThemeProvider: FC = ({ children }) => { fontSize: fontSize, }, palette: { - mode: "dark", + mode: settings.style.dark_mode ? "dark" : "light", ...userPalette, }, transitions: { duration: { - shortest: settings.display.transition_duration, - shorter: settings.display.transition_duration, - short: settings.display.transition_duration, + shortest: settings.style.transition_duration, + shorter: settings.style.transition_duration, + short: settings.style.transition_duration, // most basic recommended timing - standard: settings.display.transition_duration, + standard: settings.style.transition_duration, // this is to be used in complex animations - complex: settings.display.transition_duration, + complex: settings.style.transition_duration, // recommended when something is entering screen - enteringScreen: settings.display.transition_duration, + enteringScreen: settings.style.transition_duration, // recommended when something is leaving screen - leavingScreen: settings.display.transition_duration, + leavingScreen: settings.style.transition_duration, }, }, components: { diff --git a/src/lib/settings.ts b/src/lib/settings.ts index cec6f39..7e1cbac 100644 --- a/src/lib/settings.ts +++ b/src/lib/settings.ts @@ -3,7 +3,14 @@ import Paths from "./path"; import { readTomlFile, writeTomlFile } from "./utils/toml"; export const defaultSettings = { - display: { + background: { + background_color: "#8ab4f8" as string, + background_image: "" as string, + background_image_size: "cover" as string, + background_image_position: "center" as string, + background_image_repeat: "no-repeat" as string, + }, + style: { accent_color: "#8ab4f8" as string, dark_mode: true as boolean, font_family: "monospace" as string, diff --git a/src/pages/testing.tsx b/src/pages/testing.tsx index 506d982..da4989f 100644 --- a/src/pages/testing.tsx +++ b/src/pages/testing.tsx @@ -32,7 +32,7 @@ export default function Testing() {