Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/web/src/review/review-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,9 @@ function ArtifactReview({
const [focusControlsCollapsed, setFocusControlsCollapsed] = useState(false);
const [focusControlsHoverArmed, setFocusControlsHoverArmed] = useState(true);
const [focusControlsInstant, setFocusControlsInstant] = useState(false);
const [htmlAnnotateModeActive, setHtmlAnnotateModeActive] = useState(true);
const [htmlAnnotateModeActive, setHtmlAnnotateModeActive] = useState(
readInitialHtmlAnnotateMode,
);
const [homeOpen, setHomeOpen] = useState(false);
const focusCommentsButtonRef = useRef<HTMLButtonElement>(null);
const focusControlsRestoreRef = useRef<HTMLButtonElement>(null);
Expand Down Expand Up @@ -607,6 +609,13 @@ function ArtifactReview({
catalogWidthApplyRef.current = (width) => catalogMotion.width.set(width);
inspectorWidthApplyRef.current = (width) => inspectorMotion.width.set(width);
}, [catalogMotion.width, inspectorMotion.width]);
useEffect(() => {
if (htmlAnnotateModeActive) {
window.localStorage.removeItem("artifact-review-html-mode");
} else {
window.localStorage.setItem("artifact-review-html-mode", "interact");
}
}, [htmlAnnotateModeActive]);
const followCommentVersion = useCallback((versionId: string): void => {
setDetailError(null);
setSelectedVersionId(versionId);
Expand Down Expand Up @@ -2747,6 +2756,10 @@ function readInitialTheme(): ReviewTheme {
: "moon";
}

function readInitialHtmlAnnotateMode(): boolean {
return window.localStorage.getItem("artifact-review-html-mode") !== "interact";
}

function readInitialInspectorOpen(): boolean {
return window.matchMedia("(min-width: 1181px)").matches;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/browser/frontend-mvp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ test.describe("Artifact Server frontend MVP", () => {
await expect(preview.locator("#review-native-action"))
.toHaveAttribute("data-clicked", "true");
await expect(reviewFrame.getByPlaceholder("Add a comment...")).toHaveCount(0);
await fixture.page.reload();
await expect(interactMode).toHaveAttribute("aria-pressed", "false");
await preview.locator("#review-native-action").click();
await expect(preview.locator("#review-native-action"))
.toHaveAttribute("data-clicked", "true");
await expect(reviewFrame.getByPlaceholder("Add a comment...")).toHaveCount(0);
await interactMode.click();
await expect(annotateMode).toHaveAttribute("aria-pressed", "true");

Expand Down