-
-
+
+
+
diff --git a/client/src/components/NavBar.vue b/client/src/components/NavBar.vue
deleted file mode 100644
index e11af91..0000000
--- a/client/src/components/NavBar.vue
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/client/src/components/Table.vue b/client/src/components/Table.vue
index 1f1ddec..338bd0b 100644
--- a/client/src/components/Table.vue
+++ b/client/src/components/Table.vue
@@ -2,9 +2,7 @@
| Date |
-
-
- |
+ {{ track.icon }} |
@@ -20,7 +18,6 @@
-
-
- {{props.icon}}
-
-
\ No newline at end of file
diff --git a/client/src/main.ts b/client/src/main.ts
index 90cdedc..26bcf20 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -1,12 +1,6 @@
import { createApp } from 'vue'
import './style.scss'
-import router from './router'
-import { state } from "./state";
-import 'bulma/css/bulma.css'
import App from './App.vue'
+import 'bulma/css/bulma.css'
-
-const app = createApp(App)
-app.use(router)
-app.mount('#app')
-state.populate()
+createApp(App).mount('#app')
diff --git a/client/src/router.ts b/client/src/router.ts
deleted file mode 100644
index 806e60d..0000000
--- a/client/src/router.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { createRouter, createWebHistory } from 'vue-router'
-import TableView from './views/TableView.vue'
-import NewTrackView from './views/NewTrackView.vue'
-
-const router = createRouter({
- history: createWebHistory(),
- routes: [
- { path: '/', component: TableView },
- { path: '/new-track', component: NewTrackView }
- // for other pages:
- // {path: '/', component: import('./views/TableView.vue')}
- ]
-})
-
-export default router
\ No newline at end of file
diff --git a/client/src/state.ts b/client/src/state.ts
index d449b60..a972820 100644
--- a/client/src/state.ts
+++ b/client/src/state.ts
@@ -1,6 +1,5 @@
import { reactive } from "vue"
import { Track } from "./track"
-import { Tick } from './ticks'
import { error } from "./error"
enum State {
@@ -26,23 +25,26 @@ export const state = reactive({
source.addEventListener("open", () => console.debug("opened event source"))
source.addEventListener('message', event => console.log(event))
source.addEventListener('TickAdded', event => {
+<<<<<<< Updated upstream
+ console.log(event)
+ const tick: Tick = JSON.parse(event.data)
+=======
const tick: Tick = Tick.fromJSON(JSON.parse(event.data))
+>>>>>>> Stashed changes
const tracks = this.tracks.map(track => {
if (track.id === tick.track_id) {
const ticks = track.ticks ?? []
ticks.push(tick)
track.ticks = ticks
+
}
return track
})
this.tracks = tracks
})
- source.addEventListener('TrackAdded', ({ data }) => {
- const track: Track = Track.fromJSON(JSON.parse(data))
- this.tracks = [track, ...this.tracks]
- })
source.addEventListener('TickDropped', event => {
- const tick: Tick = Tick.fromJSON(JSON.parse(event.data))
+ console.log(event)
+ const tick: Tick = JSON.parse(event.data)
const tracks = this.tracks.map(track => {
if (track.id === tick.track_id) {
track.ticks = track.ticks?.filter($tick => $tick.id !== tick.id)
@@ -51,14 +53,6 @@ export const state = reactive({
})
this.tracks = tracks
})
- source.addEventListener('TrackDropped', ({ data }) => {
- const track: Track = Track.fromJSON(JSON.parse(data))
- this.tracks = this.tracks.filter($track => $track.id !== track.id)
- })
- source.addEventListener('TrackChanged', ({ data }) => {
- const track: Track = Track.fromJSON(JSON.parse(data))
- this.tracks = this.tracks.map($track => $track.id === track.id ? track : $track)
- })
source.addEventListener('Lagged', event => {
console.log(event)
// Refresh the page, refetching the list of tracks and ticks
@@ -95,19 +89,5 @@ export const state = reactive({
const { ok, status, statusText } = await fetch(`/api/v1/tracks/${track.id}/all-ticks?${query.toString()}`, { method: 'DELETE' })
if (!ok)
error(`error deleting ticks for ${track.id}: ${statusText} (${status})`)
- },
- async addTrack(track: Track): Promise {
- const response = await fetch('/api/v1/tracks', {
- method: "POST",
- body: JSON.stringify(track),
- headers: { "Content-Type": "application/json" }
- })
- if (!response.ok)
- error(`error submitting track: ${track}: ${response.statusText} (${response.status})`)
- return response.ok
- },
- async removeTrack(trackID: number) {
- const response = await fetch(`/api/v1/tracks/${trackID}`, { method: "DELETE" })
- if (!response.ok) error(`error deleting track with ID ${trackID}: ${response.statusText} (${response.status})`)
}
})
diff --git a/client/src/ticks.ts b/client/src/ticks.ts
index d50b9ba..895682b 100644
--- a/client/src/ticks.ts
+++ b/client/src/ticks.ts
@@ -1,4 +1,4 @@
-export interface ITick {
+interface ITick {
id: number
track_id?: number
year?: number
@@ -10,7 +10,7 @@ export interface ITick {
has_time_info?: number
}
-export class Tick implements ITick {
+class Tick implements ITick {
id: number
track_id?: number
year?: number
diff --git a/client/src/track.ts b/client/src/track.ts
index 83947a3..14f7567 100644
--- a/client/src/track.ts
+++ b/client/src/track.ts
@@ -1,7 +1,7 @@
import { error } from "./error"
export interface ITrack {
- id?: number
+ id: number
name: String
description: String
icon: String
@@ -13,7 +13,7 @@ export interface ITrack {
}
export class Track implements ITrack {
- id?: number
+ id: number
name: String
description: String
icon: String
@@ -24,7 +24,7 @@ export class Track implements ITrack {
ticks?: Array
constructor(
- id: number | undefined,
+ id: number,
name: String,
description: String,
icon: String,
diff --git a/client/src/views/NewTrackView.vue b/client/src/views/NewTrackView.vue
deleted file mode 100644
index 8b2ed62..0000000
--- a/client/src/views/NewTrackView.vue
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
- TODO color choice
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/client/src/views/TableView.vue b/client/src/views/TableView.vue
deleted file mode 100644
index 053df35..0000000
--- a/client/src/views/TableView.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
diff --git a/client/yarn.lock b/client/yarn.lock
index a06ffcf..47e9ec4 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -213,11 +213,6 @@
"@vue/compiler-dom" "3.3.4"
"@vue/shared" "3.3.4"
-"@vue/devtools-api@^6.5.0":
- version "6.5.0"
- resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.5.0.tgz#98b99425edee70b4c992692628fa1ea2c1e57d07"
- integrity sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==
-
"@vue/reactivity-transform@3.3.4":
version "3.3.4"
resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.3.4.tgz#52908476e34d6a65c6c21cd2722d41ed8ae51929"
@@ -527,13 +522,6 @@ vite@^4.3.9:
optionalDependencies:
fsevents "~2.3.2"
-vue-router@4:
- version "4.2.2"
- resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.2.2.tgz#b0097b66d89ca81c0986be03da244c7b32a4fd81"
- integrity sha512-cChBPPmAflgBGmy3tBsjeoe3f3VOSG6naKyY5pjtrqLGbNEXdzCigFUHgBvp9e3ysAtFtEx7OLqcSDh/1Cq2TQ==
- dependencies:
- "@vue/devtools-api" "^6.5.0"
-
vue-template-compiler@^2.7.14:
version "2.7.14"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz#4545b7dfb88090744c1577ae5ac3f964e61634b1"