Revert "Unify workspace dropdowns; Update layouts (#458)"

This reverts commit 4bc8448a1d.
This commit is contained in:
gbuomprisco
2026-03-11 14:47:47 +08:00
parent 4bc8448a1d
commit 4912e402a3
530 changed files with 11182 additions and 14382 deletions

View File

@@ -1,4 +1,4 @@
import * as z from 'zod';
import { z } from 'zod';
const production = process.env.NODE_ENV === 'production';
@@ -6,23 +6,31 @@ const AppConfigSchema = z
.object({
name: z
.string({
error: `Please provide the variable NEXT_PUBLIC_PRODUCT_NAME`,
description: `This is the name of your SaaS. Ex. "Makerkit"`,
required_error: `Please provide the variable NEXT_PUBLIC_PRODUCT_NAME`,
})
.min(1),
title: z
.string({
error: `Please provide the variable NEXT_PUBLIC_SITE_TITLE`,
description: `This is the default title tag of your SaaS.`,
required_error: `Please provide the variable NEXT_PUBLIC_SITE_TITLE`,
})
.min(1),
description: z.string({
error: `Please provide the variable NEXT_PUBLIC_SITE_DESCRIPTION`,
}),
url: z.url({
message: `You are deploying a production build but have entered a NEXT_PUBLIC_SITE_URL variable using http instead of https. It is very likely that you have set the incorrect URL. The build will now fail to prevent you from from deploying a faulty configuration. Please provide the variable NEXT_PUBLIC_SITE_URL with a valid URL, such as: 'https://example.com'`,
description: `This is the default description of your SaaS.`,
required_error: `Please provide the variable NEXT_PUBLIC_SITE_DESCRIPTION`,
}),
url: z
.string({
required_error: `Please provide the variable NEXT_PUBLIC_SITE_URL`,
})
.url({
message: `You are deploying a production build but have entered a NEXT_PUBLIC_SITE_URL variable using http instead of https. It is very likely that you have set the incorrect URL. The build will now fail to prevent you from from deploying a faulty configuration. Please provide the variable NEXT_PUBLIC_SITE_URL with a valid URL, such as: 'https://example.com'`,
}),
locale: z
.string({
error: `Please provide the variable NEXT_PUBLIC_DEFAULT_LOCALE`,
description: `This is the default locale of your SaaS.`,
required_error: `Please provide the variable NEXT_PUBLIC_DEFAULT_LOCALE`,
})
.default('en'),
theme: z.enum(['light', 'dark', 'system']),

View File

@@ -1,17 +1,36 @@
import type { Provider } from '@supabase/supabase-js';
import * as z from 'zod';
import { z } from 'zod';
const providers: z.ZodType<Provider> = getProviders();
const AuthConfigSchema = z.object({
captchaTokenSiteKey: z.string().optional(),
displayTermsCheckbox: z.boolean().optional(),
enableIdentityLinking: z.boolean().optional().default(false),
captchaTokenSiteKey: z
.string({
description: 'The reCAPTCHA site key.',
})
.optional(),
displayTermsCheckbox: z
.boolean({
description: 'Whether to display the terms checkbox during sign-up.',
})
.optional(),
enableIdentityLinking: z
.boolean({
description: 'Allow linking and unlinking of auth identities.',
})
.optional()
.default(false),
providers: z.object({
password: z.boolean(),
magicLink: z.boolean(),
otp: z.boolean(),
password: z.boolean({
description: 'Enable password authentication.',
}),
magicLink: z.boolean({
description: 'Enable magic link authentication.',
}),
otp: z.boolean({
description: 'Enable one-time password authentication.',
}),
oAuth: providers.array(),
}),
});
@@ -38,7 +57,7 @@ const authConfig = AuthConfigSchema.parse({
otp: process.env.NEXT_PUBLIC_AUTH_OTP === 'true',
oAuth: ['google'],
},
} satisfies z.output<typeof AuthConfigSchema>);
} satisfies z.infer<typeof AuthConfigSchema>);
export default authConfig;

View File

