Skip to content

Commit f758ad5

Browse files
committed
feat: get it working
1 parent 7567bfd commit f758ad5

25 files changed

+102
-697
lines changed

example.code-workspace

+2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
"liveServer.settings.multiRootWorkspaceName": "Example",
4444
"cSpell.words": [
4545
"codegen",
46+
"Iprops",
4647
"kobalte",
4748
"nanos",
49+
"ratelimit",
4850
"solidjs",
4951
"specta",
5052
"typecheck",

index.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
<meta name="description" content="">
3333
<link rel="stylesheet" type="text/css"
3434
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,700">
35-
<script type="module" src="../../../scripts/typetura.min.js"></script>
3635
<script type="module" src="https://unpkg.com/esp-web-tools@9.2.0/dist/web/install-button.js?module"></script>
3736
</head>
3837

@@ -52,11 +51,10 @@
5251
</div>
5352
<div id="root"></div>
5453
</div>
55-
<script type="module" src="./index.tsx"></script>
54+
<script type="module" src="./src/main.tsx"></script>
5655
<script type="text/javascript" data-sqs-type="imageloader-bootstrapper">
5756
(function () { if (window.ImageLoader) { window.ImageLoader.bootstrap({}, document); } })();
5857
</script>
59-
<script type="module" src="../../../scripts/custom.js"></script>
6058
</body>
6159

6260
</html>

public/images/background.svg

-53
This file was deleted.

public/images/backgrounds/img_1.svg

-3
This file was deleted.

public/images/backgrounds/img_2.svg

-591
This file was deleted.
-4.18 KB
Binary file not shown.

public/images/logo.gif

-638 KB
Binary file not shown.

public/images/png/logo.png

1.87 KB
Loading
-4.19 KB
Binary file not shown.

public/images/svg/arrow.svg

+3
Loading

public/images/svg/eye.svg

+9
Loading

public/images/svg/gearSolid.svg

+1
Loading

public/images/svg/grip-solid.svg

+1
Loading

public/images/svg/list-ul-solid.svg

+1
Loading

public/images/transparent_logo.gif

-590 KB
Binary file not shown.

src/assets/js/custom.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
2+
if (
3+
localStorage.theme === 'dark' ||
4+
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
5+
) {
6+
document.documentElement.classList.add('dark')
7+
} else {
8+
document.documentElement.classList.remove('dark')
9+
}
10+
11+
// Whenever the user explicitly chooses light mode
12+
//localStorage.theme = 'light'
13+
14+
//// Whenever the user explicitly chooses dark mode
15+
//localStorage.theme = 'dark'
16+
17+
//// Whenever the user explicitly chooses to respect the OS preference
18+
//localStorage.removeItem('theme')
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { createSignal, JSX } from 'solid-js'
2+
import { ANIMATION_MODE, POPOVER_ID } from '@src/static/types/enums'
3+
4+
export interface IProps {
5+
firstChild: JSX.Element
6+
secondChild: JSX.Element
7+
}
8+
9+
const CustomSlideAnimation = (props: IProps) => {
10+
const [hoverMode, setHoverMode] = createSignal(ANIMATION_MODE.GRIP)
11+
const [displayMode, setDisplayMode] = createSignal(POPOVER_ID.GRIP)
12+
13+
return (
14+
<div class="relative h-[45px] ml-auto flex leading-5 font-sans font-medium rounded-xl p-1 bg-[#0e0e0e]">
15+
<div class="relative flex">
16+
<div
17+
class={`absolute bg-[#252536] w-1/2 h-full rounded-lg pointer-events-none ease-in duration-150 ${
18+
hoverMode().match(ANIMATION_MODE.LIST) ? 'right-[0%]' : 'right-[50%]'
19+
}`}
20+
/>
21+
<div
22+
class="no-underline flex "
23+
onMouseLeave={() => {
24+
setHoverMode(
25+
displayMode().match(hoverMode())
26+
? ANIMATION_MODE.GRIP
27+
: ANIMATION_MODE.LIST,
28+
)
29+
}}
30+
onMouseEnter={() => setHoverMode(ANIMATION_MODE.GRIP)}
31+
onClick={() => setDisplayMode(POPOVER_ID.GRIP)}>
32+
{props.firstChild}
33+
</div>
34+
<div
35+
class="no-underline flex "
36+
onMouseLeave={() => {
37+
setHoverMode(
38+
displayMode().match(hoverMode())
39+
? ANIMATION_MODE.LIST
40+
: ANIMATION_MODE.GRIP,
41+
)
42+
}}
43+
onMouseEnter={() => setHoverMode(ANIMATION_MODE.LIST)}
44+
onClick={() => setDisplayMode(POPOVER_ID.LIST)}>
45+
{props.secondChild}
46+
</div>
47+
</div>
48+
</div>
49+
)
50+
}
51+
52+
export default CustomSlideAnimation

src/components/Header/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Image } from '@kobalte/core'
22
import { Link } from '@solidjs/router'
3+
import icon from '../../../public/images/logo.png'
34
import CustomPopover from './CustomPopover'
4-
import icons from '@assets/images'
55
import CustomSlideAnimation from '@components/CustomSlideAnimation'
66
import './styles.css'
77

