Skip to content

Commit cfd4671

Browse files
author
Michael William Le Nguyen
committed
Reimplement announcement slideshow
1 parent 497fc94 commit cfd4671

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

public/announcements/next.png

304 KB
Loading

public/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"announcements/next.png"
3+
]

src/App.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<template>
22
<div id="app" class="container-fluid" style="height: 98vh; padding-top: 2vh; padding-left: 2vw;">
33
<div class="row" style="height: 85%;">
4-
<div class="col-md-7" style="height: 100%;">
5-
<h1>Announcements <span class="material-icons">announcement</span></h1>
4+
<div class="col-md-7" style="height: 100%; display: flex; flex-direction: column;">
5+
<h1 style="flex: 0 1 auto;">Announcements <span class="material-icons">announcement</span></h1>
6+
<div style="background-repeat: no-repeat; background-size: contain; flex: 1;" :style="{'background-image': 'url(' + currentImage + ')'}">
7+
</div>
68
</div>
79
<div class="col-md-5">
810
<div>
@@ -42,6 +44,7 @@ import './app.css'
4244
components: {}
4345
})
4446
export default class App extends Vue {
47+
private currentImage: string = ''
4548
private error: boolean = false
4649
private info: Map<string, { prediction: string, title: string }> = new Map()
4750
private time: string = ''
@@ -83,6 +86,17 @@ export default class App extends Vue {
8386
this.error = true
8487
console.log(error)
8588
})
89+
90+
fetch('config.json').then((data) => {
91+
return data.json()
92+
}).then((data) => {
93+
this.currentImage = data[0]
94+
setInterval(() => {
95+
this.currentImage = data[Math.floor(Math.random() * data.length)]
96+
}, 5000)
97+
}).catch((error) => {
98+
console.log(error)
99+
})
86100
}
87101
}
88102
</script>

0 commit comments

Comments
 (0)