This commit updates the 'next' package from version 14.2.0 to 14.2.1 across various modules. It also refactors the code for user account handling to make it controlled by an enableTeamAccounts flag in the featureFlagsConfig, essentially allowing the enabling or disabling of the 'team accounts' feature according to the specified flag.
39 lines
867 B
TypeScript
39 lines
867 B
TypeScript
'use client';
|
|
|
|
import { useRouter } from 'next/navigation';
|
|
|
|
import { AccountSelector } from '@kit/accounts/account-selector';
|
|
|
|
import featureFlagsConfig from '~/config/feature-flags.config';
|
|
import pathsConfig from '~/config/paths.config';
|
|
|
|
const features = {
|
|
enableTeamCreation: featureFlagsConfig.enableTeamCreation,
|
|
};
|
|
|
|
export function HomeSidebarAccountSelector(props: {
|
|
accounts: Array<{
|
|
label: string | null;
|
|
value: string | null;
|
|
image: string | null;
|
|
}>;
|
|
|
|
collapsed: boolean;
|
|
}) {
|
|
const router = useRouter();
|
|
|
|
return (
|
|
<AccountSelector
|
|
collapsed={props.collapsed}
|
|
accounts={props.accounts}
|
|
features={features}
|
|
onAccountChange={(value) => {
|
|
if (value) {
|
|
const path = pathsConfig.app.accountHome.replace('[account]', value);
|
|
router.replace(path);
|
|
}
|
|
}}
|
|
/>
|
|
);
|
|
}
|