Rename component files and update code dependencies
Numerous component files have been renamed for better organization and readability. This includes changing 'app' to 'account-layout' in various instances and 'organization' to 'team' to ensure consistency across code. Additionally, dependencies within codes have been updated in line with the renaming. The pull request also includes a minor update to the pnpm-lock file, reflecting the latest version of Next.js.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { PageHeader } from '@kit/ui/page';
|
||||
|
||||
import UserLayoutMobileNavigation from './user-layout-mobile-navigation';
|
||||
|
||||
export function UserAccountHeader(
|
||||
props: React.PropsWithChildren<{
|
||||
title: string | React.ReactNode;
|
||||
description?: string | React.ReactNode;
|
||||
}>,
|
||||
) {
|
||||
return (
|
||||
<PageHeader
|
||||
title={props.title}
|
||||
description={props.description}
|
||||
mobileNavigation={<UserLayoutMobileNavigation />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
import { LogOut, Menu } from 'lucide-react';
|
||||
|
||||
import { useSignOut } from '@kit/supabase/hooks/use-sign-out';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@kit/ui/dropdown-menu';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { personalAccountSidebarConfig } from '~/config/personal-account-sidebar.config';
|
||||
|
||||
export function UserLayoutMobileNavigation() {
|
||||
const signOut = useSignOut();
|
||||
|
||||
const Links = personalAccountSidebarConfig.routes.map((item, index) => {
|
||||
if ('children' in item) {
|
||||
return item.children.map((child) => {
|
||||
return (
|
||||
<DropdownLink
|
||||
key={child.path}
|
||||
Icon={child.Icon}
|
||||
path={child.path}
|
||||
label={child.label}
|
||||
/>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if ('divider' in item) {
|
||||
return <DropdownMenuSeparator key={index} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownLink
|
||||
key={item.path}
|
||||
Icon={item.Icon}
|
||||
path={item.path}
|
||||
label={item.label}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger>
|
||||
<Menu className={'h-9'} />
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
<DropdownMenuContent sideOffset={10} className={'w-screen rounded-none'}>
|
||||
{Links}
|
||||
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
<SignOutDropdownItem onSignOut={() => signOut.mutateAsync()} />
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
||||
export default UserLayoutMobileNavigation;
|
||||
|
||||
function DropdownLink(
|
||||
props: React.PropsWithChildren<{
|
||||
path: string;
|
||||
label: string;
|
||||
Icon: React.ReactNode;
|
||||
}>,
|
||||
) {
|
||||
return (
|
||||
<DropdownMenuItem asChild key={props.path}>
|
||||
<Link
|
||||
href={props.path}
|
||||
className={'flex h-12 w-full items-center space-x-4'}
|
||||
>
|
||||
{props.Icon}
|
||||
|
||||
<span>
|
||||
<Trans i18nKey={props.label} defaults={props.label} />
|
||||
</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
function SignOutDropdownItem(
|
||||
props: React.PropsWithChildren<{
|
||||
onSignOut: () => unknown;
|
||||
}>,
|
||||
) {
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
className={'flex h-12 w-full items-center space-x-4'}
|
||||
onClick={props.onSignOut}
|
||||
>
|
||||
<LogOut className={'h-6'} />
|
||||
|
||||
<span>
|
||||
<Trans i18nKey={'common:signOut'} defaults={'Sign out'} />
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
}
|
||||
@@ -7,9 +7,10 @@ import {
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
import { If } from '@kit/ui/if';
|
||||
import { PageBody, PageHeader } from '@kit/ui/page';
|
||||
import { PageBody } from '@kit/ui/page';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { UserAccountHeader } from '~/(dashboard)/home/(user)/_components/user-account-header';
|
||||
import { createPersonalAccountBillingPortalSession } from '~/(dashboard)/home/(user)/billing/server-actions';
|
||||
import billingConfig from '~/config/billing.config';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
@@ -34,7 +35,7 @@ async function PersonalAccountBillingPage() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
<UserAccountHeader
|
||||
title={<Trans i18nKey={'common:billingTabLabel'} />}
|
||||
description={<Trans i18nKey={'common:billingTabDescription'} />}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { PageBody, PageHeader } from '@kit/ui/page';
|
||||
import { PageBody } from '@kit/ui/page';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { UserAccountHeader } from '~/(dashboard)/home/(user)/_components/user-account-header';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
@@ -16,7 +17,7 @@ export const generateMetadata = async () => {
|
||||
function UserHomePage() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
<UserAccountHeader
|
||||
title={<Trans i18nKey={'common:homeTabLabel'} defaults={'Home'} />}
|
||||
description={
|
||||
<Trans
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { PageBody, PageHeader } from '@kit/ui/page';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { UserAccountHeader } from '~/(dashboard)/home/(user)/_components/user-account-header';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
function UserSettingsLayout(props: React.PropsWithChildren) {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
<UserAccountHeader
|
||||
title={<Trans i18nKey={'common:yourAccountTabLabel'} />}
|
||||
description={'Manage your account settings'}
|
||||
/>
|
||||
|
||||
<PageBody>{props.children}</PageBody>
|
||||
{props.children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,11 +26,7 @@ export const generateMetadata = async () => {
|
||||
function PersonalAccountSettingsPage() {
|
||||
return (
|
||||
<PageBody>
|
||||
<div
|
||||
className={
|
||||
'container mx-auto flex max-w-2xl flex-1 flex-col items-center'
|
||||
}
|
||||
>
|
||||
<div className={'mx-auto flex w-full flex-1 flex-col lg:max-w-2xl'}>
|
||||
<PersonalAccountSettingsContainer features={features} paths={paths} />
|
||||
</div>
|
||||
</PageBody>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PageHeader } from '@kit/ui/page';
|
||||
|
||||
import { MobileAppNavigation } from '~/(dashboard)/home/[account]/_components/mobile-app-navigation';
|
||||
import { AccountLayoutMobileNavigation } from '~/(dashboard)/home/[account]/_components/account-layout-mobile-navigation';
|
||||
|
||||
export function AppHeader({
|
||||
export function AccountLayoutHeader({
|
||||
children,
|
||||
title,
|
||||
description,
|
||||
@@ -16,7 +16,7 @@ export function AppHeader({
|
||||
<PageHeader
|
||||
title={title}
|
||||
description={description}
|
||||
mobileNavigation={<MobileAppNavigation slug={account} />}
|
||||
mobileNavigation={<AccountLayoutMobileNavigation account={account} />}
|
||||
>
|
||||
{children}
|
||||
</PageHeader>
|
||||
@@ -25,21 +25,21 @@ import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import featureFlagsConfig from '~/config/feature-flags.config';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
import { getOrganizationAccountSidebarConfig } from '~/config/team-account-sidebar.config';
|
||||
import { getTeamAccountSidebarConfig } from '~/config/team-account-sidebar.config';
|
||||
|
||||
const features = {
|
||||
enableTeamAccounts: featureFlagsConfig.enableTeamAccounts,
|
||||
enableTeamCreation: featureFlagsConfig.enableTeamCreation,
|
||||
};
|
||||
|
||||
export const MobileAppNavigation = (
|
||||
export const AccountLayoutMobileNavigation = (
|
||||
props: React.PropsWithChildren<{
|
||||
slug: string;
|
||||
account: string;
|
||||
}>,
|
||||
) => {
|
||||
const signOut = useSignOut();
|
||||
|
||||
const Links = getOrganizationAccountSidebarConfig(props.slug).routes.map(
|
||||
const Links = getTeamAccountSidebarConfig(props.account).routes.map(
|
||||
(item, index) => {
|
||||
if ('children' in item) {
|
||||
return item.children.map((child) => {
|
||||
@@ -0,0 +1,59 @@
|
||||
'use client';
|
||||
|
||||
import { SidebarDivider, SidebarGroup, SidebarItem } from '@kit/ui/sidebar';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { getTeamAccountSidebarConfig } from '~/config/team-account-sidebar.config';
|
||||
|
||||
export function AccountLayoutSidebarNavigation({
|
||||
account,
|
||||
}: React.PropsWithChildren<{
|
||||
account: string;
|
||||
}>) {
|
||||
return (
|
||||
<>
|
||||
{getTeamAccountSidebarConfig(account).routes.map((item, index) => {
|
||||
if ('divider' in item) {
|
||||
return <SidebarDivider key={index} />;
|
||||
}
|
||||
|
||||
if ('children' in item) {
|
||||
return (
|
||||
<SidebarGroup
|
||||
key={item.label}
|
||||
label={<Trans i18nKey={item.label} defaults={item.label} />}
|
||||
collapsible={item.collapsible}
|
||||
collapsed={item.collapsed}
|
||||
>
|
||||
{item.children.map((child) => {
|
||||
return (
|
||||
<SidebarItem
|
||||
key={child.path}
|
||||
end={child.end}
|
||||
path={child.path}
|
||||
Icon={child.Icon}
|
||||
>
|
||||
<Trans i18nKey={child.label} defaults={child.label} />
|
||||
</SidebarItem>
|
||||
);
|
||||
})}
|
||||
</SidebarGroup>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarItem
|
||||
key={item.path}
|
||||
end={item.end}
|
||||
path={item.path}
|
||||
Icon={item.Icon}
|
||||
>
|
||||
<Trans i18nKey={item.label} defaults={item.label} />
|
||||
</SidebarItem>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AccountLayoutSidebarNavigation;
|
||||
@@ -20,7 +20,7 @@ import { ProfileAccountDropdownContainer } from '~/(dashboard)/home/_components/
|
||||
import featureFlagsConfig from '~/config/feature-flags.config';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
|
||||
import { AppSidebarNavigation } from './app-sidebar-navigation';
|
||||
import { AccountLayoutSidebarNavigation } from './account-layout-sidebar-navigation';
|
||||
|
||||
type AccountModel = {
|
||||
label: string | null;
|
||||
@@ -33,7 +33,7 @@ const features = {
|
||||
enableTeamCreation: featureFlagsConfig.enableTeamCreation,
|
||||
};
|
||||
|
||||
export function AppSidebar(props: {
|
||||
export function AccountLayoutSidebar(props: {
|
||||
account: string;
|
||||
accounts: AccountModel[];
|
||||
collapsed: boolean;
|
||||
@@ -81,7 +81,7 @@ function SidebarContainer(props: {
|
||||
</SidebarContent>
|
||||
|
||||
<SidebarContent className={`h-[calc(100%-160px)] overflow-y-auto`}>
|
||||
<AppSidebarNavigation account={account} />
|
||||
<AccountLayoutSidebarNavigation account={account} />
|
||||
</SidebarContent>
|
||||
|
||||
<div className={'absolute bottom-4 left-0 w-full'}>
|
||||
@@ -1,61 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { SidebarDivider, SidebarGroup, SidebarItem } from '@kit/ui/sidebar';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { getOrganizationAccountSidebarConfig } from '~/config/team-account-sidebar.config';
|
||||
|
||||
export function AppSidebarNavigation({
|
||||
account,
|
||||
}: React.PropsWithChildren<{
|
||||
account: string;
|
||||
}>) {
|
||||
return (
|
||||
<>
|
||||
{getOrganizationAccountSidebarConfig(account).routes.map(
|
||||
(item, index) => {
|
||||
if ('divider' in item) {
|
||||
return <SidebarDivider key={index} />;
|
||||
}
|
||||
|
||||
if ('children' in item) {
|
||||
return (
|
||||
<SidebarGroup
|
||||
key={item.label}
|
||||
label={<Trans i18nKey={item.label} defaults={item.label} />}
|
||||
collapsible={item.collapsible}
|
||||
collapsed={item.collapsed}
|
||||
>
|
||||
{item.children.map((child) => {
|
||||
return (
|
||||
<SidebarItem
|
||||
key={child.path}
|
||||
end={child.end}
|
||||
path={child.path}
|
||||
Icon={child.Icon}
|
||||
>
|
||||
<Trans i18nKey={child.label} defaults={child.label} />
|
||||
</SidebarItem>
|
||||
);
|
||||
})}
|
||||
</SidebarGroup>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarItem
|
||||
key={item.path}
|
||||
end={item.end}
|
||||
path={item.path}
|
||||
Icon={item.Icon}
|
||||
>
|
||||
<Trans i18nKey={item.label} defaults={item.label} />
|
||||
</SidebarItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AppSidebarNavigation;
|
||||
@@ -4,7 +4,7 @@ import { parseSidebarStateCookie } from '@kit/shared/cookies/sidebar-state.cooki
|
||||
import { parseThemeCookie } from '@kit/shared/cookies/theme.cookie';
|
||||
import { Page } from '@kit/ui/page';
|
||||
|
||||
import { AppSidebar } from '~/(dashboard)/home/[account]/_components/app-sidebar';
|
||||
import { AccountLayoutSidebar } from '~/(dashboard)/home/[account]/_components/account-layout-sidebar';
|
||||
import { loadTeamWorkspace } from '~/(dashboard)/home/[account]/_lib/load-team-account-workspace';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
@@ -31,7 +31,7 @@ function TeamWorkspaceLayout({
|
||||
return (
|
||||
<Page
|
||||
sidebar={
|
||||
<AppSidebar
|
||||
<AccountLayoutSidebar
|
||||
collapsed={sidebarCollapsed}
|
||||
account={params.account}
|
||||
accounts={accounts}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PageBody } from '@kit/ui/page';
|
||||
import Spinner from '@kit/ui/spinner';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { AppHeader } from '~/(dashboard)/home/[account]/_components/app-header';
|
||||
import { AccountLayoutHeader } from '~/(dashboard)/home/[account]/_components/account-layout-header';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
@@ -50,7 +50,7 @@ function TeamAccountHomePage({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppHeader
|
||||
<AccountLayoutHeader
|
||||
title={<Trans i18nKey={'common:dashboardTabLabel'} />}
|
||||
description={<Trans i18nKey={'common:dashboardTabDescription'} />}
|
||||
account={params.account}
|
||||
@@ -59,7 +59,7 @@ function TeamAccountHomePage({
|
||||
<Plus className={'mr-2 h-4'} />
|
||||
<span>Add Widget</span>
|
||||
</Button>
|
||||
</AppHeader>
|
||||
</AccountLayoutHeader>
|
||||
|
||||
<PageBody>
|
||||
<DashboardDemo />
|
||||
|
||||
@@ -39,7 +39,7 @@ const getRoutes = (account: string) => [
|
||||
},
|
||||
];
|
||||
|
||||
export function getOrganizationAccountSidebarConfig(account: string) {
|
||||
export function getTeamAccountSidebarConfig(account: string) {
|
||||
return SidebarConfigSchema.parse({
|
||||
routes: getRoutes(account),
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"edge-csrf": "^1.0.9",
|
||||
"i18next": "^23.10.1",
|
||||
"i18next-resources-to-backend": "^1.2.0",
|
||||
"next": "14.2.0-canary.48",
|
||||
"next": "v14.2.0-canary.49",
|
||||
"next-contentlayer": "0.3.4",
|
||||
"next-sitemap": "^4.2.3",
|
||||
"next-themes": "0.3.0",
|
||||
|
||||
Reference in New Issue
Block a user