Don't switch tabs when creating a party

We changed the method in the New route to use the Next.js Router, which is causing us to navigate to the Party route and causing issues. This change makes it so that users stay on the same tab when they reach their destination.
This commit is contained in:
Justin Edmund 2023-01-30 23:09:37 -08:00
parent 37de3914f4
commit f0ba0d5eb3
2 changed files with 11 additions and 2 deletions

View file

@ -167,8 +167,18 @@ const Party = (props: Props) => {
storeWeapons(team.weapons)
storeSummons(team.summons)
// Create a string to send the user back to the tab they're currently on
let tab = ''
if (currentTab === GridType.Character) {
tab = 'characters'
} else if (currentTab === GridType.Summon) {
tab = 'summons'
}
// Then, push the browser history to the new party's URL
if (props.pushHistory) props.pushHistory(`/p/${team.shortcode}`)
if (props.pushHistory) {
props.pushHistory(`/p/${team.shortcode}/${tab}`)
}
return team
}

View file

@ -5,7 +5,6 @@ export enum ButtonType {
}
export enum GridType {
Class,
Character,
Weapon,
Summon,