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:
commit
714acbed35
3 changed files with 12 additions and 3 deletions
|
|
@ -488,7 +488,7 @@ const Header = () => {
|
||||||
<DropdownMenuItem className="MenuItem">
|
<DropdownMenuItem className="MenuItem">
|
||||||
<Link href="/new">
|
<Link href="/new">
|
||||||
<a onClick={(e: React.MouseEvent) => handleNewParty(e, '/new')}>
|
<a onClick={(e: React.MouseEvent) => handleNewParty(e, '/new')}>
|
||||||
New party
|
{t('menu.new')}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,18 @@ const Party = (props: Props) => {
|
||||||
storeWeapons(team.weapons)
|
storeWeapons(team.weapons)
|
||||||
storeSummons(team.summons)
|
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
|
// 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
|
return team
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ export enum ButtonType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum GridType {
|
export enum GridType {
|
||||||
Class,
|
|
||||||
Character,
|
Character,
|
||||||
Weapon,
|
Weapon,
|
||||||
Summon,
|
Summon,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue