2024-02-21 13:49:39 -08:00
|
|
|
<script lang="ts">
|
2024-02-21 15:13:18 -08:00
|
|
|
import '@fontsource/roboto/latin.css'
|
2024-02-21 20:10:42 -08:00
|
|
|
import 'material-icons/iconfont/material-icons.css'
|
|
|
|
import Dashboard from './lib/Dashboard/Dashboard.svelte'
|
|
|
|
import 'material-symbols'
|
|
|
|
import AppBar from './lib/Apps/AppBar.svelte'
|
|
|
|
import { appList } from './lib/Apps/appList'
|
2024-02-23 14:56:35 -08:00
|
|
|
import { initializeTelemetry } from './lib/utils/initializeTelemetry'
|
|
|
|
import { onMount } from 'svelte'
|
2024-02-24 01:38:00 -08:00
|
|
|
import { Toaster } from 'svelte-french-toast'
|
|
|
|
import { initializationSequence } from './lib/Sequences/sequences'
|
2024-02-24 17:40:47 -08:00
|
|
|
import Loading from './lib/Loading/Loading.svelte'
|
|
|
|
import { settingsStore } from './lib/stores/settingsStore'
|
|
|
|
import getSettings from './lib/utils/getSettings'
|
2024-02-25 01:05:44 -08:00
|
|
|
import { Svrollbar } from 'svrollbar'
|
2024-02-21 20:10:42 -08:00
|
|
|
|
2024-02-23 18:02:10 -08:00
|
|
|
let activeApp: App = 'camera'
|
2024-02-23 14:56:35 -08:00
|
|
|
let topics: TelemetryTopics = {
|
|
|
|
doubles: [
|
|
|
|
'orientation',
|
|
|
|
'chassis-x-speed',
|
|
|
|
'chassis-y-speed',
|
|
|
|
'accx',
|
|
|
|
'accy',
|
|
|
|
'accz',
|
|
|
|
'jerk-x',
|
|
|
|
'jerk-y',
|
|
|
|
'voltage',
|
|
|
|
],
|
|
|
|
strings: ['acc-profile', 'gear'],
|
|
|
|
booleans: ['ebrake', 'reorient', 'gpws'],
|
|
|
|
}
|
|
|
|
|
2024-02-24 17:40:47 -08:00
|
|
|
let loading = $settingsStore.fastStartup ? false : true
|
|
|
|
|
2024-02-23 14:56:35 -08:00
|
|
|
onMount(() => {
|
2024-02-24 17:40:47 -08:00
|
|
|
let savedSettings = getSettings()
|
|
|
|
if (savedSettings !== false) {
|
|
|
|
settingsStore.set(savedSettings)
|
|
|
|
}
|
2024-02-23 15:12:28 -08:00
|
|
|
initializeTelemetry(topics, 200)
|
2024-02-24 17:40:47 -08:00
|
|
|
setTimeout(() => {
|
|
|
|
loading = false
|
|
|
|
initializationSequence()
|
|
|
|
}, 3000)
|
2024-02-23 14:56:35 -08:00
|
|
|
})
|
2024-02-25 01:05:44 -08:00
|
|
|
|
|
|
|
let infotainmentViewport: Element
|
|
|
|
let infotainmentContent: Element
|
2024-02-21 13:49:39 -08:00
|
|
|
</script>
|
|
|
|
|
2024-02-25 01:05:44 -08:00
|
|
|
<Svrollbar />
|
|
|
|
|
2024-02-24 17:40:47 -08:00
|
|
|
<main
|
2024-02-25 01:05:44 -08:00
|
|
|
class="select-none transition-opacity duration-300 overflow-x-hidden"
|
2024-02-24 17:40:47 -08:00
|
|
|
class:opacity-0={loading}
|
|
|
|
>
|
2024-02-21 20:10:42 -08:00
|
|
|
<!-- driver dashboard -->
|
|
|
|
<div class="h-screen w-[35vw] fixed shadow-lg shadow-slate-800 z-10">
|
|
|
|
<Dashboard />
|
|
|
|
</div>
|
|
|
|
<!-- the infotainment system -->
|
2024-02-25 01:05:44 -08:00
|
|
|
<Svrollbar viewport={infotainmentViewport} contents={infotainmentContent} />
|
|
|
|
<div
|
|
|
|
class="min-h-screen w-[65vw] right-0 absolute infotainment-container overflow-x-hidden"
|
|
|
|
bind:this={infotainmentViewport}
|
|
|
|
>
|
2024-02-21 20:10:42 -08:00
|
|
|
<!-- dynamic app system (edit appList.ts to add new apps) -->
|
2024-02-25 01:05:44 -08:00
|
|
|
<div class="mx-10 mt-10 overflow-x-hidden" bind:this={infotainmentContent}>
|
2024-02-21 20:10:42 -08:00
|
|
|
<svelte:component this={appList[activeApp].component} />
|
|
|
|
</div>
|
2024-02-25 01:05:44 -08:00
|
|
|
<div
|
|
|
|
class="fixed w-[65vw] flex justify-center right-0 bottom-0 mb-4 overflow-x-hidden"
|
|
|
|
>
|
2024-02-21 20:10:42 -08:00
|
|
|
<AppBar bind:activeApp {appList} />
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-24 01:38:00 -08:00
|
|
|
|
|
|
|
<!-- toast service -->
|
2024-02-21 20:10:42 -08:00
|
|
|
</main>
|
2024-02-21 13:49:39 -08:00
|
|
|
|
2024-02-24 17:40:47 -08:00
|
|
|
{#if loading}
|
|
|
|
<Loading />
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<Toaster />
|
|
|
|
|
2024-02-21 14:19:36 -08:00
|
|
|
<style lang="postcss">
|
|
|
|
main {
|
2024-02-21 15:13:18 -08:00
|
|
|
font-family: 'Roboto', sans-serif;
|
2024-02-21 14:19:36 -08:00
|
|
|
}
|
2024-02-21 20:10:42 -08:00
|
|
|
|
|
|
|
.infotainment-container {
|
|
|
|
background: #2c3e50; /* fallback for old browsers */
|
|
|
|
background: -webkit-linear-gradient(
|
|
|
|
to right,
|
|
|
|
#2c3e50,
|
|
|
|
#fd746c
|
|
|
|
); /* Chrome 10-25, Safari 5.1-6 */
|
|
|
|
background: linear-gradient(
|
|
|
|
to right,
|
|
|
|
#2c3e50,
|
|
|
|
#fd746c
|
|
|
|
); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
2024-02-25 01:05:44 -08:00
|
|
|
/* hide scrollbar */
|
|
|
|
-ms-overflow-style: none;
|
|
|
|
scrollbar-width: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.infotainment-container::-webkit-scrollbar {
|
|
|
|
/* hide scrollbar */
|
|
|
|
display: none;
|
2024-02-21 20:10:42 -08:00
|
|
|
}
|
2024-02-21 13:49:39 -08:00
|
|
|
</style>
|