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">
|
||||
<Link href="/new">
|
||||
<a onClick={(e: React.MouseEvent) => handleNewParty(e, '/new')}>
|
||||
New party
|
||||
{t('menu.new')}
|
||||
</a>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ export enum ButtonType {
|
|||
}
|
||||
|
||||
export enum GridType {
|
||||
Class,
|
||||
Character,
|
||||
Weapon,
|
||||
Summon,
|
||||
|
|
|
|||
Loading…
Reference in a new issue