fix up some things

This commit is contained in:
2024-07-14 23:45:26 +02:00
parent 0649004e51
commit 0ef5d72275
6 changed files with 22 additions and 14 deletions
+1
View File
@@ -56,6 +56,7 @@ export default defineComponent({
}
},
async mounted() {
this.eorzeaTime = new EorzeaTime();
setInterval(() => {
this.eorzeaTime = new EorzeaTime();
}, 500);
+12 -1
View File
@@ -1,5 +1,5 @@
<template>
<article class="node">
<article class="node" :class="{active: gatheringNode.isActive(eorzeaTime)}">
<div class="timer">
{{
gatheringNode.isActive(eorzeaTime) ? 'Active' : prettyTimer(gatheringNode.getSecondsToNextActiveTime(eorzeaTime))
@@ -73,6 +73,13 @@ export default defineComponent({
</script>
<style scoped lang="scss">
@keyframes pulsing {
0% {background-color: rgba(255,255,255, 0.05);}
50% {background-color: rgba(255,255,255, 0.075);}
100% {background-color: rgba(255,255,255, 0.05);}
}
.node {
display: flex;
flex-direction: row;
@@ -84,6 +91,10 @@ export default defineComponent({
padding: 0.5rem;
border-radius: 0.25rem;
&.active {
animation: infinite pulsing 6s;
}
.timer {
min-width: 7rem;
font-size: 2rem;
+7 -1
View File
@@ -42,6 +42,11 @@ export default defineComponent(
this.displayNodes = this.nodes;
}
},
displayNodes: {
handler() {
this.sortListByTime();
}
},
eorzeaTime: {
immediate: true,
handler(newValue, oldValue) {
@@ -64,8 +69,9 @@ export default defineComponent(
});
},
},
mounted() {
async mounted() {
this.displayNodes = this.nodes;
this.sortListByTime();
},
}
);
-11
View File
@@ -3,23 +3,12 @@ export default class Item {
readonly id: string;
readonly name: string;
readonly level: number;
readonly scripType: ScripType | null;
constructor(id: string, data: {[key: string]: number | string | undefined}) {
this.id = id;
this.name = data?.name as string;
this.level = data?.level as number;
const scripType: string | undefined = data?.scripType as string;
if (scripType != undefined) {
this.scripType = typeof data?.scripType === "string" ? scripType.toUpperCase() as ScripType : null;
} else {
this.scripType = null;
}
}
}
enum ScripType {
WHITE = 'white',
PURPLE = 'purple',
}
+1
View File
@@ -28,6 +28,7 @@ export default class Node {
this.times = times;
this.items = items;
this.nearestAetheryte = nearestAetheryte;
items.sort((a, b) => b.level - a.level);
}
isActive(eorzeaTime: EorzeaTime): boolean {