Code cleanup #81

Merged
temmie merged 9 commits from temmie-random-cleanup into main 2025-08-15 12:23:25 +00:00
Owner
No description provided.
temmie added the
WIP
Priority
Low
Kind/Enhancement
labels 2025-08-11 02:31:05 +00:00
temmie self-assigned this 2025-08-11 02:31:05 +00:00
temmie added 2 commits 2025-08-11 02:31:06 +00:00
fix: bad layout link leading to settings menu crashing
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
e1f30ba9a8
temmie added 1 commit 2025-08-11 20:08:59 +00:00
feat: add support to select default radio button based on key
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
446038d37f
also simplifies the radio button code, making it easier to parse
temmie added 1 commit 2025-08-11 20:10:15 +00:00
style: indent a div
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ec5fca5d1b
temmie added 2 commits 2025-08-11 20:25:36 +00:00
refactor: move getDisplayAvatar into profile composable
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
10bf54b6fd
temmie added 1 commit 2025-08-11 20:43:47 +00:00
style: change about me rendering in profile modals
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
baff4de406
temmie changed title from wip: Various cleanup of code i've written to Code cleanup 2025-08-12 14:56:09 +00:00
temmie 2025-08-12 14:56:17 +00:00
  • removed the
    WIP
    label
  • requested review from sauceyred
sauceyred requested changes 2025-08-15 10:53:29 +00:00
Dismissed
@ -4,0 +6,4 @@
<div class="icons">
<RadioButtons
:text-strings="timeFormatTextStrings"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
Owner

This should use logical OR instead of the nullish coalescing operator. Logical OR checks for any falsy value, while NCO checks specifically for null or undefined, so in this instance, if timeFormat is an empty string for some reason, it won't default to "Auto". Might as well fix it in this PR.

This should use logical OR instead of the nullish coalescing operator. Logical OR checks for any falsy value, while NCO checks specifically for `null` or `undefined`, so in this instance, if `timeFormat` is an empty string for some reason, it won't default to `"Auto"`. Might as well fix it in this PR.
Author
Owner

would the logical or check be ||?

would the logical or check be `||`?
temmie marked this conversation as resolved
@ -4,0 +7,4 @@
<RadioButtons
:text-strings="timeFormatTextStrings"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
:callback="(index: number) => {settingSave('timeFormat', timeFormatTextStrings[index])}"
Owner

Add spaces between curly brackets and content

Add spaces between curly brackets and content
temmie marked this conversation as resolved
@ -32,1 +29,3 @@
defaultButton?.children.item(0)?.classList.add("selected-radio-button-radio")
// set the button based on key
if (props.defaultButtonKey != undefined) {
Owner

Is there a reason to check for undefined specifically rather than just doing if (!props.defaultButtonKey)?

Is there a reason to check for undefined specifically rather than just doing `if (!props.defaultButtonKey)`?
Author
Owner

nope

nope
temmie marked this conversation as resolved
@ -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++) {
Owner

I don't think there a reason for this to be kept as a for loop instead of a for...of loop

I don't think there a reason for this to be kept as a `for` loop instead of a `for...of` loop
Author
Owner

for...of exists?!?!?!

for...of exists?!?!?!
temmie marked this conversation as resolved
@ -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)
Owner

unselectButton rather than unSelectButton

`unselectButton` rather than `unSelectButton`
temmie marked this conversation as resolved
@ -1,9 +1,9 @@
export default (): "12" | "24" => {
const format = settingsLoad().timeFormat?.format ?? "auto"
const format = settingsLoad().timeFormat ?? "Auto"
Owner

Again, should probably use logical OR

Again, should probably use logical OR
temmie marked this conversation as resolved
@ -16,3 +9,1 @@
currentStyle = `${baseURL}themes/style/dark.css`
}
}
let currentStyle = settingsLoad().selectedThemeStyle ?? (
Owner

Here too, logical OR is probably better

Here too, logical OR is probably better
temmie marked this conversation as resolved
temmie added 1 commit 2025-08-15 11:05:46 +00:00
chore: review changes
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2da62b2e94
requested review from sauceyred 2025-08-15 11:05:54 +00:00
sauceyred approved these changes 2025-08-15 12:22:52 +00:00
temmie added 1 commit 2025-08-15 12:23:15 +00:00
Merge branch 'main' into temmie-random-cleanup
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ci/woodpecker/pull_request_closed/build-and-publish Pipeline was successful
3f7ceb94f5
temmie merged commit e702ac80eb into main 2025-08-15 12:23:25 +00:00
temmie deleted branch temmie-random-cleanup 2025-08-15 12:23:25 +00:00
Owner

In the future, please don't include all changes made in response to a review as a singular commit.

In the future, please don't include all changes made in response to a review as a singular commit.
Author
Owner

@sauceyred wrote in #81 (comment):

In the future, please don't include all changes made in response to a review as a singular commit.

yeahh, i just accidentally ran git add . and couldn't be bothered since it's 10 total lines in the grand scheme of things

@sauceyred wrote in https://git.gorb.app/gorb/frontend/pulls/81#issuecomment-1324: > In the future, please don't include all changes made in response to a review as a singular commit. yeahh, i just accidentally ran `git add .` and couldn't be bothered since it's 10 total lines in the grand scheme of things
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: gorb/frontend#81
No description provided.