From d70c4143f83ff6a621be869d770b6c27c91342ba Mon Sep 17 00:00:00 2001 From: punkfairie Date: Mon, 8 May 2023 19:13:30 -0700 Subject: [PATCH] finish formatting bodies --- index.html | 48 ++++++++++++++++++++++++++++++++++-------- src/index.css | 4 ++++ src/interfaces/Body.js | 12 +++++++++++ src/renderer.js | 6 +++--- 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index fd1cf52..698da49 100644 --- a/index.html +++ b/index.html @@ -54,31 +54,61 @@
-
+
- {{ body.BodyName.replace(body.StarSystem, '') }} + {{ body.simpleName() }}
+ + + + {{ body.PlanetClass || body.StarType || '' }}
- {{ Intl.NumberFormat().format(Math.round(body.DistanceFromArrivalLS)) }} + {{ body.distance() }}
-
+
+ + + +
diff --git a/src/index.css b/src/index.css index 8c2bb88..de5bb08 100644 --- a/src/index.css +++ b/src/index.css @@ -14,6 +14,10 @@ body { text-transform: uppercase; } +.opacity-0 { + opacity: 0; +} + .system { margin-top: 1px; margin-bottom: 1px; diff --git a/src/interfaces/Body.js b/src/interfaces/Body.js index b7ceb53..49f6f8e 100644 --- a/src/interfaces/Body.js +++ b/src/interfaces/Body.js @@ -5,7 +5,19 @@ export class Body { return this.BodyName.includes('Belt') } + isPlanet() { + return !!this.PlanetClass + } + + isStar() { + return !!this.StarType + } + simpleName() { return this.BodyName.replace(this.StarSystem, '') } + + distance() { + return Intl.NumberFormat().format(Math.round(this.DistanceFromArrivalLS)) + } } \ No newline at end of file diff --git a/src/renderer.js b/src/renderer.js index 31c5f36..713d6fb 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -54,15 +54,15 @@ createApp({ journal.watchJournal() const currentLocation = ref('Unknown') - const currentSystemBodies = ref([]) + const currentLocationBodies = ref([]) journal.on('FSDJump', () => currentLocation.value = journal.currentLocation) - journal.on('SCANNED_BODIES_FOUND', () => currentSystemBodies.value = journal.currentLocation.bodies) + journal.on('SCANNED_BODIES_FOUND', () => currentLocationBodies.value = journal.currentLocation.bodies) return { currentLocation, - currentSystemBodies, + currentLocationBodies, } } }).mount('#app')