Update 'next' package version and refactor user account handling
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.
This commit is contained in:
@@ -8,7 +8,6 @@ import featureFlagsConfig from '~/config/feature-flags.config';
|
|||||||
import pathsConfig from '~/config/paths.config';
|
import pathsConfig from '~/config/paths.config';
|
||||||
|
|
||||||
const features = {
|
const features = {
|
||||||
enableTeamAccounts: featureFlagsConfig.enableTeamAccounts,
|
|
||||||
enableTeamCreation: featureFlagsConfig.enableTeamCreation,
|
enableTeamCreation: featureFlagsConfig.enableTeamCreation,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import { use } from 'react';
|
|||||||
|
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
|
import { If } from '@kit/ui/if';
|
||||||
import { Sidebar, SidebarContent, SidebarNavigation } from '@kit/ui/sidebar';
|
import { Sidebar, SidebarContent, SidebarNavigation } from '@kit/ui/sidebar';
|
||||||
|
|
||||||
|
import { AppLogo } from '~/components/app-logo';
|
||||||
|
import featuresFlagConfig from '~/config/feature-flags.config';
|
||||||
import { personalAccountSidebarConfig } from '~/config/personal-account-sidebar.config';
|
import { personalAccountSidebarConfig } from '~/config/personal-account-sidebar.config';
|
||||||
|
|
||||||
// home imports
|
// home imports
|
||||||
@@ -18,7 +21,15 @@ export function HomeSidebar() {
|
|||||||
return (
|
return (
|
||||||
<Sidebar collapsed={collapsed}>
|
<Sidebar collapsed={collapsed}>
|
||||||
<SidebarContent className={'my-4'}>
|
<SidebarContent className={'my-4'}>
|
||||||
<HomeSidebarAccountSelector collapsed={collapsed} accounts={accounts} />
|
<If
|
||||||
|
condition={featuresFlagConfig.enableTeamAccounts}
|
||||||
|
fallback={<AppLogo className={'py-2'} />}
|
||||||
|
>
|
||||||
|
<HomeSidebarAccountSelector
|
||||||
|
collapsed={collapsed}
|
||||||
|
accounts={accounts}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
|
|
||||||
<SidebarContent className={`h-[calc(100%-160px)] overflow-y-auto`}>
|
<SidebarContent className={`h-[calc(100%-160px)] overflow-y-auto`}>
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ import { cache } from 'react';
|
|||||||
|
|
||||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||||
|
|
||||||
|
import featureFlagsConfig from '~/config/feature-flags.config';
|
||||||
import { Database } from '~/lib/database.types';
|
import { Database } from '~/lib/database.types';
|
||||||
|
|
||||||
export const loadUserWorkspace = cache(async () => {
|
export const loadUserWorkspace = cache(async () => {
|
||||||
const client = getSupabaseServerComponentClient();
|
const client = getSupabaseServerComponentClient();
|
||||||
|
const loadAccounts = featureFlagsConfig.enableTeamAccounts;
|
||||||
|
|
||||||
const accounts = await loadUserAccounts(client);
|
const accounts = loadAccounts ? await loadUserAccounts(client) : [];
|
||||||
const { data } = await client.auth.getSession();
|
const { data } = await client.auth.getSession();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
"i18next": "^23.11.1",
|
"i18next": "^23.11.1",
|
||||||
"i18next-resources-to-backend": "^1.2.1",
|
"i18next-resources-to-backend": "^1.2.1",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"next-sitemap": "^4.2.3",
|
"next-sitemap": "^4.2.3",
|
||||||
"next-themes": "0.3.0",
|
"next-themes": "0.3.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
"@types/react": "^18.2.77",
|
"@types/react": "^18.2.77",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-hook-form": "^7.51.3",
|
"react-hook-form": "^7.51.3",
|
||||||
"react-i18next": "^14.1.0",
|
"react-i18next": "^14.1.0",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
"@types/react": "^18.2.77",
|
"@types/react": "^18.2.77",
|
||||||
"@types/react-dom": "^18.2.25",
|
"@types/react-dom": "^18.2.25",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"next-themes": "0.3.0",
|
"next-themes": "0.3.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ interface AccountSelectorProps {
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
features: {
|
features: {
|
||||||
enableTeamAccounts: boolean;
|
|
||||||
enableTeamCreation: boolean;
|
enableTeamCreation: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,7 +49,6 @@ export function AccountSelector({
|
|||||||
selectedAccount,
|
selectedAccount,
|
||||||
onAccountChange,
|
onAccountChange,
|
||||||
features = {
|
features = {
|
||||||
enableTeamAccounts: true,
|
|
||||||
enableTeamCreation: true,
|
enableTeamCreation: true,
|
||||||
},
|
},
|
||||||
collapsed = false,
|
collapsed = false,
|
||||||
@@ -80,10 +78,6 @@ export function AccountSelector({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!features.enableTeamAccounts) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const selected = accounts.find((account) => account.value === value);
|
const selected = accounts.find((account) => account.value === value);
|
||||||
const pictureUrl = personalData.data?.picture_url;
|
const pictureUrl = personalData.data?.picture_url;
|
||||||
|
|
||||||
@@ -176,7 +170,6 @@ export function AccountSelector({
|
|||||||
|
|
||||||
<CommandSeparator />
|
<CommandSeparator />
|
||||||
|
|
||||||
<If condition={features.enableTeamAccounts}>
|
|
||||||
<If condition={accounts.length > 0}>
|
<If condition={accounts.length > 0}>
|
||||||
<CommandGroup
|
<CommandGroup
|
||||||
heading={
|
heading={
|
||||||
@@ -236,7 +229,6 @@ export function AccountSelector({
|
|||||||
))}
|
))}
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</If>
|
</If>
|
||||||
</If>
|
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command>
|
</Command>
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"@tanstack/react-table": "^8.16.0",
|
"@tanstack/react-table": "^8.16.0",
|
||||||
"@types/react": "^18.2.77",
|
"@types/react": "^18.2.77",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-hook-form": "^7.51.3",
|
"react-hook-form": "^7.51.3",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"@tanstack/react-query": "5.29.0",
|
"@tanstack/react-query": "5.29.0",
|
||||||
"@types/react": "^18.2.77",
|
"@types/react": "^18.2.77",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"react-hook-form": "^7.51.3",
|
"react-hook-form": "^7.51.3",
|
||||||
"react-i18next": "^14.1.0",
|
"react-i18next": "^14.1.0",
|
||||||
"sonner": "^1.4.41",
|
"sonner": "^1.4.41",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-hook-form": "^7.51.3",
|
"react-hook-form": "^7.51.3",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
"@kit/tailwind-config": "workspace:*",
|
"@kit/tailwind-config": "workspace:*",
|
||||||
"@kit/tsconfig": "workspace:*",
|
"@kit/tsconfig": "workspace:*",
|
||||||
"@supabase/supabase-js": "^2.42.3",
|
"@supabase/supabase-js": "^2.42.3",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"@supabase/supabase-js": "^2.42.3",
|
"@supabase/supabase-js": "^2.42.3",
|
||||||
"@tanstack/react-query": "5.29.0",
|
"@tanstack/react-query": "5.29.0",
|
||||||
"@types/react": "^18.2.77",
|
"@types/react": "^18.2.77",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"lucide-react": "^0.367.0",
|
"lucide-react": "^0.367.0",
|
||||||
"next": "14.2.0",
|
"next": "14.2.1",
|
||||||
"next-themes": "0.3.0",
|
"next-themes": "0.3.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"react-day-picker": "^8.10.0",
|
"react-day-picker": "^8.10.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user