diff --git a/src-tauri/run.bat b/src-tauri/run.bat.old similarity index 92% rename from src-tauri/run.bat rename to src-tauri/run.bat.old index c3ea2425d..70ae2a8c8 100644 --- a/src-tauri/run.bat +++ b/src-tauri/run.bat.old @@ -1,5 +1,8 @@ @echo off setlocal enableextensions + +echo "TEST" + cd /d "C:\Program Files (x86)\SlimeVR Server" jre\bin\java.exe -Xmx512M -jar slimevr.jar --no-gui diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index b8f088946..4a452227c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -4,7 +4,7 @@ )] use std::path::PathBuf; -use std::process::Command; +use std::process::{Command}; // the payload type must implement `Serialize` and `Clone`. diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 327388637..9ce4a450c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -53,7 +53,9 @@ "width": 1150, "height": 660, "resizable": true, - "fullscreen": false + "fullscreen": false, + "decorations": false, + "transparent": true } ], "security": { diff --git a/src/App.tsx b/src/App.tsx index 81b949a05..0bd1ef093 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ -import { Navbar } from './components/Navbar'; import { useProvideWebsocketApi, useWebsocketAPI, WebSocketApiContext } from './hooks/websocket-api'; import { BrowserRouter as Router, @@ -6,23 +5,15 @@ import { Route, } from "react-router-dom"; import { Overview } from './components/Overview'; -import { BigButton } from './components/commons/BigButton'; -import { QuickResetIcon, ResetIcon } from './components/commons/icon/ResetIcon'; -import { useReset } from './hooks/reset'; -import { Button } from './components/commons/Button'; -import { useLayout } from './hooks/layout'; import { BodyProportions } from './components/proportions/BodyProportions'; -import { BVHButton } from './components/BVHButton'; import { AppContextProvider } from './components/providers/AppContext'; import { useEffect } from 'react'; -import { DataFeedConfigT, DataFeedMessage, DeviceDataMaskT, ResetType, StartDataFeedT, TrackerDataMaskT } from 'solarxr-protocol'; -import { Settings } from './components/Settings'; - +import { DataFeedConfigT, DataFeedMessage, DeviceDataMaskT, StartDataFeedT, TrackerDataMaskT } from 'solarxr-protocol'; +import { Settings } from './components/settings/Settings'; +import { MainLayoutRoute } from './components/MainLayout'; +import { SettingsLayoutRoute } from './components/settings/SettingsLayout'; function Layout() { - const { layoutHeight, ref } = useLayout(); - const { reset, timer, reseting } = useReset() - const { sendDataFeedPacket } = useWebsocketAPI(); useEffect(() => { @@ -47,36 +38,25 @@ function Layout() { sendDataFeedPacket(DataFeedMessage.StartDataFeed, startDataFeed) }, []) - - return ( <> -
-
-
- - }/> - }/> - }/> - -
-
-
- } onClick={() => reset(ResetType.Quick)} > -
-
- } onClick={() => reset(ResetType.Full)} disabled={reseting}> -
-
- -
-
- -
-
-
-
- + + + + + }/> + + + + }/> + + + + }/> + ) } @@ -88,15 +68,10 @@ function App() { -
+
{!websocketAPI.isConnected &&
Connection lost to server
} - {websocketAPI.isConnected && - <> - - - - } + {websocketAPI.isConnected && }
diff --git a/src/components/MainLayout.tsx b/src/components/MainLayout.tsx new file mode 100644 index 000000000..a4853e3ed --- /dev/null +++ b/src/components/MainLayout.tsx @@ -0,0 +1,52 @@ +import { ReactChild } from "react"; +import { NavLink } from "react-router-dom"; +import { ResetType } from "solarxr-protocol"; +import { useLayout } from "../hooks/layout"; +import { BVHButton } from "./BVHButton"; +import { Button } from "./commons/Button"; +import { CubeIcon } from "./commons/icon/CubeIcon"; +import { GearIcon } from "./commons/icon/GearIcon"; +import { Navbar, NavButton } from "./Navbar"; +import { ResetButton } from "./ResetButton"; + + +export function MainLayoutRoute({ children }: { children: ReactChild }) { + + const { layoutHeight, ref } = useLayout(); + + return ( + <> + + <> + }>Overview + }>Body proportions + + +
+
+
+ {children} +
+
+
+ +
+
+ +
+
+ +
+
+ {/* */} + +
+
Settings
+
+
+
+
+
+ + ) + } \ No newline at end of file diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 491268ac9..89ec89648 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -7,6 +7,11 @@ import { import { CubeIcon } from './commons/icon/CubeIcon'; import { GearIcon } from './commons/icon/GearIcon'; import { SlimeVRIcon } from './commons/icon/SimevrIcon'; +import { appWindow } from '@tauri-apps/api/window' +import { MinimiseIcon } from './commons/icon/MinimiseIcon'; +import { MaximiseIcon } from './commons/icon/MaximiseIcon'; +import { CloseIcon } from './commons/icon/CloseIcon'; +import { useWebsocketAPI } from '../hooks/websocket-api'; export function NavButton({ to, children, match, icon }: { to: string, children: ReactChild, match?: string, icon: ReactChild }) { @@ -16,31 +21,40 @@ export function NavButton({ to, children, match, icon }: { to: string, children: }); return ( - +
{icon}
{children}
-
+
) } -export function Navbar() { +export function Navbar({ children }: { children?: ReactChild }) { return ( -
-
-
-
- +
+
+
+
+
-
SlimeVR
+
SlimeVR
-
- }>Overview - }>Body proportions - }>Settings + {children &&
+ {children} +
} +
+
appWindow.minimize()}> + +
+
appWindow.maximize()}> + +
+
appWindow.close()}> + +
) diff --git a/src/components/Overview.tsx b/src/components/Overview.tsx index 84908ea3d..594894378 100644 --- a/src/components/Overview.tsx +++ b/src/components/Overview.tsx @@ -35,7 +35,7 @@ export function Overview() { return (
- Tracker Overview + Assigned Trackers
{asignedTrackers.map(({ tracker, device }, index) => )} diff --git a/src/hooks/reset.ts b/src/components/ResetButton.tsx similarity index 69% rename from src/hooks/reset.ts rename to src/components/ResetButton.tsx index 14b7e2a27..52ffd794f 100644 --- a/src/hooks/reset.ts +++ b/src/components/ResetButton.tsx @@ -1,16 +1,19 @@ import { useRef, useState } from "react"; import { ResetRequestT, ResetType, RpcMessage } from "solarxr-protocol"; -import { useWebsocketAPI } from "./websocket-api"; +import { useWebsocketAPI } from "../hooks/websocket-api"; +import { BigButton } from "./commons/BigButton"; +import { QuickResetIcon, ResetIcon } from "./commons/icon/ResetIcon"; -export function useReset() { +export function ResetButton({ type }: { type: ResetType }) { + const timerid = useRef(null); const [reseting, setReseting] = useState(false); const [timer, setTimer] = useState(0); const { sendRPCPacket } = useWebsocketAPI(); - const reset = (type: ResetType) => { + const reset = () => { const req = new ResetRequestT(); req.resetType = type; setReseting(true); @@ -35,9 +38,13 @@ export function useReset() { } } - return { - reset, - timer, - reseting - } + return ( + : } + onClick={reset} + disabled={reseting}> + + ) + + } \ No newline at end of file diff --git a/src/components/commons/icon/CloseIcon.tsx b/src/components/commons/icon/CloseIcon.tsx new file mode 100644 index 000000000..b9a64f49c --- /dev/null +++ b/src/components/commons/icon/CloseIcon.tsx @@ -0,0 +1,11 @@ + + + +export function CloseIcon({ className }: { className?: string }) { + return ( + + + + + ) +} \ No newline at end of file diff --git a/src/components/commons/icon/MaximiseIcon.tsx b/src/components/commons/icon/MaximiseIcon.tsx new file mode 100644 index 000000000..886e23a38 --- /dev/null +++ b/src/components/commons/icon/MaximiseIcon.tsx @@ -0,0 +1,10 @@ + + + +export function MaximiseIcon({ className }: { className?: string }) { + return ( + + + + ) +} \ No newline at end of file diff --git a/src/components/commons/icon/MinimiseIcon.tsx b/src/components/commons/icon/MinimiseIcon.tsx new file mode 100644 index 000000000..79c503016 --- /dev/null +++ b/src/components/commons/icon/MinimiseIcon.tsx @@ -0,0 +1,10 @@ + + + +export function MinimiseIcon({ className }: { className?: string }) { + return ( + + + + ) +} \ No newline at end of file diff --git a/src/components/commons/icon/SimevrIcon.tsx b/src/components/commons/icon/SimevrIcon.tsx index 2c1153489..76957a211 100644 --- a/src/components/commons/icon/SimevrIcon.tsx +++ b/src/components/commons/icon/SimevrIcon.tsx @@ -1,9 +1,9 @@ -export function SlimeVRIcon() { +export function SlimeVRIcon({ drag }: { drag: boolean }) { return ( - + diff --git a/src/components/proportions/BodyProportions.tsx b/src/components/proportions/BodyProportions.tsx index b72b860a4..9b6128f6d 100644 --- a/src/components/proportions/BodyProportions.tsx +++ b/src/components/proportions/BodyProportions.tsx @@ -25,8 +25,11 @@ const bodyPartLabels = { [SkeletonBone.SKELETON_OFFSET]: "Skeleton offset", [SkeletonBone.CONTROLLER_DISTANCE_Z]: "Controller distance z", [SkeletonBone.CONTROLLER_DISTANCE_Y]: "Controller distance y", - [SkeletonBone.ELBOW_DISTANCE]: "Elbow distance", - [SkeletonBone.UPPER_ARM_DISTANCE]: "Upper arm distance" + [SkeletonBone.FOREARM_LENGTH]: "Forearm distance", + [SkeletonBone.SHOULDERS_DISTANCE]: "Shoulders distance", + [SkeletonBone.SHOULDERS_WIDTH]: "Shoulders width", + [SkeletonBone.UPPER_ARM_LENGTH]: "Upper arm length", + [SkeletonBone.ELBOW_OFFSET]: "Elbow offset" } type BodyProportionsForm = ({ [key: string]: number }); @@ -102,8 +105,8 @@ export function BodyProportions() {
Body Proportions
-
-
+
+
diff --git a/src/components/proportions/BodyView.tsx b/src/components/proportions/BodyView.tsx index ca568d4d8..38d490f89 100644 --- a/src/components/proportions/BodyView.tsx +++ b/src/components/proportions/BodyView.tsx @@ -24,7 +24,7 @@ export function BodyView({ selectedBodyPart }: { selectedBodyPart: number }) { } {selectedBodyPart === SkeletonBone.KNEE_HEIGHT && <> - + diff --git a/src/components/Settings.tsx b/src/components/settings/Settings.tsx similarity index 94% rename from src/components/Settings.tsx rename to src/components/settings/Settings.tsx index b94cdd60f..cb25811ae 100644 --- a/src/components/Settings.tsx +++ b/src/components/settings/Settings.tsx @@ -1,10 +1,10 @@ -import { useWebsocketAPI } from "../hooks/websocket-api"; -import { CheckBox } from "./commons/Checkbox"; +import { useWebsocketAPI } from "../../hooks/websocket-api"; +import { CheckBox } from "../commons/Checkbox"; import { useForm } from "react-hook-form"; import { useEffect } from "react"; -import { Select } from "./commons/Select"; -import { NumberSelector } from "./commons/NumberSelector"; -import { WIFIButton } from "./WifiButton"; +import { Select } from "../commons/Select"; +import { NumberSelector } from "../commons/NumberSelector"; +import { WIFIButton } from "../WifiButton"; import { ChangeSettingsRequestT, FilteringSettingsT, RpcMessage, SettingsRequestT, SettingsResponseT, SteamVRTrackersSettingT } from "solarxr-protocol"; interface SettingsForm { @@ -37,7 +37,6 @@ export function Settings() { trackers.legs = values.trackers.legs; trackers.knees = values.trackers.knees; trackers.elbows = values.trackers.elbows; - settings.steamVrTrackers = trackers; } diff --git a/src/components/settings/SettingsLayout.tsx b/src/components/settings/SettingsLayout.tsx new file mode 100644 index 000000000..9cdc6aae3 --- /dev/null +++ b/src/components/settings/SettingsLayout.tsx @@ -0,0 +1,33 @@ +import { ReactChild } from "react"; +import { NavLink } from "react-router-dom"; +import { useLayout } from "../../hooks/layout"; +import { IconButton } from "../commons/ButtonIcon"; +import { CloseIcon } from "../commons/icon/CloseIcon"; +import { Navbar } from "../Navbar"; +import { SettingsSidebar } from "./SettingsSidebar"; + +export function SettingsLayoutRoute({ children }: { children: ReactChild }) { + + const { layoutHeight, ref } = useLayout(); + + return ( + <> + +
+
+ +
+
+ {children} +
+ +
+
+
+
+
+
+
+ + ) + } \ No newline at end of file diff --git a/src/components/settings/SettingsSidebar.tsx b/src/components/settings/SettingsSidebar.tsx new file mode 100644 index 000000000..ff4a01e44 --- /dev/null +++ b/src/components/settings/SettingsSidebar.tsx @@ -0,0 +1,24 @@ +import { NavLink } from "react-router-dom" + + + +export function SettingsSidebar() { + return ( +
+
+
TRACKER SETTINGS
+
+ SteamVR + Filtering +
+
+
+
USER INTERFACE
+
+ Widgets +
+
+
+ ) + +} \ No newline at end of file diff --git a/src/index.css b/src/index.css index 0e46976f8..bb270a7aa 100644 --- a/src/index.css +++ b/src/index.css @@ -3,13 +3,21 @@ @tailwind utilities; body { - background-color: theme('colors.primary.1'); font-variant-numeric: tabular-nums; height: 100vh; width: 100vw; user-select: none; + overflow: hidden; + border-radius: 15px; +} + +html { + overflow: hidden; + border-radius: 15px; } #root { height: 100%; -} \ No newline at end of file +} + +