Skip to content

Commit

Permalink
Merge pull request #163 from zusorio/dashboard-clock-syncer
Browse files Browse the repository at this point in the history
Make dashboard clock powered by syncer time
  • Loading branch information
slmnio authored Jan 6, 2023
2 parents 93fda0e + 5d7f43f commit 7aa39f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"howler": "^2.2.3",
"jimp": "^0.16.1",
"marked": "^2.1.3",
"obs-websocket-js": "^5.0.2",
"notyf": "^3.10.0",
"obs-websocket-js": "^5.0.2",
"opus-decoder": "^0.5.3",
"socket.io-client": "^4.0.1",
"spacetime": "^6.16.0",
"spacetime-informal": "^0.6.1",
"timesync": "^1.0.11",
"vue": "^2.6.11",
"vue-cookies": "^1.8.1",
"vue-meta": "^2.4.0",
Expand Down
15 changes: 10 additions & 5 deletions website/src/components/website/dashboard/DashboardClock.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<template>
<div class="dashboard-clock bg-dark px-2 mx-1" @click="() => use12hr = !use12hr">
<div class="title">{{ title }}</div>
<div class="clock">{{ text }}</div>
<div class="clock">{{ text }}</div>
</div>
</template>

<script>
import spacetime from "spacetime";
import { create } from "timesync";
export default {
name: "DashboardClock",
props: ["title", "timezone", "clockType"],
data: () => ({
now: new Date(),
use12hr: false
use12hr: false,
ts: create({
server: "https://api.syncer.live/api/time"
}),
now: new Date()
}),
computed: {
time() {
Expand All @@ -30,8 +35,8 @@ export default {
},
mounted() {
setInterval(() => {
this.now = new Date();
}, 1000);
this.now = this.ts.now();
}, 50);
}
};
</script>
Expand Down
14 changes: 13 additions & 1 deletion website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3574,7 +3574,7 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@~4.3.1:
dependencies:
ms "2.1.2"

debug@^4.3.2:
debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
Expand Down Expand Up @@ -6785,6 +6785,11 @@ normalize-url@^4.1.0:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==

notyf@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/notyf/-/notyf-3.10.0.tgz#67a64443c69ea0e6495c56ea0f91198860163d06"
integrity sha512-Mtnp+0qiZxgrH+TzVlzhWyZceHdAZ/UWK0/ju9U0HQeDpap1mZ8cC7H5wSI5mwgni6yeAjaxsTw0sbMK+aSuHw==

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand Down Expand Up @@ -9111,6 +9116,13 @@ timers-browserify@^2.0.4:
dependencies:
setimmediate "^1.0.4"

timesync@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/timesync/-/timesync-1.0.11.tgz#0c6afb381e53756ece5cb4a0a0ce1be526e08b55"
integrity sha512-qT2Y/qAQAeQTa/M+Dteec+76vsUAbY1TQQtXBVTuNMHBkKflT2uLnqG8T+V7eK7CADhwRq+2Etmj5df9VOpkNQ==
dependencies:
debug "^4.3.4"

timm@^1.6.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/timm/-/timm-1.7.1.tgz#96bab60c7d45b5a10a8a4d0f0117c6b7e5aff76f"
Expand Down

0 comments on commit 7aa39f9

Please sign in to comment.