Update TeamAccountsModal to include selected account prop and improve account switching (#142)
This commit is contained in:
committed by
GitHub
parent
3c1abbc453
commit
6127fe957c
@@ -75,7 +75,11 @@ export const TeamAccountLayoutMobileNavigation = (
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
|
||||||
<DropdownMenuContent sideOffset={10} className={'w-screen rounded-none'}>
|
<DropdownMenuContent sideOffset={10} className={'w-screen rounded-none'}>
|
||||||
<TeamAccountsModal userId={props.userId} accounts={props.accounts} />
|
<TeamAccountsModal
|
||||||
|
userId={props.userId}
|
||||||
|
accounts={props.accounts}
|
||||||
|
account={props.account}
|
||||||
|
/>
|
||||||
|
|
||||||
{Links}
|
{Links}
|
||||||
|
|
||||||
@@ -129,7 +133,11 @@ function SignOutDropdownItem(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TeamAccountsModal(props: { accounts: Accounts; userId: string }) {
|
function TeamAccountsModal(props: {
|
||||||
|
accounts: Accounts;
|
||||||
|
userId: string;
|
||||||
|
account: string;
|
||||||
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -159,6 +167,9 @@ function TeamAccountsModal(props: { accounts: Accounts; userId: string }) {
|
|||||||
className={'w-full max-w-full'}
|
className={'w-full max-w-full'}
|
||||||
collisionPadding={0}
|
collisionPadding={0}
|
||||||
userId={props.userId}
|
userId={props.userId}
|
||||||
|
accounts={props.accounts}
|
||||||
|
features={features}
|
||||||
|
selectedAccount={props.account}
|
||||||
onAccountChange={(value) => {
|
onAccountChange={(value) => {
|
||||||
const path = value
|
const path = value
|
||||||
? pathsConfig.app.accountHome.replace('[account]', value)
|
? pathsConfig.app.accountHome.replace('[account]', value)
|
||||||
@@ -166,8 +177,6 @@ function TeamAccountsModal(props: { accounts: Accounts; userId: string }) {
|
|||||||
|
|
||||||
router.replace(path);
|
router.replace(path);
|
||||||
}}
|
}}
|
||||||
accounts={props.accounts}
|
|
||||||
features={features}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user