Gerben321 / bike-care-tracker

Issue/Suggestion tracker for Bike Care app
3 stars 0 forks source link

Suggest an exisiting bike by default when there is only one bike available #27

Open OleksiyRudenko opened 3 months ago

OleksiyRudenko commented 3 months ago

Is your feature request related to a problem? Please describe. When I've got a single bike there is no much point to make a choice when there is only 1 option available.

Describe the solution you'd like Set the option as selected and the UI widget disabled=true (this will actually visually denote there are no other options to pick among). This could be possibly done not only for bikes selection but for any other drop-down lists that offer one option only, hence as a part of the UI component rendering business logic.

Describe alternatives you've considered None

Additional context image image

Gerben321 commented 3 months ago

That's a good one! Most people probably only have one bike so it makes sense to preselect that then. I'll have a look to see if I can do that globally indeed.

Gerben321 commented 2 months ago

I'm fiddling around with this. There's no way to globally do this as far as I can see, but I can try to write some Javascript to apply it to all dropdowns with only one option. But this will be a bit lower priority for me because there's other way cooler things like NFC and QR codes etc. 😋

OleksiyRudenko commented 2 months ago

I can imagine the BE populates drop down's options before serving them to FE. This means that options generator knows how many options are available to it. So the generator could set attributes SELECTED and DISABLED to this only option.

Gerben321 commented 2 months ago

That's right. However it's not as simple as it sounds and I would like it to be fixed in an abstract and good way. But I think I've got a good lead on how to solve it properly.