mirror of
https://github.com/documenso/documenso.git
synced 2025-11-23 13:11:32 +10:00
## Description Add support for teams which will allow users to collaborate on documents. Teams features allows users to: - Create, manage and transfer teams - Manage team members - Manage team emails - Manage a shared team inbox and documents These changes do NOT include the following, which are planned for a future release: - Team templates - Team API - Search menu integration ## Testing Performed - Added E2E tests for general team management - Added E2E tests to validate document counts ## Checklist - [X] I have tested these changes locally and they work as expected. - [X] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [X] I have followed the project's coding style guidelines.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
|
|
import { redirect } from 'next/navigation';
|
|
|
|
import { getServerSession } from 'next-auth';
|
|
|
|
import { LimitsProvider } from '@documenso/ee/server-only/limits/provider/server';
|
|
import { NEXT_AUTH_OPTIONS } from '@documenso/lib/next-auth/auth-options';
|
|
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
|
|
import { getTeams } from '@documenso/lib/server-only/team/get-teams';
|
|
|
|
import { Header } from '~/components/(dashboard)/layout/header';
|
|
import { VerifyEmailBanner } from '~/components/(dashboard)/layout/verify-email-banner';
|
|
import { RefreshOnFocus } from '~/components/(dashboard)/refresh-on-focus/refresh-on-focus';
|
|
import { NextAuthProvider } from '~/providers/next-auth';
|
|
|
|
export type AuthenticatedDashboardLayoutProps = {
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
export default async function AuthenticatedDashboardLayout({
|
|
children,
|
|
}: AuthenticatedDashboardLayoutProps) {
|
|
const session = await getServerSession(NEXT_AUTH_OPTIONS);
|
|
|
|
if (!session) {
|
|
redirect('/signin');
|
|
}
|
|
|
|
const [{ user }, teams] = await Promise.all([
|
|
getRequiredServerComponentSession(),
|
|
getTeams({ userId: session.user.id }),
|
|
]);
|
|
|
|
return (
|
|
<NextAuthProvider session={session}>
|
|
<LimitsProvider>
|
|
{!user.emailVerified && <VerifyEmailBanner email={user.email} />}
|
|
|
|
<Header user={user} teams={teams} />
|
|
|
|
<main className="mt-8 pb-8 md:mt-12 md:pb-12">{children}</main>
|
|
|
|
<RefreshOnFocus />
|
|
</LimitsProvider>
|
|
</NextAuthProvider>
|
|
);
|
|
}
|