From 40d206cb84c0861747f0019f1b98b34eb4ea402f Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 8 Jul 2022 15:27:35 +0100 Subject: [PATCH] Fix build again --- src/index.d.ts | 2 +- src/leaflet/control/ClockControl.ts | 4 ++++ src/store/getters.ts | 4 ++-- test/components/PlayerImage.test.ts | 2 +- test/components/Sidebar.test.ts | 2 +- test/components/SvgIcon.test.ts | 2 +- tsconfig.json | 3 ++- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index acfc55b..1c556fc 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -170,7 +170,7 @@ interface LiveAtlasProjection { interface LiveAtlasWorldState { raining: boolean; thundering: boolean; - timeOfDay: number; + timeOfDay?: number; } interface LiveAtlasParsedUrl { diff --git a/src/leaflet/control/ClockControl.ts b/src/leaflet/control/ClockControl.ts index 4fc1f8a..3279af6 100644 --- a/src/leaflet/control/ClockControl.ts +++ b/src/leaflet/control/ClockControl.ts @@ -98,6 +98,10 @@ export class ClockControl extends Control { const timeOfDay = worldState.timeOfDay; let sunAngle; + if(typeof timeOfDay === 'undefined') { + return; + } + if (timeOfDay > 23100 || timeOfDay < 12900) { //day mode let movedTime = timeOfDay + 900; diff --git a/src/store/getters.ts b/src/store/getters.ts index bf3edcb..8bb5bad 100644 --- a/src/store/getters.ts +++ b/src/store/getters.ts @@ -53,7 +53,7 @@ export const getters: GetterTree & Getters = { }, night(state: State): boolean { - return getMinecraftTime(state.currentWorldState.timeOfDay).night; + return getMinecraftTime(state.currentWorldState.timeOfDay || 0).night; }, mapBackground(state: State): string { @@ -62,7 +62,7 @@ export const getters: GetterTree & Getters = { } if(state.currentMap.nightAndDay) { - if(getMinecraftTime(state.currentWorldState.timeOfDay).night) { + if(getMinecraftTime(state.currentWorldState.timeOfDay || 0).night) { return state.currentMap.backgroundNight || state.currentMap.background || 'transparent'; } diff --git a/test/components/PlayerImage.test.ts b/test/components/PlayerImage.test.ts index 91f6bbe..9ff4616 100644 --- a/test/components/PlayerImage.test.ts +++ b/test/components/PlayerImage.test.ts @@ -15,7 +15,7 @@ */ import { mount } from '@vue/test-utils'; -import PlayerImage from '../../src/Components/PlayerImage.vue'; +import PlayerImage from '../../src/components/PlayerImage.vue'; import {getDefaultPlayerImage, getPlayerImage} from "@/util/images"; import {useTestImageProvider} from "../helpers"; diff --git a/test/components/Sidebar.test.ts b/test/components/Sidebar.test.ts index 35c451e..496e299 100644 --- a/test/components/Sidebar.test.ts +++ b/test/components/Sidebar.test.ts @@ -16,7 +16,7 @@ // @vitest-environment jsdom import {mount, VueWrapper} from '@vue/test-utils'; -import Sidebar from '../../src/Components/Sidebar.vue'; +import Sidebar from '../../src/components/Sidebar.vue'; import {addDynmapServer, addWorld, clearServers, clearWorlds, enablePlayerMarkers} from "../helpers"; import {nextTick} from "vue"; import {useStore} from "@/store"; diff --git a/test/components/SvgIcon.test.ts b/test/components/SvgIcon.test.ts index a27925d..8a05df9 100644 --- a/test/components/SvgIcon.test.ts +++ b/test/components/SvgIcon.test.ts @@ -15,7 +15,7 @@ */ import { mount } from '@vue/test-utils'; -import SVGIcon from '../../src/Components/SVGIcon.vue'; +import SVGIcon from '../../src/components/SvgIcon.vue'; describe('SVGIcon', async () => { it('exists', () => { diff --git a/tsconfig.json b/tsconfig.json index ca0f2b9..bbe42d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,8 @@ "baseUrl": ".", "types": [ "vite/client", - "vue" + "vue", + "vitest/globals" ], "paths": { "@/*": [