Files
PhotonVision/photon-client/src/main.ts
Graham bec8092660 Vue 3 Upgrade (#1900)
## Description

Upgrades to Vue 3 and necessary associated dependencies. Also fixes some
issues with the layout and adds validation for object detection models.

Closes #885, closes #1943, closes #1449.
## Meta

Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2024.3.1
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added

---------

Co-authored-by: Matt M <matthew.morley.ca@gmail.com>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
Co-authored-by: samfreund <techguy763@gmail.com>
2025-05-06 18:21:41 -04:00

48 lines
1.2 KiB
TypeScript

import { h, createApp } from "vue";
import App from "@/App.vue";
import { createPinia } from "pinia";
import router from "@/router";
import vuetify from "@/plugins/vuetify";
import axios from "axios";
type PhotonClientRuntimeMode = "production" | "development" | "local-network-development";
const runtimeMode: PhotonClientRuntimeMode = process.env.NODE_ENV as PhotonClientRuntimeMode;
let backendHost: string;
let backendHostname: string;
switch (runtimeMode as PhotonClientRuntimeMode) {
case "development":
backendHost = `${location.hostname}:5800`;
backendHostname = location.hostname;
break;
case "local-network-development":
backendHost = "photonvision.local:5800";
backendHostname = "photonvision.local";
break;
case "production":
backendHost = location.host;
backendHostname = location.hostname;
break;
}
axios.defaults.baseURL = `http://${backendHost}/api`;
// Handle Plugins
const pinia = createPinia();
const app = createApp({
router,
vuetify,
pinia: createPinia(),
provide: {
backendHost: backendHost,
backendHostname: backendHostname
},
render: () => h(App)
});
app.use(pinia);
app.use(vuetify);
app.use(router);
app.mount("#app");