mirror of
https://github.com/documenso/documenso.git
synced 2025-11-22 20:51:33 +10:00
fix: wip
This commit is contained in:
@ -4,9 +4,10 @@ import { DocumentStatus } from '@prisma/client';
|
||||
import { TeamMemberRole } from '@prisma/client';
|
||||
import { ChevronLeft, Clock9, Users2 } from 'lucide-react';
|
||||
import { Link, redirect } from 'react-router';
|
||||
import { getRequiredSessionContext } from 'server/utils/get-required-session-context';
|
||||
import { match } from 'ts-pattern';
|
||||
|
||||
import { getRequiredSession } from '@documenso/auth/server/lib/utils/get-session';
|
||||
import { useSession } from '@documenso/lib/client-only/providers/session';
|
||||
import { DOCUMENSO_ENCRYPTION_KEY } from '@documenso/lib/constants/crypto';
|
||||
import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';
|
||||
import { getFieldsForDocument } from '@documenso/lib/server-only/field/get-fields-for-document';
|
||||
@ -14,7 +15,6 @@ import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/g
|
||||
import { DocumentVisibility } from '@documenso/lib/types/document-visibility';
|
||||
import { symmetricDecrypt } from '@documenso/lib/universal/crypto';
|
||||
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import { Badge } from '@documenso/ui/primitives/badge';
|
||||
import { Button } from '@documenso/ui/primitives/button';
|
||||
import { Card, CardContent } from '@documenso/ui/primitives/card';
|
||||
@ -33,26 +33,14 @@ import { DocumentPageViewDropdown } from '~/components/pages/document/document-p
|
||||
import { DocumentPageViewInformation } from '~/components/pages/document/document-page-view-information';
|
||||
import { DocumentPageViewRecentActivity } from '~/components/pages/document/document-page-view-recent-activity';
|
||||
import { DocumentPageViewRecipients } from '~/components/pages/document/document-page-view-recipients';
|
||||
import { useAuth } from '~/providers/auth';
|
||||
|
||||
import type { Route } from './+types/$id._index';
|
||||
|
||||
export async function loader({ request, params }: Route.LoaderArgs) {
|
||||
export async function loader({ params, context }: Route.LoaderArgs) {
|
||||
const { user, currentTeam: team } = getRequiredSessionContext(context);
|
||||
|
||||
const { id } = params;
|
||||
|
||||
const { user } = await getRequiredSession(request);
|
||||
|
||||
// Todo: Get from parent loader, this is just for testing.
|
||||
const team = await prisma.team.findFirst({
|
||||
where: {
|
||||
documents: {
|
||||
some: {
|
||||
id: Number(id),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const documentId = Number(id);
|
||||
|
||||
const documentRootPath = formatDocumentsPath(team?.url);
|
||||
@ -142,7 +130,7 @@ export async function loader({ request, params }: Route.LoaderArgs) {
|
||||
|
||||
export default function DocumentPage({ loaderData }: Route.ComponentProps) {
|
||||
const { _ } = useLingui();
|
||||
const { user } = useAuth();
|
||||
const { user } = useSession();
|
||||
|
||||
const { document, documentRootPath, fields } = loaderData;
|
||||
|
||||
|
||||
@ -3,16 +3,15 @@ import { TeamMemberRole } from '@prisma/client';
|
||||
import { DocumentStatus as InternalDocumentStatus } from '@prisma/client';
|
||||
import { ChevronLeft, Users2 } from 'lucide-react';
|
||||
import { Link, redirect } from 'react-router';
|
||||
import { getRequiredSessionContext } from 'server/utils/get-required-session-context';
|
||||
import { match } from 'ts-pattern';
|
||||
|
||||
import { getRequiredSession } from '@documenso/auth/server/lib/utils/get-session';
|
||||
import { isUserEnterprise } from '@documenso/ee/server-only/util/is-document-enterprise';
|
||||
import { DOCUMENSO_ENCRYPTION_KEY } from '@documenso/lib/constants/crypto';
|
||||
import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';
|
||||
import { DocumentVisibility } from '@documenso/lib/types/document-visibility';
|
||||
import { symmetricDecrypt } from '@documenso/lib/universal/crypto';
|
||||
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
import { StackAvatarsWithTooltip } from '~/components/(dashboard)/avatar/stack-avatars-with-tooltip';
|
||||
import { DocumentStatus } from '~/components/formatter/document-status';
|
||||
@ -20,22 +19,11 @@ import { DocumentEditForm } from '~/components/pages/document/document-edit-form
|
||||
|
||||
import type { Route } from './+types/$id.edit';
|
||||
|
||||
export async function loader({ request, params }: Route.LoaderArgs) {
|
||||
export async function loader({ params, context }: Route.LoaderArgs) {
|
||||
const { user, currentTeam: team } = getRequiredSessionContext(context);
|
||||
|
||||
const { id } = params;
|
||||
|
||||
const { user } = await getRequiredSession(request);
|
||||
|
||||
// Todo: Get from parent loader, this is just for testing.
|
||||
const team = await prisma.team.findFirst({
|
||||
where: {
|
||||
documents: {
|
||||
some: {
|
||||
id: Number(id),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const documentId = Number(id);
|
||||
|
||||
const documentRootPath = formatDocumentsPath(team?.url);
|
||||
|
||||
@ -5,6 +5,7 @@ import type { Recipient } from '@prisma/client';
|
||||
import { ChevronLeft } from 'lucide-react';
|
||||
import { DateTime } from 'luxon';
|
||||
import { Link, redirect } from 'react-router';
|
||||
import { getRequiredSessionContext } from 'server/utils/get-required-session-context';
|
||||
|
||||
import { getRequiredSession } from '@documenso/auth/server/lib/utils/get-session';
|
||||
import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';
|
||||
@ -23,21 +24,10 @@ import { DocumentLogsTable } from '~/components/tables/document-logs-table';
|
||||
|
||||
import type { Route } from './+types/$id.logs';
|
||||
|
||||
export async function loader({ request, params }: Route.LoaderArgs) {
|
||||
export async function loader({ params, context }: Route.LoaderArgs) {
|
||||
const { id } = params;
|
||||
|
||||
const { user } = await getRequiredSession(request);
|
||||
|
||||
// Todo: Get from parent loader, this is just for testing.
|
||||
const team = await prisma.team.findFirst({
|
||||
where: {
|
||||
documents: {
|
||||
some: {
|
||||
id: Number(id),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const { user, currentTeam: team } = getRequiredSessionContext(context);
|
||||
|
||||
const documentId = Number(id);
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro';
|
||||
import { useSearchParams } from 'react-router';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import { useSession } from '@documenso/lib/client-only/providers/session';
|
||||
import { formatAvatarUrl } from '@documenso/lib/utils/avatars';
|
||||
import { parseToIntegerArray } from '@documenso/lib/utils/params';
|
||||
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
|
||||
@ -20,7 +21,6 @@ import { UpcomingProfileClaimTeaser } from '~/components/general/upcoming-profil
|
||||
import { DocumentsTable } from '~/components/tables/documents-table';
|
||||
import { DocumentsTableEmptyState } from '~/components/tables/documents-table-empty-state';
|
||||
import { DocumentsTableSenderFilter } from '~/components/tables/documents-table-sender-filter';
|
||||
import { useAuth } from '~/providers/auth';
|
||||
import { useOptionalCurrentTeam } from '~/providers/team';
|
||||
|
||||
export function meta() {
|
||||
@ -39,7 +39,7 @@ export function meta() {
|
||||
export default function DocumentsPage() {
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const { user } = useAuth();
|
||||
const { user } = useSession();
|
||||
const team = useOptionalCurrentTeam();
|
||||
|
||||
const status = isExtendedDocumentStatus(searchParams.status) ? searchParams.status : 'ALL';
|
||||
|
||||
Reference in New Issue
Block a user