Merge pull request #211 from jedmund/fix-195

Don't send users to weapons tab when creating a new party
This commit is contained in:
Justin Edmund 2023-01-30 23:11:42 -08:00 committed by GitHub
commit 714acbed35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -488,7 +488,7 @@ const Header = () => {
<DropdownMenuItem className="MenuItem">
<Link href="/new">
<a onClick={(e: React.MouseEvent) => handleNewParty(e, '/new')}>
New party
{t('menu.new')}
</a>
</Link>
</DropdownMenuItem>

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,