@@ -1,45 +1,58 @@
import * as z from 'zod';
import { z } from 'zod';
type LanguagePriority = 'user' | 'application';
const FeatureFlagsSchema = z.object({
enableThemeToggle: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_THEME_TOGGLE',
description: 'Enable theme toggle in the user interface.',
required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_THEME_TOGGLE',
}),
enableAccountDeletion: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION',
description: 'Enable personal account deletion.',
required_error:
'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION',
}),
enableTeamDeletion: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_DELETION',
description: 'Enable team deletion.',
required_error:
'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_DELETION',
}),
enableTeamAccounts: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS',
description: 'Enable team accounts.',
required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS',
}),
enableTeamCreation: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION',
description: 'Enable team creation.',
required_error:
'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION',
}),
enablePersonalAccountBilling: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING',
description: 'Enable personal account billing.',
required_error:
'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING',
}),
enableTeamAccountBilling: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING',
description: 'Enable team account billing.',
required_error:
'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING',
}),
languagePriority: z
.enum(['user', 'application'], {
error: 'Provide the variable NEXT_PUBLIC_LANGUAGE_PRIORITY',
required_error: 'Provide the variable NEXT_PUBLIC_LANGUAGE_PRIORITY',
description: `If set to user, use the user's preferred language. If set to application, use the application's default language.`,
})
.default('application'),
enableNotifications: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_NOTIFICATIONS',
description: 'Enable notifications functionality',
required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_NOTIFICATIONS',
}),
realtimeNotifications: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_REALTIME_NOTIFICATIONS',
description: 'Enable realtime for the notifications functionality',
required_error: 'Provide the variable NEXT_PUBLIC_REALTIME_NOTIFICATIONS',
}),
enableVersionUpdater: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_VERSION_UPDATER',
}),
enableTeamsOnly: z.boolean({
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_ONLY',
description: 'Enable version updater',
required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_VERSION_UPDATER',
}),
});
@@ -86,11 +99,7 @@ const featuresFlagConfig = FeatureFlagsSchema.parse({
process.env.NEXT_PUBLIC_ENABLE_VERSION_UPDATER,
false,
),
enableTeamsOnly: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_ONLY,
false,
),
} satisfies z.output<typeof FeatureFlagsSchema>);
} satisfies z.infer<typeof FeatureFlagsSchema>);
export default featuresFlagConfig;

View File

@@ -1,4 +1,4 @@
import * as z from 'zod';
import { z } from 'zod';
const PathsSchema = z.object({
auth: z.object({
@@ -19,8 +19,6 @@ const PathsSchema = z.object({
accountBilling: z.string().min(1),
accountMembers: z.string().min(1),
accountBillingReturn: z.string().min(1),
accountProfileSettings: z.string().min(1),
createTeam: z.string().min(1),
joinTeam: z.string().min(1),
}),
});
@@ -44,10 +42,8 @@ const pathsConfig = PathsSchema.parse({
accountBilling: `/home/[account]/billing`,
accountMembers: `/home/[account]/members`,
accountBillingReturn: `/home/[account]/billing/return`,
accountProfileSettings: `/home/[account]/settings/profile`,
createTeam: '/home/create-team',
joinTeam: '/join',
},
} satisfies z.output<typeof PathsSchema>);
} satisfies z.infer<typeof PathsSchema>);
export default pathsConfig;

View File

@@ -1,5 +1,5 @@
import { CreditCard, Home, User } from 'lucide-react';
import * as z from 'zod';
import { z } from 'zod';
import { NavigationConfigSchema } from '@kit/ui/navigation-schema';
@@ -10,34 +10,34 @@ const iconClasses = 'w-4';
const routes = [
{
label: 'common.routes.application',
label: 'common:routes.application',
children: [
{
label: 'common.routes.home',
label: 'common:routes.home',
path: pathsConfig.app.home,
Icon: <Home className={iconClasses} />,
highlightMatch: `${pathsConfig.app.home}$`,
end: true,
},
],
},
{
label: 'common.routes.settings',
label: 'common:routes.settings',
children: [
{
label: 'common.routes.profile',
label: 'common:routes.profile',
path: pathsConfig.app.personalAccountSettings,
Icon: <User className={iconClasses} />,
},
featureFlagsConfig.enablePersonalAccountBilling
? {
label: 'common.routes.billing',
label: 'common:routes.billing',
path: pathsConfig.app.personalAccountBilling,
Icon: <CreditCard className={iconClasses} />,
}
: undefined,
].filter((route) => !!route),
},
] satisfies z.output<typeof NavigationConfigSchema>['routes'];
] satisfies z.infer<typeof NavigationConfigSchema>['routes'];
export const personalAccountNavigationConfig = NavigationConfigSchema.parse({
routes,

View File

@@ -9,33 +9,33 @@ const iconClasses = 'w-4';
const getRoutes = (account: string) => [
{
label: 'common.routes.application',
label: 'common:routes.application',
children: [
{
label: 'common.routes.dashboard',
label: 'common:routes.dashboard',
path: pathsConfig.app.accountHome.replace('[account]', account),
Icon: <LayoutDashboard className={iconClasses} />,
highlightMatch: `${pathsConfig.app.home}$`,
end: true,
},
],
},
{
label: 'common.routes.settings',
label: 'common:routes.settings',
collapsible: false,
children: [
{
label: 'common.routes.settings',
label: 'common:routes.settings',
path: createPath(pathsConfig.app.accountSettings, account),
Icon: <Settings className={iconClasses} />,
},
{
label: 'common.routes.members',
label: 'common:routes.members',
path: createPath(pathsConfig.app.accountMembers, account),
Icon: <Users className={iconClasses} />,
},
featureFlagsConfig.enableTeamAccountBilling
? {
label: 'common.routes.billing',
label: 'common:routes.billing',
path: createPath(pathsConfig.app.accountBilling, account),
Icon: <CreditCard className={iconClasses} />,
}