import { WebsitesPage } from './WebsitesPage';import { Metadata } from 'next';export default function () { return <WebsitesPage />;}export const metadata: Metadata = { title: 'Websites',};
There isn’t much code here, in fact, it is only 10 lines. The best projects always keep it simple, nothing complicated.
If you define methods like fetching list of websites or a method to create a website in the page.tsx itself and then pass this down as a prop to the components, then you are doing something wrong.
WebsitesPage is imported from websites folder where the page.tsx is located. This is colocating your components.
'use client';import { WebsitesDataTable } from './WebsitesDataTable';import { WebsiteAddButton } from './WebsiteAddButton';import { useMessages, useNavigation } from '@/components/hooks';import { Column } from '@umami/react-zen';import { PageHeader } from '@/components/common/PageHeader';import { Panel } from '@/components/common/Panel';import { PageBody } from '@/components/common/PageBody';export function WebsitesPage() { const { teamId } = useNavigation(); const { formatMessage, labels } = useMessages(); return ( <PageBody> <Column gap="6" margin="2"> <PageHeader title={formatMessage(labels.websites)}> <WebsiteAddButton teamId={teamId} /> </PageHeader> <Panel> <WebsitesDataTable teamId={teamId} /> </Panel> </Column> </PageBody> );}
WebsitesDataTable and WebsiteAddButton are colocated. However, PageHeader, Panel and PageBody are imported from common folder. This is because of the way Umami website looks like. If you visit websites, you will see a header:
Similarly, if you visit Links page, you will see the header containing Links with a button.
Do you see the pattern here? these can be abstracted to a common component and reused. This is what you see in Umami’s codebase.
We will review the PageHeader, PageBody and Panel, WebsitesDataTable and WebsiteAddButton in the next part.
I spent 200+ hours analyzing Supabase, shadcn/ui, LobeChat. Found the patterns that separate AI slop from production code. Stop refactoring AI slop. Start with proven patterns. Check out production-grade projects atthinkthroo.com