Documentation Index
Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
Use this file to discover all available pages before exploring further.
This section contains practical examples and code samples demonstrating how to use various components and features of the Tuturuuu platform.
Component Examples
WorkspaceWrapper
Examples showing how to use the WorkspaceWrapper component in different scenarios.
The main WorkspaceWrapper documentation includes comprehensive code examples demonstrating various usage patterns.
Usage Patterns
Server Components
// Basic server component with WorkspaceWrapper
export default async function MyPage({
searchParams
}: {
searchParams: Promise<{ wsId: string }>
}) {
return (
<WorkspaceWrapper searchParams={searchParams}>
{({ workspace, wsId }) => (
<div>{workspace.name}</div>
)}
</WorkspaceWrapper>
);
}
Client Components
'use client';
interface MyComponentProps {
workspace: Workspace & { joined: boolean };
wsId: string;
}
export function MyComponent({ workspace, wsId }: MyComponentProps) {
return <div>{workspace.name}</div>;
}
API Routes
// API route with workspace validation
export async function GET(
request: Request,
{ params }: { params: Promise<{ wsId: string }> }
) {
const { wsId } = await params;
const workspace = await getWorkspace(wsId);
if (!workspace) {
return Response.json({ error: 'Workspace not found' }, { status: 404 });
}
return Response.json({ workspace });
}
Best Practices
Error Handling
// Proper error handling in components
export default async function MyPage({ searchParams }) {
return (
<WorkspaceWrapper
searchParams={searchParams}
fallback={<ErrorBoundary />}
>
{({ workspace, wsId }) => {
try {
return <MyComponent workspace={workspace} wsId={wsId} />;
} catch (error) {
return <ErrorMessage error={error} />;
}
}}
</WorkspaceWrapper>
);
}
Loading States
// Proper loading state handling
export default async function MyPage({ searchParams }) {
return (
<WorkspaceWrapper
searchParams={searchParams}
fallback={<LoadingSkeleton />}
>
{({ workspace, wsId }) => (
<Suspense fallback={<LoadingSpinner />}>
<AsyncContent workspace={workspace} wsId={wsId} />
</Suspense>
)}
</WorkspaceWrapper>
);
}
Type Safety
// Proper TypeScript usage
interface PageProps {
searchParams: Promise<{ wsId: string }>;
}
interface WorkspaceData {
workspace: Workspace & { joined: boolean };
wsId: string;
}
export default async function MyPage({ searchParams }: PageProps) {
return (
<WorkspaceWrapper searchParams={searchParams}>
{({ workspace, wsId }: WorkspaceData) => (
<MyComponent workspace={workspace} wsId={wsId} />
)}
</WorkspaceWrapper>
);
}
Common Patterns
Dashboard Pages
Most dashboard pages follow this pattern:
- Use WorkspaceWrapper for workspace resolution
- Fetch additional data based on workspace
- Render components with proper loading states
- Handle permissions and access control
Settings Pages
Settings pages typically:
- Validate user permissions
- Show different UI based on user role
- Handle form submissions with proper validation
- Provide clear feedback to users
API Endpoints
API endpoints should:
- Validate workspace access
- Handle errors gracefully
- Return appropriate HTTP status codes
- Include proper error messages
Contributing Examples
When adding new examples:
- Use realistic, practical scenarios
- Include proper TypeScript types
- Show error handling
- Include both server and client examples
- Update this index page