@@ -19,7 +19,7 @@ const Header = (props: Iprops) => {
1919
<div>
2020
<Link href="/" class="no-underline" onClick={() => props.onClick()}>
2121
<Image.Root>
22-
<Image.Img src={icons.logo} alt="logo" width="51px" />
22+
<Image.Img src={icon} alt="logo" width="51px" />
2323
</Image.Root>
2424
</Link>
2525
</div>
@@ -31,7 +31,7 @@ const Header = (props: Iprops) => {
3131
<CustomPopover
3232
styles="h-full"
3333
popoverContent="Tracker manager"
34-
icon={icons.cameraSolid}
34+
icon=""
3535
/>
3636
</Link>
3737
}
@@ -40,7 +40,7 @@ const Header = (props: Iprops) => {
4040
<CustomPopover
4141
styles="h-full"
4242
popoverContent="App settings"
43-
icon={icons.gearSolid}
43+
icon=""
4444
/>
4545
</Link>
4646
}

src/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* @refresh reload */
22
import { Router } from '@solidjs/router'
3-
import { AppContextMainProvider } from '@store/context/main'
43
import { render } from 'solid-js/web'
54
import App from './app'
5+
import { AppContextMainProvider } from '@store/context/main'
66
import '@styles/imports.css'
77

88
render(

src/pages/AppSettings.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const AppSettingsPage = () => {
1414

1515
return (
1616
<div class="flex justify-center items-center content-center flex-col pt-[100px] text-white">
17-
<AppSettings
17+
<AppSettings
1818
onChange={(format, value) => {
1919
debug(`[AppSettings]: ${format} ${value}`)
2020
}}

src/static/types/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * as O from 'fp-ts/Option'
12
import type { ENotificationAction } from './enums'
23
import type { JSXElement } from 'solid-js'
34

src/store/context/api.tsx

+4-38
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@ import { createContext, useContext, createMemo, type Component, Accessor } from
88
import { createStore, produce } from 'solid-js/store'
99
import { debug, error, warn } from 'tauri-plugin-log-api'
1010
import { download, upload } from 'tauri-plugin-upload-api'
11-
import { useAppCameraContext } from '../camera'
1211
import { useAppNotificationsContext } from './notifications'
1312
import type { Context } from '@static/types'
1413
import { O } from '@static/types'
15-
import {
16-
ENotificationType,
17-
RESTStatus,
18-
RESTType,
19-
ESPEndpoints,
20-
BackendEndpoints,
21-
} from '@static/types/enums'
14+
import { ENotificationType, RESTStatus, RESTType, ESPEndpoints } from '@static/types/enums'
2215
import { AppStoreAPI, IEndpoint, IGHAsset, IGHRelease } from '@static/types/interfaces'
2316
import { makeRequest } from 'tauri-plugin-request-client'
2417

@@ -51,7 +44,6 @@ interface AppAPIContext {
5144
const AppAPIContext = createContext<AppAPIContext>()
5245
export const AppAPIProvider: Component<Context> = (props) => {
5346
const { addNotification } = useAppNotificationsContext()
54-
const { getCameras } = useAppCameraContext()
5547

5648
const ghEndpoint = 'https://api.github.com/repos/EyeTrackVR/OpenIris/releases/latest'
5749

@@ -69,24 +61,6 @@ export const AppAPIProvider: Component<Context> = (props) => {
6961
['wifiStrength', { url: `:81${ESPEndpoints.WIFI_STRENGTH}`, type: RESTType.POST }],
7062
['restartCamera', { url: `:81${ESPEndpoints.RESTART_CAMERA}`, type: RESTType.GET }],
7163
['getStoredConfig', { url: `:81${ESPEndpoints.GET_STORED_CONFIG}`, type: RESTType.GET }],
72-
//* Backend Specific Endpoints */
73-
//Note: The port may change, so we should make this dynamic using UPnP or something similar
74-
//? Default
75-
['stop', { url: `:8000${BackendEndpoints.STOP}`, type: RESTType.GET }],
76-
['start', { url: `:8000${BackendEndpoints.START}`, type: RESTType.GET }],
77-
['status', { url: `:8000${BackendEndpoints.STATUS}`, type: RESTType.GET }],
78-
['restart', { url: `:8000${BackendEndpoints.RESTART}`, type: RESTType.GET }],
79-
//? Config
80-
['config', { url: `:8000${BackendEndpoints.CONFIG}`, type: RESTType.GET }],
81-
['configEdit', { url: `:8000${BackendEndpoints.CONFIG}`, type: RESTType.POST }],
82-
['configSave', { url: `:8000${BackendEndpoints.SAVE_CONFIG}`, type: RESTType.GET }],
83-
['configLoad', { url: `:8000${BackendEndpoints.LOAD_CONFIG}`, type: RESTType.GET }],
84-
//? Trackers
85-
['tracker', { url: `:8000${BackendEndpoints.TRACKER}`, type: RESTType.GET }],
86-
['trackers', { url: `:8000${BackendEndpoints.TRACKERS}`, type: RESTType.GET }],
87-
['trackerEdit', { url: `:8000${BackendEndpoints.TRACKER}`, type: RESTType.POST }],
88-
['trackerCreate', { url: `:8000${BackendEndpoints.TRACKER}`, type: RESTType.PUT }],
89-
['trackerRemove', { url: `:8000${BackendEndpoints.TRACKER}`, type: RESTType.DELETE }],
9064
])
9165

9266
const defaultState: AppStoreAPI = {
@@ -479,15 +453,7 @@ export const AppAPIProvider: Component<Context> = (props) => {
479453
const method: RESTType = getEndpoint(endpointName).type
480454

481455
if (typeof deviceName != 'undefined') {
482-
const camera = getCameras().find(
483-
(camera: { address: string }) => camera.address === deviceName,
484-
)
485-
if (!camera) {
486-
setRESTStatus(RESTStatus.NO_CAMERA)
487-
debug('No camera found at that address')
488-
return O.none
489-
}
490-
deviceName = camera.address
456+
deviceName = 'http://' + deviceName
491457
} else {
492458
deviceName = 'http://localhost'
493459
}
@@ -538,7 +504,7 @@ export const AppAPIProvider: Component<Context> = (props) => {
538504
*
539505
*/
540506
const useOTA = async (firmwareName: string, device: string) => {
541-
const endpoints: Map<string, IEndpoint> = getEndpoints()
507+
/* const endpoints: Map<string, IEndpoint> = getEndpoints()
542508
const ota: string = endpoints.get('ota')?.url ?? ''
543509
const camera = getCameras().find((camera) => camera.address === device)
544510
if (!camera) {
@@ -547,7 +513,7 @@ export const AppAPIProvider: Component<Context> = (props) => {
547513
}
548514
const server = camera.address + ota
549515
const path = await join(await appConfigDir(), firmwareName + '.bin')
550-
await upload(server, path)
516+
await upload(server, path) */
551517
}
552518
//#endregion
553519

src/store/context/ui.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { UiStore } from '@src/static/types/interfaces'
55

66
interface AppUIContext {
77
openModalStatus: Accessor<boolean | undefined>
8-
showNotifications: Accessor<boolean | undefined>
8+
showNotifications: Accessor<boolean | undefined>
99
setOpenModal: (openModal: boolean) => void
1010
}
1111

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@styles/*": ["src/styles/*"],
2828
"@config/*": ["src/config/*"],
2929
"@src/*": ["src/*"],
30-
"@assets/*": ["./assets/*"],
30+
"@assets/*": ["src/assets/*"],
3131
"@hooks/*": ["src/utils/hooks/*"],
3232
"@static/*": ["src/static/*"],
3333
"@utils/*": ["src/utils/*"],

vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineConfig({
1515
'@styles': resolve(__dirname, './src/styles'),
1616
'@config': resolve(__dirname, './src/config'),
1717
'@src': resolve(__dirname, './src'),
18-
'@assets': resolve(__dirname, './assets'),
18+
'@assets': resolve(__dirname, './src/assets'),
1919
'@hooks': resolve(__dirname, './src/utils/hooks'),
2020
'@store': resolve(__dirname, './src/store'),
2121
'@static': resolve(__dirname, './src/static'),

0 commit comments

Comments
 (0)