decompme / decomp.me

Collaborative decompilation and reverse engineering website
https://decomp.me
MIT License
348 stars 108 forks source link

Remade Select 2 into a searchable select #1216

Closed conorgolden1 closed 2 months ago

conorgolden1 commented 2 months ago

filter.webm

This is for issue #1152

mkst commented 2 months ago

I think this could use a little more love - for example, the user can write/select a preset that doesn't exist, but it doesn't appear to clear the preset id.

conorgolden1 commented 2 months ago

Help me out here. How can the user write/select a preset that doesn't exist. Do you mean that the user should be able to directly write in their needed option and then it would set the preset id? I implemented the input element to be a search filter rather than something you can directly input your required option. Is that the functionality you are looking for?

mkst commented 2 months ago

I don't know whether it's just me on Chrome, but I can type anything into this box and navigate away, and it doesnt default back to e.g. Custom, or clear the preset id (just silently keeps the original value)

image

I just tried on my phone and it's the same - but I also noticed this (just set Chrome to phone mode on my laptop for the screenshot).. image

marijnvdwerf commented 2 months ago

Question, what dropdown really needs this? And can't we solve the problem by grouping instead? (e.g. by active/inactive projects).

Using an <optgroup>

image
<select id="dino-select">
    <optgroup label="Theropods">
        <option>Tyrannosaurus</option>
        <option>Velociraptor</option>
        <option>Deinonychus</option>
    </optgroup>
    <optgroup label="Sauropods">
        <option>Diplodocus</option>
        <option>Saltasaurus</option>
        <option>Apatosaurus</option>
    </optgroup>
</select>

Using a <hr>

image
<select id="dino-select">
    <option>Tyrannosaurus</option>
    <option>Velociraptor</option>
    <option>Deinonychus</option>
    <hr>
    <option>Diplodocus</option>
    <option>Saltasaurus</option>
    <option>Apatosaurus</option>
</select>
ethteck commented 2 months ago

Those changes to the compilers dropdown look good, though it'd take some backend modifications to group by category and send that info over with the compiler metadata. So I think that'd best be done in a future PR

As for the presets dropdown, I think having it searchable is totally ideal. There's so many active projects at any given point, and I also don't think it's our place to classify projects as active or inactive

ethteck commented 2 months ago

Okay I finally got around to testing this, sorry for the delay. It's looking good, but I'm seeing a few issues

ethteck commented 2 months ago

we may wanna use something like https://react-select.com/