From cccf57d37abf3ca341dcf0bda45373f4e3cb668f Mon Sep 17 00:00:00 2001 From: lucas lelievre Date: Fri, 29 Apr 2022 00:56:01 +0200 Subject: [PATCH] new palette --- package-lock.json | 80 +++++++++++++++++++ package.json | 1 + src/App.tsx | 25 +++++- src/components/BVHButton.tsx | 3 +- src/components/MainLayout.tsx | 8 +- src/components/Modal.tsx | 8 +- src/components/Navbar.tsx | 26 +++--- src/components/Overview.tsx | 4 +- src/components/commons/BigButton.tsx | 4 +- src/components/commons/Button.tsx | 13 +-- src/components/commons/ButtonIcon.tsx | 2 +- src/components/commons/Checkbox.tsx | 9 ++- src/components/commons/Input.tsx | 2 +- src/components/commons/NumberSelector.tsx | 10 +-- src/components/commons/Select.tsx | 6 +- src/components/commons/icon/BatteryIcon.tsx | 8 +- src/components/commons/icon/CloseIcon.tsx | 4 +- src/components/commons/icon/CrossIcon.tsx | 2 +- src/components/commons/icon/RecordIcon.tsx | 2 +- src/components/commons/icon/WifiIcon.tsx | 8 +- .../proportions/AutomaticCalibration.tsx | 4 +- .../proportions/BodyProportions.tsx | 20 ++--- src/components/settings/SettingsLayout.tsx | 6 +- src/components/settings/SettingsSidebar.tsx | 14 ++-- src/components/settings/pages/Serial.tsx | 6 +- .../settings/pages/TrackersSettings.tsx | 22 ++--- src/components/tracker/TrackerCard.tsx | 31 ++++--- src/hooks/app.ts | 1 - src/index.css | 27 +++++++ src/index.tsx | 2 +- tailwind.config.js | 59 +++++++++++--- 31 files changed, 282 insertions(+), 135 deletions(-) diff --git a/package-lock.json b/package-lock.json index d02389316..15b0136a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.1.0", "dependencies": { "@babel/core": "^7.16.0", + "@fontsource/work-sans": "^4.5.7", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@svgr/webpack": "^5.5.0", "@tauri-apps/api": "^1.0.0-rc.3", @@ -79,6 +80,7 @@ }, "devDependencies": { "@tailwindcss/forms": "^0.5.0", + "@tailwindcss/typography": "^0.5.2", "@tauri-apps/cli": "^1.0.0-rc.8", "@types/math3d": "^0.2.3", "@types/react-modal": "^3.13.1", @@ -86,6 +88,7 @@ "cross-env": "^7.0.3", "node-polyfill-webpack-plugin": "^1.1.4", "postcss": "^8.4.12", + "tailwind-scrollbar": "^1.3.1", "tailwindcss": "^3.0.23" } }, @@ -1985,6 +1988,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@fontsource/work-sans": { + "version": "4.5.7", + "resolved": "https://registry.npmjs.org/@fontsource/work-sans/-/work-sans-4.5.7.tgz", + "integrity": "sha512-DlVEYsShbL0ZUV96yPhie6rJN3eeCta4iI6UbLdbLptlLnkoryfbMIqeQLe+o7OsIoMNWqHTunKMW0x1BmUNpw==" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.5", "license": "Apache-2.0", @@ -3006,6 +3014,20 @@ "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1" } }, + "node_modules/@tailwindcss/typography": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.2.tgz", + "integrity": "sha512-coq8DBABRPFcVhVIk6IbKyyHUt7YTEC/C992tatFB+yEx5WGBQrCgsSFjxHUr8AWXphWckadVJbominEduYBqw==", + "dev": true, + "dependencies": { + "lodash.castarray": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || insiders" + } + }, "node_modules/@tauri-apps/api": { "version": "1.0.0-rc.3", "license": "Apache-2.0 OR MIT", @@ -10567,10 +10589,22 @@ "version": "4.17.21", "license": "MIT" }, + "node_modules/lodash.castarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", + "integrity": "sha1-wCUTUV4wna3dTCTGDP3c9ZdtkRU=", + "dev": true + }, "node_modules/lodash.debounce": { "version": "4.0.8", "license": "MIT" }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, "node_modules/lodash.memoize": { "version": "4.1.2", "license": "MIT" @@ -14303,6 +14337,15 @@ "version": "3.2.4", "license": "MIT" }, + "node_modules/tailwind-scrollbar": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-1.3.1.tgz", + "integrity": "sha512-FeYuLxLtCRMO4PmjPJCzm5wQouFro2BInZXKPxqg54DR/55NAHoS8uNYWMiRG5l6qsLkWBfVEM34gq2XAQUwVg==", + "dev": true, + "dependencies": { + "tailwindcss": ">1.9.6" + } + }, "node_modules/tailwindcss": { "version": "3.0.23", "dev": true, @@ -16879,6 +16922,11 @@ } } }, + "@fontsource/work-sans": { + "version": "4.5.7", + "resolved": "https://registry.npmjs.org/@fontsource/work-sans/-/work-sans-4.5.7.tgz", + "integrity": "sha512-DlVEYsShbL0ZUV96yPhie6rJN3eeCta4iI6UbLdbLptlLnkoryfbMIqeQLe+o7OsIoMNWqHTunKMW0x1BmUNpw==" + }, "@humanwhocodes/config-array": { "version": "0.9.5", "requires": { @@ -17466,6 +17514,17 @@ "mini-svg-data-uri": "^1.2.3" } }, + "@tailwindcss/typography": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.2.tgz", + "integrity": "sha512-coq8DBABRPFcVhVIk6IbKyyHUt7YTEC/C992tatFB+yEx5WGBQrCgsSFjxHUr8AWXphWckadVJbominEduYBqw==", + "dev": true, + "requires": { + "lodash.castarray": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2" + } + }, "@tauri-apps/api": { "version": "1.0.0-rc.3", "requires": { @@ -22086,9 +22145,21 @@ "lodash": { "version": "4.17.21" }, + "lodash.castarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", + "integrity": "sha1-wCUTUV4wna3dTCTGDP3c9ZdtkRU=", + "dev": true + }, "lodash.debounce": { "version": "4.0.8" }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, "lodash.memoize": { "version": "4.1.2" }, @@ -24290,6 +24361,15 @@ "symbol-tree": { "version": "3.2.4" }, + "tailwind-scrollbar": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-1.3.1.tgz", + "integrity": "sha512-FeYuLxLtCRMO4PmjPJCzm5wQouFro2BInZXKPxqg54DR/55NAHoS8uNYWMiRG5l6qsLkWBfVEM34gq2XAQUwVg==", + "dev": true, + "requires": { + "tailwindcss": ">1.9.6" + } + }, "tailwindcss": { "version": "3.0.23", "dev": true, diff --git a/package.json b/package.json index 7bbb5b694..b7cecbcf9 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@babel/core": "^7.16.0", + "@fontsource/work-sans": "^4.5.7", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@svgr/webpack": "^5.5.0", "@tauri-apps/api": "^1.0.0-rc.3", diff --git a/src/App.tsx b/src/App.tsx index a8625bad7..5960705f2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import { import { Overview } from './components/Overview'; import { BodyProportions } from './components/proportions/BodyProportions'; import { AppContextProvider } from './components/providers/AppContext'; -import { useEffect } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { DataFeedConfigT, DataFeedMessage, DeviceDataMaskT, StartDataFeedT, TrackerDataMaskT } from 'solarxr-protocol'; import { MainLayoutRoute } from './components/MainLayout'; import { SettingsLayoutRoute } from './components/settings/SettingsLayout'; @@ -18,6 +18,8 @@ import { Serial } from './components/settings/pages/Serial'; import { listen } from '@tauri-apps/api/event' import type { Event } from '@tauri-apps/api/event' +import { Button } from './components/commons/Button'; +import { appWindow } from '@tauri-apps/api/window' function Layout() { const { sendDataFeedPacket } = useWebsocketAPI(); @@ -72,6 +74,7 @@ function Layout() { } + function App() { const websocketAPI = useProvideWebsocketApi(); @@ -97,16 +100,32 @@ function App() { }); }, []) + const updateCorners = () => { + // Check if the window is maximized to remove rounded corners + const body = document.getElementsByTagName('body'); + if (!body) return; + appWindow.isMaximized().then((maximized) => { + body[0].style.borderRadius = maximized ? '0' : `15px`; + }) + } + + useEffect(() => { + window.addEventListener('resize', updateCorners); + return () => { + window.removeEventListener('resize', updateCorners) + } + }, []) + return ( -
+
{!websocketAPI.isConnected && ( <> -
Connection lost to server
+
Connection lost to server
)} {websocketAPI.isConnected && } diff --git a/src/components/BVHButton.tsx b/src/components/BVHButton.tsx index 04cf50727..3ae36910b 100644 --- a/src/components/BVHButton.tsx +++ b/src/components/BVHButton.tsx @@ -18,10 +18,9 @@ export function BVHButton() { useRPCPacket(RpcMessage.RecordBVHStatus, (data: RecordBVHStatusT) => { setRecording(data.recording); - console.log('receiving', data); }) return ( - } onClick={toggleBVH}> + } onClick={toggleBVH}> ) } \ No newline at end of file diff --git a/src/components/MainLayout.tsx b/src/components/MainLayout.tsx index 35af10d62..f8d423d5b 100644 --- a/src/components/MainLayout.tsx +++ b/src/components/MainLayout.tsx @@ -23,8 +23,8 @@ export function MainLayoutRoute({ children }: { children: ReactChild }) {
-
-
+
+
{children}
@@ -40,8 +40,8 @@ export function MainLayoutRoute({ children }: { children: ReactChild }) {
{/* */} -
-
Settings
+
+
Settings
diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 8cfeb0d1b..9f2ea014a 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -8,15 +8,15 @@ export function AppModal({ children, name, ...props }: { children?: ReactChild, return (
-

+

{name}

- } onClick={props.onRequestClose}> + } className="fill-purple-gray-200" onClick={props.onRequestClose}>
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 6b76d0b21..66b902aff 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -4,15 +4,11 @@ import { useMatch, NavLink, } from "react-router-dom"; -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 }) { @@ -21,11 +17,11 @@ export function NavButton({ to, children, match, icon }: { to: string, children: }); return ( - +
-
{icon}
+
{icon}
-
{children}
+
{children}
) } @@ -33,27 +29,27 @@ export function NavButton({ to, children, match, icon }: { to: string, children: export function Navbar({ children }: { children?: ReactChild }) { return ( -
+
-
SlimeVR
+
SlimeVR
{children &&
{children}
}
-
appWindow.minimize()}> - +
appWindow.minimize()}> +
-
appWindow.toggleMaximize()}> - +
appWindow.toggleMaximize()}> +
-
appWindow.close()}> - +
appWindow.close()}> +
diff --git a/src/components/Overview.tsx b/src/components/Overview.tsx index 594894378..cb925ec7b 100644 --- a/src/components/Overview.tsx +++ b/src/components/Overview.tsx @@ -34,7 +34,7 @@ export function Overview() { return (
-
+
Assigned Trackers
@@ -42,7 +42,7 @@ export function Overview() {
{unasignedTrackers.length > 0 && <> -
+
Unassigned Trackers
diff --git a/src/components/commons/BigButton.tsx b/src/components/commons/BigButton.tsx index 6ac23ca99..e0bf9f521 100644 --- a/src/components/commons/BigButton.tsx +++ b/src/components/commons/BigButton.tsx @@ -3,9 +3,9 @@ import React, { ReactChild } from "react"; export function BigButton({ text, icon, disabled, onClick, ...props }: { text: string, icon: ReactChild } & React.AllHTMLAttributes) { return ( - ) } \ No newline at end of file diff --git a/src/components/commons/Button.tsx b/src/components/commons/Button.tsx index 479301679..55f2abf41 100644 --- a/src/components/commons/Button.tsx +++ b/src/components/commons/Button.tsx @@ -3,20 +3,13 @@ import { ReactChild, useMemo } from "react"; -export function Button({ children, variant, disabled, ...props }: { children: ReactChild, variant: 'primary' | 'secondary' } & React.ButtonHTMLAttributes) { +export function Button({ children, variant, disabled, ...props }: { children: ReactChild, variant: 'primary' } & React.ButtonHTMLAttributes) { const classes = useMemo(() => { const variantsMap = { - primary: 'text-white bg-primary-5 hover:bg-primary-1 focus:ring-4 focus:outline-none focus:ring-primary-2', - secondary: 'text-white hover:bg-primary-1 focus:ring-primary-2' + primary: classNames('text-field-title focus:ring-4 focus:outline-none focus:ring-primary-2', { 'bg-purple-gray-600 hover:bg-purple-gray-500': !disabled, 'bg-purple-gray-900 hover:bg-purple-gray-900 text-section-indicator': disabled }), } - - const variantsMapDisabled = { - primary: 'bg-gray-800 hover:bg-gray-800', - secondary: 'bg-gray-800 hover:bg-gray-800' - } - - return classNames(variantsMap[variant], 'focus:ring-4 rounded-lg text-sm px-5 py-2.5 text-center font-medium', disabled ? variantsMapDisabled[variant] : false); + return classNames(variantsMap[variant], 'focus:ring-4 rounded-lg px-5 py-2.5 text-center font-medium'); }, [variant, disabled]) return diff --git a/src/components/commons/ButtonIcon.tsx b/src/components/commons/ButtonIcon.tsx index 9877ff466..f5d170d80 100644 --- a/src/components/commons/ButtonIcon.tsx +++ b/src/components/commons/ButtonIcon.tsx @@ -4,7 +4,7 @@ import React, { ReactChild } from "react"; export function IconButton({ icon, className, ...props }: { icon: ReactChild, className?: string } & React.HTMLAttributes) { return ( -
+
{icon}
) diff --git a/src/components/commons/Checkbox.tsx b/src/components/commons/Checkbox.tsx index da8869a4f..faa8727ea 100644 --- a/src/components/commons/Checkbox.tsx +++ b/src/components/commons/Checkbox.tsx @@ -1,12 +1,13 @@ +import classNames from 'classnames'; import { forwardRef, useId } from 'react' -export const CheckBox = forwardRef(({ label, ...props }, ref) => { +export const CheckBox = forwardRef(({ label, outlined, ...props }, ref) => { const id = useId(); return ( -
- - +
+ +
) }); \ No newline at end of file diff --git a/src/components/commons/Input.tsx b/src/components/commons/Input.tsx index bf92bd3b7..f56e51db1 100644 --- a/src/components/commons/Input.tsx +++ b/src/components/commons/Input.tsx @@ -9,7 +9,7 @@ export const Input = forwardRef(({type, placeholde return ; diff --git a/src/components/commons/NumberSelector.tsx b/src/components/commons/NumberSelector.tsx index 5f776b3fb..0a951ba71 100644 --- a/src/components/commons/NumberSelector.tsx +++ b/src/components/commons/NumberSelector.tsx @@ -11,13 +11,13 @@ export function NumberSelector({ label, valueLabelFormat, control, name, min, ma const variantsMap = { smol: { container: 'flex flex-col gap-1', - label: 'flex text-sm text-white', - value: 'flex justify-center items-center w-10 text-white text-lg font-bold' + label: 'flex text-field-title', + value: 'flex justify-center items-center w-10 text-field-title' }, big: { - container: 'flex flex-row gap-5 ', - label: 'flex flex-grow text-lg font-bold text-white justify-start items-center', - value: 'flex justify-center items-center w-16 text-white text-lg font-bold' + container: 'flex flex-row gap-5', + label: 'flex flex-grow justify-start items-center text-field-title', + value: 'flex justify-center items-center w-16 text-field-title' } }; return variantsMap[variant]; diff --git a/src/components/commons/Select.tsx b/src/components/commons/Select.tsx index d613f6fde..b7bd63582 100644 --- a/src/components/commons/Select.tsx +++ b/src/components/commons/Select.tsx @@ -4,9 +4,9 @@ export type SelectOption = { label: string, value: any }; export const Select = React.forwardRef(({ label, options, ...props }, ref) => { return ( -
- {label && {label}} - {options && options.map(({ label, value }) => )}
diff --git a/src/components/commons/icon/BatteryIcon.tsx b/src/components/commons/icon/BatteryIcon.tsx index 298ddc712..32d77549d 100644 --- a/src/components/commons/icon/BatteryIcon.tsx +++ b/src/components/commons/icon/BatteryIcon.tsx @@ -6,13 +6,13 @@ export function BatteryIcon({ value }: { value: number }) { const col = useMemo(() => { const colorsMap: { [key: number]: string } = { - 0.4: 'fill-misc-1', - 0.2: 'fill-misc-4', - 0: 'fill-misc-2', + 0.4: 'fill-status-online', + 0.2: 'fill-status-warning', + 0: 'fill-status-error', } const val = Object.keys(colorsMap).filter(key => +key < value).sort((a, b) => +b - +a)[0]; - return colorsMap[+val] || 'fill-gray-800'; + return colorsMap[+val] || 'fill-primary-gray-600'; }, [value]) return ( diff --git a/src/components/commons/icon/CloseIcon.tsx b/src/components/commons/icon/CloseIcon.tsx index b9a64f49c..f68b206e9 100644 --- a/src/components/commons/icon/CloseIcon.tsx +++ b/src/components/commons/icon/CloseIcon.tsx @@ -1,9 +1,9 @@ -export function CloseIcon({ className }: { className?: string }) { +export function CloseIcon({ className, size = 35 }: { className?: string, size?: number }) { return ( - + diff --git a/src/components/commons/icon/CrossIcon.tsx b/src/components/commons/icon/CrossIcon.tsx index 7a7426090..26faa8abf 100644 --- a/src/components/commons/icon/CrossIcon.tsx +++ b/src/components/commons/icon/CrossIcon.tsx @@ -1,5 +1,5 @@ export function CrossIcon() { - return ( ) + return ( ) } \ No newline at end of file diff --git a/src/components/commons/icon/RecordIcon.tsx b/src/components/commons/icon/RecordIcon.tsx index 21361e9ef..26341f02c 100644 --- a/src/components/commons/icon/RecordIcon.tsx +++ b/src/components/commons/icon/RecordIcon.tsx @@ -2,7 +2,7 @@ export function RecordIcon() { return ( - + ) diff --git a/src/components/commons/icon/WifiIcon.tsx b/src/components/commons/icon/WifiIcon.tsx index 3af4e3111..17b2c1227 100644 --- a/src/components/commons/icon/WifiIcon.tsx +++ b/src/components/commons/icon/WifiIcon.tsx @@ -11,13 +11,13 @@ export function WifiIcon({ value }: { value: number }) { const col = useMemo(() => { const colorsMap: { [key: number]: string } = { - 0.4: 'fill-misc-1', - 0.2: 'fill-misc-4', - 0: 'fill-misc-2', + 0.4: 'fill-status-online', + 0.2: 'fill-status-warning', + 0: 'fill-status-error', } const val = Object.keys(colorsMap).filter(key => +key < percent).sort((a, b) => +b - +a)[0]; - return colorsMap[+val] || 'fill-gray-800'; + return colorsMap[+val] || 'fill-primary-gray-600'; }, [percent]) return ( diff --git a/src/components/proportions/AutomaticCalibration.tsx b/src/components/proportions/AutomaticCalibration.tsx index 7f82e8824..f52f8aa38 100644 --- a/src/components/proportions/AutomaticCalibration.tsx +++ b/src/components/proportions/AutomaticCalibration.tsx @@ -3,8 +3,6 @@ import { Button } from "../commons/Button"; import { AppModal } from "../Modal"; - - export function AutomaticCalibration() { const [isOpen, setOpen] = useState(false); @@ -23,7 +21,7 @@ export function AutomaticCalibration() {
- +
diff --git a/src/components/proportions/BodyProportions.tsx b/src/components/proportions/BodyProportions.tsx index 9b6128f6d..e8747d161 100644 --- a/src/components/proportions/BodyProportions.tsx +++ b/src/components/proportions/BodyProportions.tsx @@ -102,29 +102,29 @@ export function BodyProportions() { return (
-
+
Body Proportions
-
+
-
+
-
-
Precision
-
-
setStep(0.5)} className={classNames("hover:bg-primary-1 flex flex-grow justify-center items-center", { 'bg-primary-3': step === 0.5 })}>0.5
-
setStep(1)} className={classNames("hover:bg-primary-1 flex flex-grow justify-center items-center", { 'bg-primary-3': step === 1 })}>1
-
setStep(5)} className={classNames("hover:bg-primary-1 flex flex-grow justify-center items-center", { 'bg-primary-3': step === 5 })}>5
+
+
Precision
+
+
setStep(0.5)} className={classNames("hover:bg-purple-gray-500 flex flex-grow justify-center items-center ", { 'bg-purple-gray-400': step === 0.5 })}>0.5
+
setStep(1)} className={classNames("hover:bg-purple-gray-500 flex flex-grow justify-center items-center", { 'bg-purple-gray-400': step === 1 })}>1
+
setStep(5)} className={classNames("hover:bg-purple-gray-500 flex flex-grow justify-center items-center", { 'bg-purple-gray-400': step === 5 })}>5
{bodyParts.map(({label, bone}) => -
onMouseEnterSelector(bone)} className={classNames('px-3 rounded-lg py-2', { 'bg-primary-1 ': bone === selectedBodyPart })}> +
onMouseEnterSelector(bone)} className={classNames('px-3 rounded-lg py-2', { 'bg-purple-gray-700 ': bone === selectedBodyPart })}>
-
+
-
+
{children}
-
+
diff --git a/src/components/settings/SettingsSidebar.tsx b/src/components/settings/SettingsSidebar.tsx index a7588bc30..12f4c3bd5 100644 --- a/src/components/settings/SettingsSidebar.tsx +++ b/src/components/settings/SettingsSidebar.tsx @@ -5,15 +5,15 @@ import { NavLink } from "react-router-dom" export function SettingsSidebar() { return (
-
-
TRACKER SETTINGS
-
- SteamVR - Filtering - Serial +
+
TRACKER SETTINGS
+
+ SteamVR + Filtering + Serial
- {/*
+ {/*
USER INTERFACE
Widgets diff --git a/src/components/settings/pages/Serial.tsx b/src/components/settings/pages/Serial.tsx index e1b4ebe5b..cf6a21d58 100644 --- a/src/components/settings/pages/Serial.tsx +++ b/src/components/settings/pages/Serial.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { CloseSerialRequestT, OpenSerialRequestT, RpcMessage, SerialUpdateResponseT, SetWifiRequestT } from "solarxr-protocol"; import { useLayout } from "../../../hooks/layout"; @@ -19,7 +19,7 @@ export function Serial() { // const consoleRef = useRef(null); const [consoleContent, setConsole] = useState(""); const [isSerialOpen, setSerialOpen] = useState(false); - const { register, reset, handleSubmit } = useForm({ defaultValues: {} }); + const { register, handleSubmit } = useForm({ defaultValues: {} }); useEffect(() => { @@ -78,7 +78,7 @@ export function Serial() { return (
-
+
                     {isSerialOpen ? consoleContent : 'Connection to serial lost, Reconnecting...'}
                 
diff --git a/src/components/settings/pages/TrackersSettings.tsx b/src/components/settings/pages/TrackersSettings.tsx index 5b28dcf7b..aef7f6cd9 100644 --- a/src/components/settings/pages/TrackersSettings.tsx +++ b/src/components/settings/pages/TrackersSettings.tsx @@ -89,30 +89,30 @@ export function TrackersSettings() { return (
-
+
SteamVR Trackers
-
+

Enable or disable specific tracking parts.

Useful if you want more control over what SlimeVR does.

-
-
-
-
-
-
+
+ + + + +
-
+
Filtering
-
+

I don't know what this does, but I'm

designing something for it anyway

-
+
`${value}%`} min={0} max={100} step={10}> diff --git a/src/components/tracker/TrackerCard.tsx b/src/components/tracker/TrackerCard.tsx index efcce4068..3437eda59 100644 --- a/src/components/tracker/TrackerCard.tsx +++ b/src/components/tracker/TrackerCard.tsx @@ -16,12 +16,12 @@ export function TrackerCard({ tracker, device }: { tracker: TrackerDataT, devic const statusClass = useMemo(() => { const statusMap: { [key: number]: string } = { - [TrackerStatus.NONE]: 'bg-cyan-800', - [TrackerStatus.BUSY]: 'bg-misc-4', - [TrackerStatus.ERROR]: 'bg-misc-2', - [TrackerStatus.DISCONNECTED]: 'bg-gray-800', - [TrackerStatus.OCCLUDED]: 'bg-misc-4', - [TrackerStatus.OK]: 'bg-misc-1' + [TrackerStatus.NONE]: 'bg-purple-gray-900', + [TrackerStatus.BUSY]: 'bg-status-warning', + [TrackerStatus.ERROR]: 'bg-status-error', + [TrackerStatus.DISCONNECTED]: 'bg-purple-gray-900', + [TrackerStatus.OCCLUDED]: 'bg-status-warning', + [TrackerStatus.OK]: 'bg-status-online' } return statusMap[tracker.status]; }, [tracker.status]); @@ -47,39 +47,38 @@ export function TrackerCard({ tracker, device }: { tracker: TrackerDataT, devic return (
-
+
-
{trackerName}
-
+
{trackerName}
+
{device && device.hardwareStatus && <>
{device.hardwareStatus.rssi &&
} - {device.hardwareStatus.ping &&
{device.hardwareStatus.ping} ms
} + {device.hardwareStatus.ping &&
{device.hardwareStatus.ping} ms
}
{device.hardwareStatus.batteryPctEstimate &&
-
{((device.hardwareStatus.batteryPctEstimate)).toFixed(0)} %
+
{((device.hardwareStatus.batteryPctEstimate)).toFixed(0)} %
} } - -
-
-
+
+
+
{tracker.info?.editable &&
- }/> + }/>
}
diff --git a/src/hooks/app.ts b/src/hooks/app.ts index 578982b9e..e18ecf210 100644 --- a/src/hooks/app.ts +++ b/src/hooks/app.ts @@ -37,7 +37,6 @@ export function useProvideAppContext(): AppContext { state, dispatch, setDebug: (value: boolean) => dispatch({ type: 'debug', value }), - } } diff --git a/src/index.css b/src/index.css index bb270a7aa..3de263426 100644 --- a/src/index.css +++ b/src/index.css @@ -2,8 +2,10 @@ @tailwind components; @tailwind utilities; + body { font-variant-numeric: tabular-nums; + font-family: "Work Sans", sans-serif; height: 100vh; width: 100vw; user-select: none; @@ -21,3 +23,28 @@ html { } +::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +::-webkit-scrollbar-corner { + background-color: theme('colors.purple-gray.900'); +} + +::-webkit-scrollbar-track { + background: theme('colors.purple-gray.600'); + border-radius: 50px; + border-radius: 50px; + +} + +::-webkit-scrollbar-thumb { + background: theme('colors.purple-gray.400'); + border-radius: 50px; + border-radius: 50px; +} + +::-webkit-scrollbar-thumb:hover { + background: theme('colors.purple-gray.300'); +} \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 0a37b0ee9..b40707a45 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import * as ReactDOMClient from 'react-dom/client'; +import "@fontsource/work-sans/variable.css"; import './index.css'; import App from './App'; import Modal from 'react-modal'; diff --git a/tailwind.config.js b/tailwind.config.js index dfe8a3c97..020edaea5 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,25 +1,60 @@ +const plugin = require('tailwindcss/plugin') + +const rem = (px) => `${(px / 12).toFixed(4)}rem` + module.exports = { content: ["./src/**/*.{js,jsx,ts,tsx}",], theme: { extend: { colors: { - primary: { - 1: '#201527', - 2: '#26192E', - 3: '#2F2037', - 4: '#382740', - 5: '#432E4D' + 'accent': { + darker: '#831ECC', + lighter: '#C06FFB' }, - misc: { - 1: '#50E897', - 2: '#FF486E', - 3: '#A44FED', - 4: '#D5C055' - } + 'status': { + online: '#9AFF76', + warning: '#FFB257', + error: '#FF6464' + }, + 'purple-gray': { + 900: "#160B1D", + 800: "#261730", + 700: "#3F2A4F", + 600: "#593E6C", + 500: "#6E5084", + 400: "#8E6BA7", + 300: "#C0A1D8", + 200: "#EFE2F9", + 100: "#FFFFFF" + }, + }, + fontSize: { + DEFAULT: rem(12), + }, + fontWeight: { + DEFAULT: 400, } }, }, plugins: [ require('@tailwindcss/forms'), + plugin(function({ addUtilities, theme }) { + + const textConfig = (fontSize, fontWeight, color) => ({ + color, + fontSize, + fontWeight + }) + + addUtilities({ + '.text-heading': textConfig(rem(35), 700, theme('colors.purple-gray.100')), + '.text-secondary-heading': textConfig(rem(25), 700, theme('colors.purple-gray.100')), + '.text-field-title': textConfig(rem(12), 700, theme('colors.purple-gray.100')), + '.text-extra-emphasised': textConfig(rem(12), 600, theme('colors.purple-gray.100')), + '.text-emphasised': textConfig(rem(12), 400, theme('colors.purple-gray.100')), + '.text-default': textConfig(rem(12), 400, theme('colors.purple-gray.300')), + '.text-section-indicator': textConfig(rem(12), 700, theme('colors.purple-gray.400')) + }) + }) ], } \ No newline at end of file