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/material": "^6.1.6",
"@tauri-apps/api": "^2.1.0",
"jotai": "^2.10.1",
"next": "^15.0.3",
"react": "^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 { LoadingButton } from "@mui/lab";
export const Layout = () => {
// contexts
@ -22,7 +23,13 @@ export const Layout = () => {
overflow: "auto",
p: 1,
}}
></Box>
>
<Box>
{/* main content goes here buddy */}
<LoadingButton id="asdfbutton">asdf</LoadingButton>
<TextField id="asdf" name="asdf"></TextField>
</Box>
</Box>
</Box>
);
};

View file

@ -1,5 +1,7 @@
import { Box, Stack } from "@mui/material";
import { WindowButtons } from "./WindowButtons";
import { NavigationButtons } from "./NavigationButtons";
import { RouteDisplay } from "./RouteDisplay";
export const HeaderBar = () => {
return (
@ -8,10 +10,6 @@ export const HeaderBar = () => {
data-tauri-drag-region="true"
sx={{
alignItems: "center",
// backdropFilter: "blur(10px)",
// backgroundColor: "rgba(0, 0, 0, 0.5)",
// TODO: remove when done
// borderBottom: "1px solid red",
display: "flex",
flexDirection: "row",
height: "48px",
@ -28,7 +26,19 @@ export const HeaderBar = () => {
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
className="titlebar"
@ -39,6 +49,18 @@ export const HeaderBar = () => {
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
direction="row"
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 { Box, IconButton, Stack, useTheme } from "@mui/material";
import { Box, IconButton, Stack } from "@mui/material";
import { getCurrentWindow } from "@tauri-apps/api/window";
export const WindowButtons = () => {
// contexts
const userTheme = useTheme();
const minimize = () => {
const appWindow = getCurrentWindow();
appWindow.minimize();
@ -30,31 +27,13 @@ export const WindowButtons = () => {
}}
>
<Stack direction="row" spacing={1}>
<IconButton
onClick={minimize}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<IconButton onClick={minimize} size="small">
<Minimize fontSize="inherit" />
</IconButton>
<IconButton
onClick={toggleMaximize}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<IconButton onClick={toggleMaximize} size="small">
<WebAssetOutlined fontSize="inherit" />
</IconButton>
<IconButton
onClick={close}
size="small"
sx={{
backgroundColor: userTheme.palette.grey[800],
}}
>
<IconButton onClick={close} size="small">
<Close fontSize="inherit" />
</IconButton>
</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": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./src/*"]
}
"lib": [
"dom",
"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": ["node_modules"]
}
"exclude": [
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}