-
Notifications
You must be signed in to change notification settings - Fork 786
Add map picker with Featured/All tabs #3005
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
base: main
Are you sure you want to change the base?
Conversation
|
|
WalkthroughThis change introduces a new map-picker component to improve map selection UI in lobby creation flows. The featured maps constant defines a curated set of commonly-used maps, while the MapPicker component provides a tabbed interface showing featured maps first with all maps available on a secondary tab. Existing modals are refactored to use this centralized picker instead of inline map selection logic. Changes
Sequence DiagramsequenceDiagram
actor User
participant Modal as HostLobbyModal/<br/>SinglePlayerModal
participant Picker as MapPicker
participant Display as MapDisplay
participant State as Component State
User->>Modal: Open modal
Modal->>Picker: Render with selectedMap, mapWins
alt User clicks Featured tab
Picker->>Picker: Show featured maps (filtered from Game.featuredMaps)
else User clicks All tab
Picker->>Picker: Show all maps by category
end
User->>Picker: Click map card
Picker->>Display: Render map with selection state
Picker->>Picker: handleMapSelection(mapValue)
Picker->>Modal: onSelectMap callback
Modal->>State: Update selectedMap
alt User clicks Random map
User->>Picker: Click random tile
Picker->>Picker: handleSelectRandomMap()
Picker->>Modal: onSelectRandom callback
Modal->>State: Update useRandomMap = true
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
maybe instead of tabs, I think a collapsable section might be better ux? |
|
There could be a point where we just make a "popup" modal which is a much wider screen, where all the maps more easily shown, but I quite like the unified modals we have now |
|
@evanpelle I initially implemented this as a collapsible section, but it felt a bit awkward in practice:
By clearly separating them into “All” and “Recommended” tabs, I was aiming to make the structure more explicit and easier to understand at a glance. That said, I’m still open to changing it if you feel a collapsible section would work better overall. Sorry if my wording isn’t perfectly clear — I used a translation tool, so some of the nuance might not have come through as intended. |
Resolves #2996
Description:
Replace map selection UI in src/client/SinglePlayerModal.ts and src/client/HostLobbyModal.ts with the picker (Featured/All tabs + random map card).
Also, since the html was getting quite long, I extracted the shared parts into a separate component.
I separated Map.ts because the display logic looked reusable in other places, but I’m also open to merging it back if that makes more sense.
If the review prefers it integrated, I can combine them again.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
aotumuri