mirror of
https://github.com/YouHaveTrouble/DiscipleOfLand.git
synced 2026-05-12 06:26:56 +00:00
install and configure eslint, bow before eslint
This commit is contained in:
+39
-38
@@ -1,17 +1,18 @@
|
||||
<template>
|
||||
<nav>
|
||||
<div class="current-eorzea-time">
|
||||
{{ eorzeaTime.getPrettyTime() }}
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
<SortedNodeList
|
||||
:nodes="nodes"
|
||||
<div>
|
||||
<nav>
|
||||
<div class="current-eorzea-time">
|
||||
{{ eorzeaTime.getPrettyTime() }}
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
<SortedNodeList
|
||||
:nodes="nodes as Node[]"
|
||||
:zones="zones"
|
||||
:eorzeaTime="eorzeaTime"
|
||||
/>
|
||||
</main>
|
||||
|
||||
:eorzea-time="eorzeaTime"
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -59,10 +60,10 @@ export default defineComponent({
|
||||
this.eorzeaTime = new EorzeaTime();
|
||||
}, 500);
|
||||
|
||||
const aetheryteData = await fetch("/data/aetherytes.json")
|
||||
.catch(() => {
|
||||
return null;
|
||||
});
|
||||
const aetheryteData: Response | null = await fetch("/data/aetherytes.json")
|
||||
.catch((): null => {
|
||||
return null;
|
||||
});
|
||||
if (aetheryteData === null) {
|
||||
console.error("Failed to fetch aetheryte data!")
|
||||
return;
|
||||
@@ -73,10 +74,10 @@ export default defineComponent({
|
||||
this.aetherytes.push(new Aetheryte(aetheryteData));
|
||||
}
|
||||
|
||||
const itemData = await fetch("/data/items.json")
|
||||
.catch(() => {
|
||||
return null;
|
||||
});
|
||||
const itemData: Response | null = await fetch("/data/items.json")
|
||||
.catch((): null => {
|
||||
return null;
|
||||
});
|
||||
if (itemData === null) {
|
||||
console.error("Failed to fetch item data!")
|
||||
return;
|
||||
@@ -88,10 +89,10 @@ export default defineComponent({
|
||||
this.items[itemId] = new Item(itemId, itemData);
|
||||
}
|
||||
|
||||
const zoneData = await fetch("/data/zones.json")
|
||||
.catch(() => {
|
||||
return null;
|
||||
});
|
||||
const zoneData: Response | null = await fetch("/data/zones.json")
|
||||
.catch((): null => {
|
||||
return null;
|
||||
});
|
||||
if (zoneData === null) {
|
||||
console.error("Failed to fetch zone data!")
|
||||
return;
|
||||
@@ -102,9 +103,9 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const nodeData = await fetch("/data/nodes.json")
|
||||
.catch(() => {
|
||||
return null;
|
||||
});
|
||||
.catch(() => {
|
||||
return null;
|
||||
});
|
||||
if (nodeData === null) {
|
||||
console.error("Failed to fetch node data!")
|
||||
return;
|
||||
@@ -133,10 +134,10 @@ export default defineComponent({
|
||||
const startTime = timeSplit[0].split(":");
|
||||
const endTime = timeSplit[1].split(":");
|
||||
times.push(new TimeRange(
|
||||
parseInt(startTime[0]),
|
||||
parseInt(startTime[1]),
|
||||
parseInt(endTime[0]),
|
||||
parseInt(endTime[1])
|
||||
parseInt(startTime[0]),
|
||||
parseInt(startTime[1]),
|
||||
parseInt(endTime[0]),
|
||||
parseInt(endTime[1])
|
||||
));
|
||||
}
|
||||
|
||||
@@ -144,13 +145,13 @@ export default defineComponent({
|
||||
if (nearestAetheryte === null) continue;
|
||||
|
||||
this.nodes.push(new Node(
|
||||
job,
|
||||
nodeType,
|
||||
nodeData.position,
|
||||
times,
|
||||
items,
|
||||
nearestAetheryte
|
||||
)
|
||||
job,
|
||||
nodeType,
|
||||
nodeData.position,
|
||||
times,
|
||||
items,
|
||||
nearestAetheryte
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,43 @@
|
||||
<template>
|
||||
<article class="node">
|
||||
<div class="timer">{{ gatheringNode.isActive(eorzeaTime) ? 'Active' : prettyTimer(gatheringNode.getSecondsToNextActiveTime(eorzeaTime)) }}</div>
|
||||
<div class="job">
|
||||
<div class="icon">
|
||||
<img
|
||||
<article class="node">
|
||||
<div class="timer">
|
||||
{{
|
||||
gatheringNode.isActive(eorzeaTime) ? 'Active' : prettyTimer(gatheringNode.getSecondsToNextActiveTime(eorzeaTime))
|
||||
}}
|
||||
</div>
|
||||
<div class="job">
|
||||
<div class="icon">
|
||||
<img
|
||||
:alt="gatheringNode.job"
|
||||
:src="`https://xivapi.com/cj/1/${gatheringNode.job}.png`"
|
||||
:title="gatheringNode.job"
|
||||
draggable="false"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="aetheryte">
|
||||
<span class="icon">
|
||||
<img
|
||||
src="https://xivapi.com/img-misc/mappy/aetheryte.png"
|
||||
alt="Aetheryte icon"
|
||||
draggable="false"
|
||||
>
|
||||
</span>
|
||||
<div class="info">
|
||||
<span>{{ zones[gatheringNode.nearestAetheryte.position.zone]?.name?.en }}</span>
|
||||
<span>{{ gatheringNode.nearestAetheryte.name.en }}</span>
|
||||
<span>{{ gatheringNode.nearestAetheryte.position.x }}, {{ gatheringNode.nearestAetheryte.position.y }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<span
|
||||
v-for="item in gatheringNode.items"
|
||||
:key="item.name"
|
||||
>
|
||||
{{ item.name }} (lv. {{ item.level }})
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="aetheryte">
|
||||
<span class="icon">
|
||||
<img src="https://xivapi.com/img-misc/mappy/aetheryte.png" alt="Aetheryte icon" draggable="false">
|
||||
</span>
|
||||
<div class="info">
|
||||
<span>{{ zones[gatheringNode.nearestAetheryte.position.zone]?.name?.en }}</span>
|
||||
<span>{{ gatheringNode.nearestAetheryte.name }}</span>
|
||||
<span>{{ gatheringNode.nearestAetheryte.position.x }}, {{ gatheringNode.nearestAetheryte.position.y }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<span v-for="item in gatheringNode.items">{{ item.name }} (lv. {{ item.level }})</span>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -71,6 +83,7 @@ export default defineComponent({
|
||||
border: 1px solid #fff;
|
||||
padding: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
|
||||
.timer {
|
||||
min-width: 7rem;
|
||||
font-size: 2rem;
|
||||
@@ -78,19 +91,23 @@ export default defineComponent({
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.job {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.aetheryte {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -100,15 +117,18 @@ export default defineComponent({
|
||||
font-size: 1.5rem;
|
||||
border-radius: 0.75rem;
|
||||
padding: 0.35rem 1rem;
|
||||
background-color: rgba(0,0,0, 0.2);
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
|
||||
.icon {
|
||||
width: 3rem;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -117,6 +137,7 @@ export default defineComponent({
|
||||
gap: 0.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<div class="node-list">
|
||||
<GatheringNode
|
||||
<div class="node-list">
|
||||
<GatheringNode
|
||||
v-for="node in displayNodes"
|
||||
:gathering-node="node"
|
||||
:eorzeaTime="eorzeaTime"
|
||||
:key="`${node.location.x}-${node.location.y}-${node.location.zone}`"
|
||||
:gathering-node="node as Node"
|
||||
:eorzea-time="eorzeaTime"
|
||||
:zones="zones"
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -17,56 +18,56 @@ import GatheringNode from "@/components/GatheringNode.vue";
|
||||
import Zone from "@/entities/Zone";
|
||||
|
||||
export default defineComponent(
|
||||
{
|
||||
name: "SortedNodeList",
|
||||
components: {GatheringNode},
|
||||
props: {
|
||||
nodes: {
|
||||
type: Array as PropType<Node[]>,
|
||||
required: true
|
||||
},
|
||||
eorzeaTime: {
|
||||
type: Object as PropType<EorzeaTime>,
|
||||
required: true
|
||||
},
|
||||
zones: {
|
||||
type: Object as PropType<{ [key: string]: Zone }>,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "SortedNodeList",
|
||||
components: {GatheringNode},
|
||||
props: {
|
||||
nodes: {
|
||||
type: Array as PropType<Node[]>,
|
||||
required: true
|
||||
},
|
||||
watch: {
|
||||
nodes: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.displayNodes = this.nodes;
|
||||
}
|
||||
},
|
||||
eorzeaTime: {
|
||||
immediate: true,
|
||||
handler(newValue, oldValue) {
|
||||
if (oldValue === undefined) return;
|
||||
if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
|
||||
this.sortListByTime();
|
||||
}
|
||||
eorzeaTime: {
|
||||
type: Object as PropType<EorzeaTime>,
|
||||
required: true
|
||||
},
|
||||
zones: {
|
||||
type: Object as PropType<{ [key: string]: Zone }>,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
nodes: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.displayNodes = this.nodes;
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
displayNodes: [] as Node[],
|
||||
}),
|
||||
methods: {
|
||||
sortListByTime() {
|
||||
this.displayNodes.sort((a, b) => {
|
||||
const aSeconds = a.getSecondsToNextActiveTime(this.eorzeaTime);
|
||||
const bSeconds = b.getSecondsToNextActiveTime(this.eorzeaTime);
|
||||
if (aSeconds === bSeconds) return a;
|
||||
return aSeconds - bSeconds;
|
||||
});
|
||||
},
|
||||
eorzeaTime: {
|
||||
immediate: true,
|
||||
handler(newValue, oldValue) {
|
||||
if (oldValue === undefined) return;
|
||||
if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
|
||||
this.sortListByTime();
|
||||
}
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
displayNodes: [] as Node[],
|
||||
}),
|
||||
methods: {
|
||||
sortListByTime() {
|
||||
this.displayNodes.sort((a, b): number => {
|
||||
const aSeconds = a.getSecondsToNextActiveTime(this.eorzeaTime);
|
||||
const bSeconds = b.getSecondsToNextActiveTime(this.eorzeaTime);
|
||||
if (aSeconds === bSeconds) return 1;
|
||||
return aSeconds - bSeconds;
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.displayNodes = this.nodes;
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.displayNodes = this.nodes;
|
||||
},
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ export default class Aetheryte {
|
||||
}
|
||||
|
||||
constructor(
|
||||
data: any,
|
||||
data: {position: {x: number, y: number, zone: string}, name: {en: string}}
|
||||
) {
|
||||
this.position = data.position;
|
||||
this.name = data.name.en;
|
||||
this.name = data.name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-5
@@ -3,13 +3,18 @@ export default class Item {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly level: number;
|
||||
readonly scripType: ScripType;
|
||||
readonly scripType: ScripType | null;
|
||||
|
||||
constructor(id: string, data: any) {
|
||||
constructor(id: string, data: {[key: string]: number | string | undefined}) {
|
||||
this.id = id;
|
||||
this.name = data?.name;
|
||||
this.level = data?.level;
|
||||
this.scripType = data?.scripType ? ScripType[data.scripType.toUpperCase()] : null;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Job} from "../enums/Job";
|
||||
import {NodeType} from "../enums/NodeType";
|
||||
import {Job} from "@/enums/Job";
|
||||
import {NodeType} from "@/enums/NodeType";
|
||||
import Item from "./Item";
|
||||
import Aetheryte from "./Aetheryte";
|
||||
import TimeRange from "./TimeRange";
|
||||
|
||||
@@ -4,8 +4,10 @@ export default class Zone {
|
||||
en: string,
|
||||
}
|
||||
|
||||
constructor(data: any) {
|
||||
this.name = data.name;
|
||||
constructor(data: {name: {en: string}}) {
|
||||
this.name = {
|
||||
en: data.name.en
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ export default class EorzeaTime {
|
||||
*/
|
||||
readonly eorzeaDate: Date;
|
||||
|
||||
private constructor(realDate: Date = new Date()) {
|
||||
public constructor(realDate: Date = new Date()) {
|
||||
this.realDate = realDate;
|
||||
this.eorzeaDate = new Date(realDate.getTime() * (3600 / 175));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user