-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a67dba0
commit c5c5bb0
Showing
8 changed files
with
134 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {useEffect, useState} from "react"; | ||
import {AgentApi, ApiClient} from "./api/src/index.js"; | ||
import {AppBar, Button, IconButton, Toolbar, Typography} from "@mui/material"; | ||
import MenuIcon from "@mui/icons-material/Menu"; | ||
import {Link} from "react-router-dom"; | ||
import ListIcon from "@mui/icons-material/List"; | ||
import LanIcon from "@mui/icons-material/Lan"; | ||
import ShareIcon from "@mui/icons-material/Share"; | ||
|
||
function NavBar() { | ||
const [version, setVersion] = useState(""); | ||
|
||
let api = new AgentApi(new ApiClient(window.location.protocol+'//'+window.location.host)); | ||
|
||
useEffect(() => { | ||
let mounted = true; | ||
api.agentVersion((err, data) => { | ||
if(mounted) { | ||
setVersion(data.v); | ||
} | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<AppBar position={"static"}> | ||
<Toolbar> | ||
<IconButton | ||
size={"large"} | ||
edge={"start"} | ||
color={"inherit"} | ||
aria-label={"menu"} | ||
sx={{mr: 2}} | ||
> | ||
<MenuIcon/> | ||
</IconButton> | ||
<Typography variant={"p"} component={"div"} sx={{flexGrow: 1}}> | ||
zrok Agent { version !== "" ? " | " + version : ""} | ||
</Typography> | ||
<Button color={"inherit"} component={Link} to={"/"}><ListIcon /></Button> | ||
<Button color={"inherit"}><LanIcon /></Button> | ||
<Button color={"inherit"}><ShareIcon /></Button> | ||
</Toolbar> | ||
</AppBar> | ||
) | ||
} | ||
|
||
export default NavBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import NavBar from "./NavBar.jsx"; | ||
|
||
function ShareDetail() { | ||
return ( | ||
<> | ||
<NavBar /> | ||
<h1>Share Detail</h1> | ||
</> | ||
) | ||
} | ||
|
||
export default ShareDetail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App.jsx' | ||
import './index.css' | ||
import './index.css'; | ||
import { StrictMode } from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom"; | ||
import Overview from "./Overview.jsx"; | ||
import ShareDetail from "./ShareDetail.jsx"; | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Overview /> | ||
}, | ||
{ | ||
path: "/share", | ||
element: <ShareDetail /> | ||
} | ||
]); | ||
|
||
createRoot(document.getElementById('root')).render( | ||
<StrictMode> | ||
<App /> | ||
<RouterProvider router={router} /> | ||
</StrictMode>, | ||
) |