-
Notifications
You must be signed in to change notification settings - Fork 228
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
WIP: CharacterSelectionModal refactoring and followup changes for single selection #2473
base: master
Are you sure you want to change the base?
Conversation
…; selected teammates pinned to the top for single select; indicator for which slot is being selected WIP
…from the character page locally
[frontend] [Tue Oct 1 23:08:31 UTC 2024] - Deployed e7206b7 to https://genshin-optimizer-prs.github.io/pr/2473/frontend (Takes 3-5 minutes after this completes to be available) [frontend] [Sun Oct 6 21:21:44 UTC 2024] - Deployed a31f408 to https://genshin-optimizer-prs.github.io/pr/2473/frontend (Takes 3-5 minutes after this completes to be available) [frontend] [Mon Oct 7 09:54:56 UTC 2024] - Deployed 7cfdce1 to https://genshin-optimizer-prs.github.io/pr/2473/frontend (Takes 3-5 minutes after this completes to be available) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before you go too far with this, I do not think it is a good idea to merge the logic of 2 elements with two different usecases, since that makes the core code path more complicated and harder to maintain. If you want to reduce duplication of code, hoist out the common elements into their separate function/element.
Honestly I was kind of wondering whether to split this back up into a regular |
Yeah I understand your concern, In this case, I think you should still have some division of components: SingleSelect(4 selected, currentlySelected, onSelect)
MultiSelect(4 selected, onSelectTeam)store 4 selected state locally(for quick selection + save)
This should make sure that each component only does one thing with one unique state each, instead of a super component that does 2 things in different states depending on usecase |
…ect and multi select modal with shared code in a base component; Moved some of SelectionCard code out into to separate wrappers for single and multi select containing the tooltip, fav toggles, and outlines/team slot number chips
Trying one more approach based on your suggestion before I throw in the towel and deal with all the duplicated code: I split out some of the shared modal code out into a Also I'm not sure what the types on the props for the |
Describe your changes (WIP!)
Refactoring for
CharacterSelectionModal.tsx
andCharacterMultiSelectionModal.tsx
:loadoutData
to be passed in externally (or defaulted to an array ofundefined
s) in place ofteamId
- This value already exists when accessing character selection from any Teams page but does not exist (and neither doesteamId
) when accessed from the Characters page.loadoutData
is only used to initializeteamCharKeys
andcachedTeamCharKeys
. This change ensures the modal can be accessed from both locations.CharacterMultiSelectionModal.tsx
as a result of these changesSingle character selection in
CharacterSelectionModal.tsx
:Current TODOs:
Issue or discord link
Testing/validation
Will add when ready for final review
Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)
yarn run mini-ci
locally to validate format and lint.