refactor(intake): split non-integrated workspace containers
This commit is contained in:
parent
1608b8f7ad
commit
d1ddf2de7a
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
|
||||
import { FirstQualityWorkspace } from "../FirstQualityWorkspace";
|
||||
import { FirstQualityWorkspaceShell } from "./FirstQualityWorkspaceShell";
|
||||
|
||||
type FirstQualityWorkspaceProps = ComponentProps<typeof FirstQualityWorkspace>;
|
||||
type FirstQualityWorkspaceShellProps = ComponentProps<
|
||||
typeof FirstQualityWorkspaceShell
|
||||
>;
|
||||
|
||||
type FirstQualityWorkspaceRendererOptions = {
|
||||
factoryQuality: FirstQualityWorkspaceProps;
|
||||
shell: Omit<
|
||||
FirstQualityWorkspaceShellProps,
|
||||
"renderFactoryQualityWorkspace" | "renderQualityStandardWorkspace"
|
||||
>;
|
||||
renderQualityStandardWorkspace: () => ReactNode;
|
||||
};
|
||||
|
||||
export function buildFirstQualityWorkspaceRenderers({
|
||||
factoryQuality,
|
||||
shell,
|
||||
renderQualityStandardWorkspace,
|
||||
}: FirstQualityWorkspaceRendererOptions) {
|
||||
function renderFactoryQualityWorkspace() {
|
||||
return <FirstQualityWorkspace {...factoryQuality} />;
|
||||
}
|
||||
|
||||
function renderFirstQualityWorkspace() {
|
||||
return (
|
||||
<FirstQualityWorkspaceShell
|
||||
{...shell}
|
||||
renderFactoryQualityWorkspace={renderFactoryQualityWorkspace}
|
||||
renderQualityStandardWorkspace={renderQualityStandardWorkspace}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
renderFactoryQualityWorkspace,
|
||||
renderFirstQualityWorkspace,
|
||||
};
|
||||
}
|
||||
@ -1,23 +1,32 @@
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
import { OpeningReferenceWorkspace } from "../OpeningReferenceWorkspace";
|
||||
import { ProductPatentApplicationDomain } from "../patent/ProductPatentDomain";
|
||||
import { ProjectReviewWorkspace } from "../ProjectReviewWorkspace";
|
||||
|
||||
type OpeningReferenceWorkspaceProps = ComponentProps<
|
||||
typeof OpeningReferenceWorkspace
|
||||
>;
|
||||
type ProductPatentApplicationDomainProps = ComponentProps<
|
||||
typeof ProductPatentApplicationDomain
|
||||
>;
|
||||
type ProjectReviewWorkspaceProps = ComponentProps<typeof ProjectReviewWorkspace>;
|
||||
|
||||
type ProductDevelopmentReviewWorkspaceRendererOptions = {
|
||||
openingReference: OpeningReferenceWorkspaceProps;
|
||||
patentApplication: ProductPatentApplicationDomainProps;
|
||||
projectReview: ProjectReviewWorkspaceProps;
|
||||
};
|
||||
|
||||
export function buildProductDevelopmentReviewWorkspaceRenderers({
|
||||
openingReference,
|
||||
patentApplication,
|
||||
projectReview,
|
||||
}: ProductDevelopmentReviewWorkspaceRendererOptions) {
|
||||
return {
|
||||
renderOpeningReferenceWorkspace() {
|
||||
return <OpeningReferenceWorkspace {...openingReference} />;
|
||||
},
|
||||
renderPatentApplicationWorkspace() {
|
||||
return <ProductPatentApplicationDomain {...patentApplication} />;
|
||||
},
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function ProductDevelopmentDetailContent({
|
||||
children,
|
||||
footer,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
footer: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{children}
|
||||
{footer}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
|
||||
import { DocumentWorkspaceHeaderActionsSlot } from "./DocumentWorkspaceHeaderActionsSlot";
|
||||
import { DocumentWorkspacePanelContent } from "./DocumentWorkspacePanelContent";
|
||||
import { DocumentWorkspaceSectionCard } from "./DocumentWorkspaceSectionCard";
|
||||
|
||||
type DocumentWorkspaceSectionCardProps = ComponentProps<
|
||||
typeof DocumentWorkspaceSectionCard
|
||||
>;
|
||||
type DocumentWorkspaceHeaderActionsProps = ComponentProps<
|
||||
typeof DocumentWorkspaceHeaderActionsSlot
|
||||
>;
|
||||
type DocumentWorkspacePanelContentProps = ComponentProps<
|
||||
typeof DocumentWorkspacePanelContent
|
||||
>;
|
||||
|
||||
export function DocumentWorkspaceContentSection({
|
||||
card,
|
||||
footer,
|
||||
headerActions,
|
||||
panel,
|
||||
}: {
|
||||
card: Omit<DocumentWorkspaceSectionCardProps, "children" | "headerActions">;
|
||||
footer: ReactNode;
|
||||
headerActions: DocumentWorkspaceHeaderActionsProps;
|
||||
panel: DocumentWorkspacePanelContentProps;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-3">
|
||||
<DocumentWorkspaceSectionCard
|
||||
{...card}
|
||||
headerActions={<DocumentWorkspaceHeaderActionsSlot {...headerActions} />}
|
||||
>
|
||||
<div
|
||||
data-testid="document-workspace-panel"
|
||||
className={`flex min-h-0 flex-1 flex-col ${
|
||||
panel.isProductPhotoWorkspace ? "gap-1.5" : "gap-2"
|
||||
}`}
|
||||
>
|
||||
<DocumentWorkspacePanelContent {...panel} />
|
||||
</div>
|
||||
</DocumentWorkspaceSectionCard>
|
||||
{footer}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { ArchivePreviewPanel } from "./ArchivePreviewPanel";
|
||||
|
||||
type ArchivePreviewPanelRendererOptions = {
|
||||
title: string;
|
||||
description: string;
|
||||
hasSelectedFile: boolean;
|
||||
renderPreviewContent: () => ReactNode;
|
||||
};
|
||||
|
||||
type ArchivePreviewPanelOverride = {
|
||||
title?: string;
|
||||
description?: string;
|
||||
emptyTitle?: string;
|
||||
emptyDescription?: string;
|
||||
};
|
||||
|
||||
export function buildArchivePreviewPanelRenderer({
|
||||
title,
|
||||
description,
|
||||
hasSelectedFile,
|
||||
renderPreviewContent,
|
||||
}: ArchivePreviewPanelRendererOptions) {
|
||||
return function renderArchivePreviewPanel(
|
||||
options?: ArchivePreviewPanelOverride,
|
||||
) {
|
||||
return (
|
||||
<ArchivePreviewPanel
|
||||
title={options?.title ?? title}
|
||||
description={options?.description ?? description}
|
||||
emptyTitle={options?.emptyTitle}
|
||||
emptyDescription={options?.emptyDescription}
|
||||
hasSelectedFile={hasSelectedFile}
|
||||
renderPreviewContent={renderPreviewContent}
|
||||
/>
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
import { InstallationWorkspace } from "../InstallationWorkspace";
|
||||
import { PackagingWorkspace } from "./PackagingWorkspace";
|
||||
|
||||
type InstallationWorkspaceProps = ComponentProps<typeof InstallationWorkspace>;
|
||||
type PackagingWorkspaceProps = ComponentProps<typeof PackagingWorkspace>;
|
||||
|
||||
export function buildStyleAssetWorkspaceRenderers({
|
||||
installation,
|
||||
packaging,
|
||||
}: {
|
||||
installation: InstallationWorkspaceProps;
|
||||
packaging: PackagingWorkspaceProps;
|
||||
}) {
|
||||
return {
|
||||
renderInstallationWorkspace() {
|
||||
return <InstallationWorkspace {...installation} />;
|
||||
},
|
||||
renderPackagingWorkspace() {
|
||||
return <PackagingWorkspace {...packaging} />;
|
||||
},
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user