Skip to content

Commit 722688e

Browse files
committed
working OBS scene controller, small frontend changes
1 parent 59ff843 commit 722688e

24 files changed

Lines changed: 425 additions & 54 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ctrlc = "3.1.9"
3939
argon2 = "0.4.1"
4040
rand_core = { version = "0.6", features = ["std"] }
4141
anyhow = "1.0.68"
42-
serde = { version = "1.0.150", features = ["derive"] }
42+
serde = { version = "1.0.150", features = ["derive", "rc"] }
4343
serde_json = "1.0.91"
4444
biscuit-auth = "2.2.0"
4545
ed25519-dalek = "1.0.1"

frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"dependencies": {
1313
"axios": "^1.2.2",
14+
"postcss-nesting": "^11.0.0",
1415
"react": "^18.2.0",
1516
"react-dom": "^18.2.0",
1617
"react-router-dom": "^6.6.2",
@@ -33,6 +34,7 @@
3334
"prettier": "^2.8.2",
3435
"tailwindcss": "^3.2.4",
3536
"typescript": "^4.9.4",
36-
"vite": "^4.0.4"
37+
"vite": "^4.0.4",
38+
"less": "^4.1.3"
3739
}
3840
}

frontend/src/main.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,28 @@ import { createBrowserRouter, RouterProvider } from "react-router-dom";
22
import React from "react";
33
import { createRoot } from "react-dom/client";
44

5-
import "./styles.css";
6-
import "rsuite/dist/rsuite.min.css";
7-
import Dashboard from "./pages/Dashboard";
8-
import Login from "./pages/Login";
5+
import "./styles.less";
6+
import "rsuite/styles/index.less";
7+
import Dashboard from "~/pages/Dashboard";
8+
import Login from "~/pages/Login";
99
import { CustomProvider } from "rsuite";
10+
import Home from "~/pages/Home";
11+
import Status from "~/pages/Status";
1012

1113
const router = createBrowserRouter([
1214
{
1315
path: "/",
1416
element: <Dashboard />,
17+
children: [
18+
{
19+
index: true,
20+
element: <Home />,
21+
},
22+
{
23+
path: "status",
24+
element: <Status />,
25+
},
26+
],
1527
},
1628
{
1729
path: "/login",

frontend/src/pages/Dashboard.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
} from "rsuite";
1010
import ArrowLeftLineIcon from "@rsuite/icons/ArrowLeftLine";
1111
import ArrowRightLineIcon from "@rsuite/icons/ArrowRightLine";
12-
import { useEffect, useState } from "react";
12+
import React, { useEffect, useState } from "react";
1313
import { Outlet, useNavigate } from "react-router";
14-
import { Link } from "react-router-dom";
14+
import { Link, NavLinkProps, NavLink } from "react-router-dom";
1515
import { useAuthStore } from "../stores/auth";
1616

1717
export default function Dashboard() {
@@ -46,7 +46,12 @@ export default function Dashboard() {
4646
>
4747
<Sidenav.Body>
4848
<Nav>
49-
<Nav.Item>Home</Nav.Item>
49+
<Nav.Item to="/" as={NavLink}>
50+
Home
51+
</Nav.Item>
52+
<Nav.Item to="/status" as={NavLink}>
53+
Status
54+
</Nav.Item>
5055
<Nav.Item
5156
onClick={() => {
5257
auth.logout();
@@ -71,8 +76,7 @@ export default function Dashboard() {
7176
</Sidebar>
7277

7378
<Container>
74-
{/*<Header />*/}
75-
<Content>
79+
<Content style={{ backgroundColor: "#f5f8fa" }}>
7680
<Outlet />
7781
</Content>
7882
</Container>

frontend/src/pages/Home.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Home() {
2+
return <></>;
3+
}

frontend/src/pages/Login.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ export default function Login() {
3737
<Form.Control name="username" />
3838
</Form.Group>
3939
<Form.Group controlId="password">
40-
<Form.ControlLabel>
41-
<span>Password</span>
42-
</Form.ControlLabel>
40+
<Form.ControlLabel>Password</Form.ControlLabel>
4341
<Form.Control name="password" type="password" />
4442
</Form.Group>
4543
<Form.Group>
@@ -53,7 +51,7 @@ export default function Login() {
5351
password: form.password,
5452
})
5553
.then((response) => {
56-
auth.login(response.token);
54+
auth.login(response.data.token);
5755
navigate("/");
5856
});
5957
}}

frontend/src/pages/Status.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Status() {
2+
return <></>;
3+
}

frontend/src/stores/auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export const useAuthStore = create<AuthState>()(
1616
logout: () => set((state) => ({ sessionKey: null })),
1717
login: (key: string) => set(() => ({ sessionKey: key })),
1818
}),
19-
{ name: "sc-auth-storage" }
19+
{
20+
name: "sc-auth-storage",
21+
storage: createJSONStorage(() => sessionStorage),
22+
}
2023
)
2124
)
2225
);

frontend/src/styles.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

frontend/src/styles.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
.rs-sidenav-item,
6+
.rs-dropdown-item {
7+
&.active {
8+
color: #3498ff !important;
9+
}
10+
}

0 commit comments

Comments
 (0)