Code cleanup #81
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
WIP
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: gorb/frontend#81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "temmie-random-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
wip: Various cleanup of code i've writtento Code cleanup@ -4,0 +6,4 @@
<div class="icons">
<RadioButtons
:text-strings="timeFormatTextStrings"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
This should use logical OR instead of the nullish coalescing operator. Logical OR checks for any falsy value, while NCO checks specifically for
null
orundefined
, so in this instance, iftimeFormat
is an empty string for some reason, it won't default to"Auto"
. Might as well fix it in this PR.would the logical or check be
||
?@ -4,0 +7,4 @@
<RadioButtons
:text-strings="timeFormatTextStrings"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
:callback="(index: number) => {settingSave('timeFormat', timeFormatTextStrings[index])}"
Add spaces between curly brackets and content
@ -32,1 +29,3 @@
defaultButton?.children.item(0)?.classList.add("selected-radio-button-radio")
// set the button based on key
if (props.defaultButtonKey != undefined) {
Is there a reason to check for undefined specifically rather than just doing
if (!props.defaultButtonKey)
?nope
@ -39,3 +49,4 @@
if (radioButtonsContainer.value) {
// remove selected-radio-button class from all buttons except the clicked one
const children = radioButtonsContainer.value.children
for (let i = 0; i < children.length; i++) {
I don't think there a reason for this to be kept as a
for
loop instead of afor...of
loopfor...of exists?!?!?!
@ -43,1 +53,3 @@
children.item(i)?.children.item(0)?.classList.remove("selected-radio-button-radio")
const button = children.item(i)
if (button) {
unSelectButton(button)
unselectButton
rather thanunSelectButton
@ -1,9 +1,9 @@
export default (): "12" | "24" => {
const format = settingsLoad().timeFormat?.format ?? "auto"
const format = settingsLoad().timeFormat ?? "Auto"
Again, should probably use logical OR
@ -16,3 +9,1 @@
currentStyle = `${baseURL}themes/style/dark.css`
}
}
let currentStyle = settingsLoad().selectedThemeStyle ?? (
Here too, logical OR is probably better
In the future, please don't include all changes made in response to a review as a singular commit.
@sauceyred wrote in #81 (comment):
yeahh, i just accidentally ran
git add .
and couldn't be bothered since it's 10 total lines in the grand scheme of things