-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cosmetic] Weather module humidity positioning #3330
[cosmetic] Weather module humidity positioning #3330
Conversation
@khassel Sorry! I had based my branch against |
Also thanks from me for the PR. However I would propose to change it so that the position of the humidity is controlled via the showHumidity config parameter and not introduce a new one. For that showHumidty would be changed to a string (with options "below" and "besideTemp" (but those names are not optimal I think)) and a deprecation warning for the boolean value. See https://github.com/MagicMirrorOrg/MagicMirror/blob/8c0e7db494e86895a83a854cf1071c9057098ce3/modules/default/weather/weather.js#L82-88 for an ecample. |
Thanks, I like that idea. I'll have a think about how to express that. |
no, looks good so far (except one test) |
96a27c7
to
bab7477
Compare
OK, see what you think of this. (I have force-pushed this branch, I hope that the PR checks recognise that it is now based off of Of course there will be docs to update, if we get to the point where this PR is approved then I'll send a separate PR in that repo. |
test fails are unrelated to this PR, see #3291 |
e6d4005
to
c14c583
Compare
Rebased back onto tip of |
c14c583
to
5b01bba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a minor thing.
Also, would you be able to write a test for this?
c4062a9
to
945bae2
Compare
I've added a test now. I'm not sure how you feel about embedding a raw non-breaking-space character in the test string though? There might be a better way to do it, or maybe a tweak to the the template would leave things tidier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nearly there, good work nonetheless!
modules/default/weather/weather.js
Outdated
@@ -14,7 +14,7 @@ Module.register("weather", { | |||
updateInterval: 10 * 60 * 1000, // every 10 minutes | |||
animationSpeed: 1000, | |||
showFeelsLike: true, | |||
showHumidity: false, | |||
showHumidity: "false", // this is now a string; see current.njk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"false" as a string seems wrong. Maybe name that state "none", that is more in line with other hidden stuff (like in css).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "none".
modules/default/weather/weather.js
Outdated
@@ -80,6 +80,13 @@ Module.register("weather", { | |||
Log.warn("Your are using the deprecated config values 'useBeaufort'. Please switch to windUnits!"); | |||
this.windUnits = "beaufort"; | |||
} | |||
if (this.config.showHumidity === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe do a typeof checking if its a boolean. That way you dont need to write the Log warning twice.
And then set the value like
this.config.showHumidity = this.config.showHumidity ? "wind" : "none"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Supported positions: "wind" "temp" "feelslike" "below" "false" (where "false" means not displayed). We recognise true and false (boolean, unquoted) as legacy values and emit a deprecation warning. This also gives humidity its own css class, to allow for custom styling.
945bae2
to
43bc2d6
Compare
Replaced the embedded space with its escape string |
Thanks for the feedback! I'm more at home with C++ than I am with js, it probably shows... |
## [2.27.0] - 2024-04-01 Thanks to: @bugsounet, @crazyscot, @illimarkangur, @jkriegshauser, @khassel, @KristjanESPERANTO, @Paranoid93, @rejas, @sdetweil and @vppencilsharpener. This release marks the first release without Michael Teeuw (@MichMich). A very special thanks to him for creating MagicMirror and leading the project for so many years. For more info, please read the following post: [A New Chapter for MagicMirror: The Community Takes the Lead](https://forum.magicmirror.builders/topic/18329/a-new-chapter-for-magicmirror-the-community-takes-the-lead). ### Added - Output of system information to the console for troubleshooting (#3328 and #3337), ignore errors under aarch64 (#3349) - [chore] Add `eslint-plugin-package-json` to lint the `package.json` files (#3368) - [weather] `showHumidity` config is now a string describing where to show this element. Supported values: "wind", "temp", "feelslike", "below", "none". (#3330) - electron-rebuild test suite for electron and 3rd party modules compatibility (#3392) - Create MM² icon and attach it to electron process (#3407) ### Updated - Update updatenotification (update_helper.js): Recode with pm2 library (#3332) - Removing lodash dependency by replacing merge by spread operator (#3339) - Use node prefix for build-in modules (#3340) - Rework logging colors (#3350) - Update pm2 to v5.3.1 with no allow-ghsas (#3364) - [chore] Update husky and let lint-staged fix ESLint issues - [chore] Update dependencies including electron to v29 (#3357) and node-ical - Update translations for estonian (#3371) - Update electron to v29 and update other dependencies - [calendar] fullDay events over several days now show the left days from the first day on and 'today' on the last day - Update layout of current weather indoor values ### Fixed - Correct apibase of weathergov weatherprovider to match documentation (#2926) - Worked around several issues in the RRULE library that were causing deleted calender events to still show, some initial and recurring events to not show, and some event times to be off an hour. (#3291) - Skip changelog requirement when running tests for dependency updates (#3320) - Display precipitation probability when it is 0% instead of blank/empty (#3345) - [newsfeed] Suppress unsightly animation cases when there are 0 or 1 active news items (#3336) - [newsfeed] Always compute the feed item URL using the same helper function (#3336) - Ignore all custom css files (#3359) - [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361) - Changed `log.debug` to `log.log` in `app.js` where logLevel is not set because config is not loaded at this time (#3353) - [calendar] deny fetch interval < 60000 and set 60000 in this case (prevent fetch loop failed) (#3382) - added message in case where config.js is missing the module.export line PR #3383 - Fixed an issue where recurring events could extend past their recurrence end date (#3393) - Don't display any `npm WARN <....>` on install (#3399) - Fixed move suncalc dependency to production from dev, as it is used by clock module - [compliments] Fix mirror not responding anymore when no compliments are to be shown (#3385) ### Deleted - Unneeded file headers (#3358) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Michael Teeuw <michael@xonaymedia.nl> Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Karsten Hassel <hassel@gmx.de> Co-authored-by: Ross Younger <crazyscot@gmail.com> Co-authored-by: Bugsounet - Cédric <github@bugsounet.fr> Co-authored-by: jkriegshauser <joshuakr@nvidia.com> Co-authored-by: illimarkangur <116028111+illimarkangur@users.noreply.github.com> Co-authored-by: sam detweiler <sdetweil@gmail.com> Co-authored-by: vppencilsharpener <tim.pray@gmail.com> Co-authored-by: Paranoid93 <6515818+Paranoid93@users.noreply.github.com>
This PR adds an option to tweak the layout of the weather module. When set, the humidity appears alongside the temperature: