header bar

This commit is contained in:
Vomitblood 2024-11-10 22:32:30 +08:00
parent e92ff39658
commit 1939e9f78e
12 changed files with 120 additions and 5779 deletions

View file

@ -1,3 +1,5 @@
{ {
"extends": ["next/core-web-vitals", "next/typescript"] "extends": [
"next/core-web-vitals"
]
} }

Binary file not shown.

5725
client/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@
"@mui/lab": "^6.0.0-beta.14", "@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.1.6", "@mui/material": "^6.1.6",
"@tauri-apps/api": "^2.1.0", "@tauri-apps/api": "^2.1.0",
"jotai": "^2.10.1",
"next": "^15.0.3", "next": "^15.0.3",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1" "react-dom": "^18.3.1"

View file

@ -1,5 +1,6 @@
import { Box, useTheme } from "@mui/material"; import { Box, TextField, useTheme } from "@mui/material";
import { HeaderBar } from "../HeaderBar/HeaderBar"; import { HeaderBar } from "../HeaderBar/HeaderBar";
import { LoadingButton } from "@mui/lab";
export const Layout = () => { export const Layout = () => {
// contexts // contexts
@ -22,7 +23,13 @@ export const Layout = () => {
overflow: "auto", overflow: "auto",
p: 1, p: 1,
}} }}
></Box> >
<Box>
{/* main content goes here buddy */}
<LoadingButton id="asdfbutton">asdf</LoadingButton>
<TextField id="asdf" name="asdf"></TextField>
</Box>
</Box>
</Box> </Box>
); );
}; };

View file

@ -1,5 +1,7 @@
import { Box, Stack } from "@mui/material"; import { Box, Stack } from "@mui/material";
import { WindowButtons } from "./WindowButtons"; import { WindowButtons } from "./WindowButtons";
import { NavigationButtons } from "./NavigationButtons";
import { RouteDisplay } from "./RouteDisplay";
export const HeaderBar = () => { export const HeaderBar = () => {
return ( return (
@ -8,10 +10,6 @@ export const HeaderBar = () => {
data-tauri-drag-region="true" data-tauri-drag-region="true"
sx={{ sx={{
alignItems: "center", alignItems: "center",
// backdropFilter: "blur(10px)",
// backgroundColor: "rgba(0, 0, 0, 0.5)",
// TODO: remove when done
// borderBottom: "1px solid red",
display: "flex", display: "flex",
flexDirection: "row", flexDirection: "row",
height: "48px", height: "48px",
@ -28,7 +26,19 @@ export const HeaderBar = () => {
flexDirection: "row", flexDirection: "row",
}} }}
> >
hello this is the left side {/* this is the left side */}
<Stack
direction="row"
spacing={2}
sx={{
alignItems: "center",
display: "flex",
flexDirection: "row",
}}
>
<NavigationButtons />
<RouteDisplay />
</Stack>
</Box> </Box>
<Box <Box
className="titlebar" className="titlebar"
@ -39,6 +49,18 @@ export const HeaderBar = () => {
flexDirection: "row", flexDirection: "row",
}} }}
> >
{/* this is the middle, probably not gonna be used */}
</Box>
<Box
className="titlebar"
data-tauri-drag-region="true"
sx={{
alignItems: "center",
display: "flex",
flexDirection: "row",
}}
>
{/* this is the right side */}
<Stack <Stack
direction="row" direction="row"
spacing={2} spacing={2}

View file

@ -0,0 +1,45 @@
// TODO: implement navigation buffer after implementing internal routing
import { ArrowBack, ArrowForward, HomeOutlined } from "@mui/icons-material";
import { Box, IconButton, Stack } from "@mui/material";
import { useAtom } from "jotai";
import { routeAtom } from "../../lib/jotai";
export const NavigationButtons = () => {
// atoms
const [route, setRoute] = useAtom(routeAtom);
const goBack = () => {
// TODO
};
const goForward = () => {
// TODO
};
const goHome = () => {
setRoute("index");
};
return (
<Box
sx={{
alignItems: "center",
display: "flex",
flexDirection: "row",
}}
>
<Stack direction="row" spacing={1}>
<IconButton onClick={goBack} size="small">
<ArrowBack fontSize="inherit" />
</IconButton>
<IconButton onClick={goForward} size="small">
<ArrowForward fontSize="inherit" />
</IconButton>
<IconButton onClick={goHome} size="small">
<HomeOutlined fontSize="inherit" />
</IconButton>
</Stack>
</Box>
);
};

View file

@ -0,0 +1,5 @@
import { Box } from "@mui/material";
export const RouteDisplay = () => {
return <Box>Home</Box>;
};

View file

@ -1,11 +1,8 @@
import { Close, Minimize, WebAssetOutlined } from "@mui/icons-material"; import { Close, Minimize, WebAssetOutlined } from "@mui/icons-material";
import { Box, IconButton, Stack, useTheme } from "@mui/material"; import { Box, IconButton, Stack } from "@mui/material";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
export const WindowButtons = () => { export const WindowButtons = () => {
// contexts
const userTheme = useTheme();
const minimize = () => { const minimize = () => {
const appWindow = getCurrentWindow(); const appWindow = getCurrentWindow();
appWindow.minimize(); appWindow.minimize();
@ -30,31 +27,13 @@ export const WindowButtons = () => {
}} }}
> >
<Stack direction="row" spacing={1}> <Stack direction="row" spacing={1}>
<IconButton <IconButton onClick={minimize} size="small">
onClick={minimize}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<Minimize fontSize="inherit" /> <Minimize fontSize="inherit" />
</IconButton> </IconButton>
<IconButton <IconButton onClick={toggleMaximize} size="small">
onClick={toggleMaximize}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<WebAssetOutlined fontSize="inherit" /> <WebAssetOutlined fontSize="inherit" />
</IconButton> </IconButton>
<IconButton <IconButton onClick={close} size="small">
onClick={close}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<Close fontSize="inherit" /> <Close fontSize="inherit" />
</IconButton> </IconButton>
</Stack> </Stack>

3
client/src/lib/jotai.ts Normal file
View file

@ -0,0 +1,3 @@
import { atom } from "jotai";
export const routeAtom = atom("index");

View file

@ -1,5 +0,0 @@
import { Box } from "@mui/material";
export default function Testing() {
return <Box>asdf</Box>;
}

View file

@ -1,22 +1,29 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true, "allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true, "esModuleInterop": true,
"module": "esnext", "incremental": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"incremental": true, "lib": [
"paths": { "dom",
"@/*": ["./src/*"] "dom.iterable",
} "esnext"
],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2017"
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": [
"exclude": ["node_modules"] "node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
} }