Skip to content
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

Replace Select with Autocomplete with single Selects #1212

Merged
merged 13 commits into from
Mar 8, 2024

Conversation

jinzo
Copy link
Contributor

@jinzo jinzo commented Jan 19, 2024

As described in #1189 (comment) this is a new PR where I'm working on replacing all the single Select(s) with Autocomplete.
Currently in draft mode, as I'm not particularly happy how the SelectField change is implemented and I probably missed some Select(s)

@jinzo jinzo marked this pull request as ready for review January 22, 2024 14:23
@jinzo
Copy link
Contributor Author

jinzo commented Jan 22, 2024

So I reworked the option label, changed some more code to use SelectField.
Please check. Also - we are currently doing a little bit 'hacky' solution to support the onChange e.target.value - I would prefer changing this and passing the value directly, but on the other hand I will understand if you prefer that it stays like it currently is with "emulated" e.target.value.

modern/src/settings/GeofencePage.jsx Outdated Show resolved Hide resolved
modern/src/settings/PreferencesPage.jsx Outdated Show resolved Hide resolved
@jinzo
Copy link
Contributor Author

jinzo commented Mar 8, 2024

Any chance that this gets merged? Or what would need to be done to get it merged?

@tananaev
Copy link
Member

tananaev commented Mar 8, 2024

Is it ready for review?

@jinzo
Copy link
Contributor Author

jinzo commented Mar 8, 2024

I was under the impression that all of the review questions were addressed - I just synced and fixed (the new?) linting.
But yes, it is ready for further review - thanks!

<MenuItem key={keyGetter(item)} value={keyGetter(item)}>{titleGetter(item)}</MenuItem>
))}
</Select>
{multiple ? (
Copy link
Member

Choose a reason for hiding this comment

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

I think overall looks good. But I forgot now why are we not using Autocomplete for multi-select? It seems like it would be the most valuable there actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I agree, but I did not find an easy way to make it work/look 'properly' - that's why I split it up in two and first implemented single select.
The problem is that the MUI Autocomplete component when using multiple values 'adds' another row in the Input field and that does not look that good - see this comment for the image: #1189 (comment)
The idea was to move the actual 'search input' into the drop down list instead of growing the original input to 2 lines (so the original input would only contain selected values), like select2 does for example - but I did not find a sane/easy way of doing that at the time. So the decision was made to first do it for single select, get that merged so it makes my life easier with my big lists, then tackle the multi usecase later.

@tananaev tananaev merged commit 5b1c766 into traccar:master Mar 8, 2024
1 check passed
@tananaev
Copy link
Member

tananaev commented Mar 8, 2024

OK, let's merge this for now. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants