test: prove TechLog UI migration parity
This commit is contained in:
@@ -3,6 +3,7 @@ import type { WorkingCopyInput } from "../../../contracts/studio/contract.ts";
|
||||
import { ContentFormatError } from "../../../domain/content-format/parse-case-content.ts";
|
||||
import { projectWorkingCopy } from "../../../domain/content-format/project-public-render-model.ts";
|
||||
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
|
||||
type CatalogEntry = components["schemas"]["CatalogEntry"];
|
||||
|
||||
@@ -24,6 +25,7 @@ function resolvePreviewEvidenceAsset(key: string) {
|
||||
}
|
||||
|
||||
export function InstantPreview({ draft, catalog }: { draft: WorkingCopyInput; catalog: CatalogEntry[] }) {
|
||||
const studio = useStudio();
|
||||
let model: ReturnType<typeof projectWorkingCopy> | null = null;
|
||||
let issues: string[] | null = null;
|
||||
try {
|
||||
@@ -45,7 +47,7 @@ export function InstantPreview({ draft, catalog }: { draft: WorkingCopyInput; ca
|
||||
model={model!}
|
||||
embedded
|
||||
resolveEvidenceAsset={resolvePreviewEvidenceAsset}
|
||||
resolvePublishedLabel={() => undefined}
|
||||
resolvePublishedLabel={studio.resolvePublishedLabel}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -288,7 +288,7 @@ export function PublicPreviewScreen({ documentId }: { documentId: string }) {
|
||||
model={previewDetail.preview.renderModel}
|
||||
embedded
|
||||
resolveEvidenceAsset={resolvePreviewEvidenceAsset}
|
||||
resolvePublishedLabel={() => undefined}
|
||||
resolvePublishedLabel={studio.resolvePublishedLabel}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
+3
-4
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable react-hooks/set-state-in-effect -- a changed event or retry intentionally enters a fresh loading state. */
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import {
|
||||
@@ -50,7 +48,8 @@ export function PublicationEventPreviewScreen({
|
||||
publicationEventId: string;
|
||||
classes?: PublicationFlowClasses;
|
||||
}) {
|
||||
const { gateway } = useStudio();
|
||||
const studio = useStudio();
|
||||
const { gateway } = studio;
|
||||
const [retry, setRetry] = useState(0);
|
||||
const [state, setState] = useState<
|
||||
| { status: "LOADING" }
|
||||
@@ -168,7 +167,7 @@ export function PublicationEventPreviewScreen({
|
||||
model={renderModel}
|
||||
embedded
|
||||
resolveEvidenceAsset={resolveEvidenceAsset}
|
||||
resolvePublishedLabel={() => undefined}
|
||||
resolvePublishedLabel={studio.resolvePublishedLabel}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export const defaultPublicationFlowClasses = {
|
||||
import styles from "../../styles/publication-flow.module.css";
|
||||
|
||||
const publicationFlowClassContract = {
|
||||
page: "studio-publication-page",
|
||||
snapshotPage: "studio-snapshot-page",
|
||||
heading: "studio-publication-heading",
|
||||
@@ -35,4 +37,11 @@ export const defaultPublicationFlowClasses = {
|
||||
snapshotDocument: "studio-publication-snapshot-document",
|
||||
} as const;
|
||||
|
||||
export type PublicationFlowClasses = Record<keyof typeof defaultPublicationFlowClasses, string>;
|
||||
export type PublicationFlowClasses = Record<
|
||||
keyof typeof publicationFlowClassContract,
|
||||
string
|
||||
>;
|
||||
|
||||
export const defaultPublicationFlowClasses = Object.fromEntries(
|
||||
Object.keys(publicationFlowClassContract).map((key) => [key, styles[key]]),
|
||||
) as PublicationFlowClasses;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable react-hooks/set-state-in-effect -- a changed history query intentionally enters a fresh loading state. */
|
||||
|
||||
import { useEffect, useRef, useState, type FormEvent } from "react";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable react-hooks/set-state-in-effect -- a changed document or retry intentionally enters a fresh loading state. */
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user