From 166576ab4dc4361e77433b12c77abb41a4239714 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Tue, 8 Oct 2019 18:50:46 -0400 Subject: [PATCH] Add more almanac display --- Display/package-lock.json | 13 ++++++ Display/package.json | 2 + .../components/laundry/laundry.component.scss | 2 +- .../weather/almanac/almanac.component.html | 41 +++++++++++++++--- .../weather/almanac/almanac.component.scss | 11 ++++- .../weather/almanac/almanac.component.ts | 33 +++++++++++++- .../current/weather-current.component.scss | 2 +- Display/src/assets/moon_phases.ttf | Bin 0 -> 19632 bytes Display/src/styles.scss | 5 +++ 9 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 Display/src/assets/moon_phases.ttf diff --git a/Display/package-lock.json b/Display/package-lock.json index 16d717f..62d57be 100644 --- a/Display/package-lock.json +++ b/Display/package-lock.json @@ -1943,6 +1943,14 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, + "@types/moment-duration-format": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@types/moment-duration-format/-/moment-duration-format-2.2.2.tgz", + "integrity": "sha512-CuYswsMI3y5uR5sD9i/VUqIbZrsYN2eaCs7nH3qpDl2CZlNI48mjMf4ve2RpQ/65irprtnQVetfnea9my+jqcg==", + "requires": { + "moment": ">=2.14.0" + } + }, "@types/node": { "version": "8.9.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.5.tgz", @@ -7816,6 +7824,11 @@ "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, + "moment-duration-format": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/moment-duration-format/-/moment-duration-format-2.3.2.tgz", + "integrity": "sha512-cBMXjSW+fjOb4tyaVHuaVE/A5TqkukDWiOfxxAjY+PEqmmBQlLwn+8OzwPiG3brouXKY5Un4pBjAeB6UToXHaQ==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/Display/package.json b/Display/package.json index 1cef08a..77762bc 100644 --- a/Display/package.json +++ b/Display/package.json @@ -23,6 +23,7 @@ "@angular/platform-browser-dynamic": "~8.2.4", "@angular/router": "~8.2.4", "@aspnet/signalr": "^1.1.4", + "@types/moment-duration-format": "^2.2.2", "@types/regression": "^2.0.0", "@types/suncalc": "^1.8.0", "angular-gridster2": "^8.2.0", @@ -30,6 +31,7 @@ "hammerjs": "^2.0.8", "highcharts": "^7.2.0", "moment": "^2.24.0", + "moment-duration-format": "^2.3.2", "ngx-moment": "^3.4.0", "ngx-socket-io": "^3.0.1", "regression": "^2.0.1", diff --git a/Display/src/app/components/laundry/laundry.component.scss b/Display/src/app/components/laundry/laundry.component.scss index 344b5d1..e8d5a3e 100644 --- a/Display/src/app/components/laundry/laundry.component.scss +++ b/Display/src/app/components/laundry/laundry.component.scss @@ -1,6 +1,6 @@ .laundry-current { font-size: 14px; - padding: 20px; + padding: 10px; } .laundry-current-header { diff --git a/Display/src/app/components/weather/almanac/almanac.component.html b/Display/src/app/components/weather/almanac/almanac.component.html index 89820bf..1dc51f6 100644 --- a/Display/src/app/components/weather/almanac/almanac.component.html +++ b/Display/src/app/components/weather/almanac/almanac.component.html @@ -8,16 +8,40 @@ Sunrise - - {{ sun.sunrise | amLocal | amDateFormat: 'hh:mm:ss A' }} + + {{ sunTimes.sunrise | amLocal | amDateFormat: 'hh:mm:ss A' }} Sunset - - {{ sun.sunset | amLocal | amDateFormat: 'hh:mm:ss A' }} + + {{ sunTimes.sunset | amLocal | amDateFormat: 'hh:mm:ss A' }} + + + + + Day length + + + {{ dayLength() }} + + + + + Moonrise + + + {{ moonTimes.rise | amLocal | amDateFormat: 'hh:mm:ss A' }} + + + + + Moonset + + + {{ moonTimes.set | amLocal | amDateFormat: 'hh:mm:ss A' }} @@ -25,7 +49,14 @@ Moon - {{ moonPhaseName(moon.phase) }} - {{ (moon.fraction * 100).toFixed(0) }}% illuminated + {{ moonPhaseName(moon.phase) }} +
+ {{ (moon.fraction * 100).toFixed(1) }}% illuminated + + +
+ {{ moonPhaseLetter(moon.phase) }} +
diff --git a/Display/src/app/components/weather/almanac/almanac.component.scss b/Display/src/app/components/weather/almanac/almanac.component.scss index f84143d..25be179 100644 --- a/Display/src/app/components/weather/almanac/almanac.component.scss +++ b/Display/src/app/components/weather/almanac/almanac.component.scss @@ -1,10 +1,19 @@ .almanac-content { font-size: 14px; - padding: 20px; + padding: 10px; } .almanac-table-header { font-weight: 500; text-align: right; padding-right: 10px; + white-space: nowrap; +} + +.moon-phase { + font-family: moon; + font-size: 28px; + margin-left: 10px; + display: block; + margin-top: 1px; } diff --git a/Display/src/app/components/weather/almanac/almanac.component.ts b/Display/src/app/components/weather/almanac/almanac.component.ts index b9f6adc..251028d 100644 --- a/Display/src/app/components/weather/almanac/almanac.component.ts +++ b/Display/src/app/components/weather/almanac/almanac.component.ts @@ -4,6 +4,8 @@ import { WeatherService } from 'src/app/services/weather/weather.service'; import { first } from 'rxjs/operators'; import * as SunCalc from 'suncalc'; +import * as moment from 'moment'; +import 'moment-duration-format'; @Component({ selector: 'app-almanac', @@ -13,7 +15,8 @@ import * as SunCalc from 'suncalc'; export class AlmanacComponent implements OnInit { public loaded = false; public latestReading: WeatherReading; - public sun: SunCalc.GetTimesResult; + public sunTimes: SunCalc.GetTimesResult; + public moonTimes: SunCalc.GetMoonTimes; public moon: SunCalc.GetMoonIlluminationResult; constructor(private weatherService: WeatherService) { } @@ -30,7 +33,8 @@ export class AlmanacComponent implements OnInit { const date = new Date(); - this.sun = SunCalc.getTimes(date, this.latestReading.Latitude, this.latestReading.Longitude); + this.sunTimes = SunCalc.getTimes(date, this.latestReading.Latitude, this.latestReading.Longitude); + this.moonTimes = SunCalc.getMoonTimes(date, this.latestReading.Latitude, this.latestReading.Longitude); this.moon = SunCalc.getMoonIllumination(date); this.loaded = true; @@ -56,4 +60,29 @@ export class AlmanacComponent implements OnInit { return 'Waning Crescent'; } } + + moonPhaseLetter(phase: number): string { + if (phase === 0) { + return '0'; + } else if (phase < 0.25) { + return 'D'; + } else if (phase === 0.25) { + return 'G'; + } else if (phase < 0.5) { + return 'I'; + } else if (phase === 0.5) { + return '1'; + } else if (phase < 0.75) { + return 'Q'; + } else if (phase === 0.75) { + return 'T'; + } else if (phase < 1.0) { + return 'W'; + } + } + + dayLength(): string { + const duration = moment.duration((this.sunTimes.sunset.valueOf() - this.sunTimes.sunrise.valueOf())); + return duration.format('hh [hours] mm [minutes]'); + } } diff --git a/Display/src/app/components/weather/current/weather-current.component.scss b/Display/src/app/components/weather/current/weather-current.component.scss index 969a580..479bfe1 100644 --- a/Display/src/app/components/weather/current/weather-current.component.scss +++ b/Display/src/app/components/weather/current/weather-current.component.scss @@ -1,6 +1,6 @@ .weather-current { font-size: 14px; - padding: 20px; + padding: 10px; } .weather-current-header { diff --git a/Display/src/assets/moon_phases.ttf b/Display/src/assets/moon_phases.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d0661f32f29be2c107e905fd69ac04b507f6d3de GIT binary patch literal 19632 zcmds937l0`{r{c2@Atm@)|odjZ)Si|U|^VGW>{oVHjx1l5N2FZgh5cYKurCsp`{ri zTA3EEspXO;nHiy}xLaDbXl7_?xm1>AS|~95zvsUD-n^N44;4tOb3ga{?)p2w^V`nv z-22WYMnoP!B5Iv8`|!&5mNXFwFX8B6N6sGF&}@!)mxx`2{S)U-oZfcc{EM(J_9K#C zTDW|{Dr<$ioyd6-_nf})^wTml5Lc3aFF;tl>g450+f~g(k%^$O=Hz8(E`IarW2WQ$ z14PX)Em^eujIH0SxP?eZ?egPGIuZ*IKy0c?k}Eo^^ntC1f&t1OYj8(!$Z4}Ng!G31Ng5@36$4x$t=!guCy}4@T zn$zY>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