Skip to content

Conversation

opudrovs
Copy link
Contributor

@opudrovs opudrovs commented Oct 26, 2022

Closes #2870

  • Added type bootstrapWizardInput and related types.

  • Replaced text fields with checkboxes for Boolean values in the bootstrap wizard. Checkboxes can be toggles with the Space key when focused.

  • Minor refactoring:
    -- added local variables for input lookup (input := inputs[i]) for readability
    -- removed unnecessary copying of styles. I previously copied it from Bubble Tea examples, so I'm not sure why style.Copy() was used not only when creating new styles based on old styles but also when just rendering elements with in this style. So, removed it and tested it locally, it seems to work fine without the redundant copying. If anything goes wrong, we can always put it back, but it should work fine.

Questions:

  • Maybe some type names could be shorter? But they were clashing with some other names or reserved words or didn't informative enough.

Checkbox toggled with space:

Screenshot 2022-10-26 at 13 39 14

Greyed out underscore marks false value. The color of the underscore can be changed or or the underscore can be removed easily if needed.

Focuses checkbox with true value + unfocused checkbox:

Screenshot 2022-10-26 at 13 39 21

Screenshot 2022-10-26 at 13 39 33

@opudrovs opudrovs added team/denim bug Something isn't working labels Oct 26, 2022
@opudrovs opudrovs force-pushed the 2870-replace-text-inputs-with-checkboxes-in-bootstrap-wizard-ui branch 4 times, most recently from 79b4471 to e21e63d Compare October 26, 2022 11:52
@opudrovs opudrovs changed the title Add type bootstrapWizardInput and related types. Replace text inputs with checkboxes in the bootstrap wizard UI Oct 26, 2022
@opudrovs opudrovs force-pushed the 2870-replace-text-inputs-with-checkboxes-in-bootstrap-wizard-ui branch from e21e63d to 29eee0e Compare October 26, 2022 12:21
Replace text fields with checkboxes for Boolean values in the bootstrap wizard.

Add local variables for input lookup.

Removed unnecessary copying of styles.
@opudrovs opudrovs force-pushed the 2870-replace-text-inputs-with-checkboxes-in-bootstrap-wizard-ui branch from 29eee0e to 713aeb1 Compare October 26, 2022 12:23
@opudrovs opudrovs marked this pull request as ready for review October 26, 2022 12:40
@opudrovs opudrovs requested a review from a team October 26, 2022 12:40
@opudrovs opudrovs added type/enhancement New feature or request and removed bug Something isn't working labels Oct 26, 2022
@opudrovs
Copy link
Contributor Author

opudrovs commented Oct 26, 2022

Tested that params are built properly with checkboxes.

params:
{1 map[branch:master hostname:github.com owner:stefanprodan pat:123 personal:true private:false repository:podinfo]}

Comment on lines 453 to 454
for i := range m.inputs {
input := m.inputs[i]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡

Suggested change
for i := range m.inputs {
input := m.inputs[i]
for i, input := range m.inputs {

There's a few other for loops that can be simplified by just grabbing the second argument from range.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! JS habits die hard. 🤣

Copy link
Contributor Author

@opudrovs opudrovs Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the loops.

}

return ti
return fmt.Sprintf("%s%s%s", open, checkmark, close)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Could we maybe add the placeholder value here? When I see a line just saying [x] I panic that I don't know what it's asking me to do and refuse to read the help text above until I've figured it out, whereas [x] private would calm me down enough to pay attention.

Copy link
Contributor Author

@opudrovs opudrovs Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added checkbox placeholders.

@opudrovs opudrovs merged commit 2ca4d6f into main Oct 27, 2022
@opudrovs opudrovs deleted the 2870-replace-text-inputs-with-checkboxes-in-bootstrap-wizard-ui branch October 27, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace text inputs with checkboxes in the bootstrap wizard UI
2 participants