Skip to content

fix(contest): lock runtime workspace navigation#170

Merged
quan0715 merged 1 commit intomainfrom
dev
May 6, 2026
Merged

fix(contest): lock runtime workspace navigation#170
quan0715 merged 1 commit intomainfrom
dev

Conversation

@quan0715
Copy link
Copy Markdown
Owner

@quan0715 quan0715 commented May 6, 2026

Summary

  • Lock workspace navbar context switching while contest runtime/active exam navigation is read-only
  • Hide the classroom return entry only during runtime/active exams and use a left-arrow return affordance in /solve
  • Add runtime navigator compatibility exports so Vite dev requests resolve consistently

Verification

  • npm test -- src/features/contest/domain/contestRuntimePolicy.test.ts src/features/app/components/SideMenu.test.tsx
  • npx tsc -b --pretty false
  • git diff --check
  • node .codex/skills/qjudge-quality-gates-owner/scripts/lint-architecture.js --root frontend/src
  • pre-push hook: ESLint, TypeScript, frontend build, Docker Compose config

Note

  • Naming gate still reports existing repository violations, plus the compatibility context/provider filenames kept for Vite module stability.

Copilot AI review requested due to automatic review settings May 6, 2026 01:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens navigation behavior during contest runtime / active exam states by preventing workspace context switching, adjusting side menu “return” affordances, and adding compatibility exports for the runtime navigator provider to avoid Vite dev resolution issues.

Changes:

  • Added a runtime policy helper to decide when workspace navigation should be locked based on joined + exam status, with test coverage.
  • Updated workspace top nav context menus to become read-only (no dropdown switching) during runtime or locked navigation states, including styling tweaks.
  • Updated side menu sections to hide the “back to classroom” entry during runtime/active exam navigation and use a left-arrow overview icon in /solve; added runtime navigator provider/compat exports.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/features/contest/domain/contestRuntimePolicy.ts Adds shouldLockContestWorkspaceNavigation and supporting status set.
frontend/src/features/contest/domain/contestRuntimePolicy.test.ts Adds tests covering the new workspace-navigation locking policy.
frontend/src/features/contest/contexts/ContestRuntimeNavigatorProvider.ts Introduces provider implementation in a dedicated module.
frontend/src/features/contest/contexts/ContestRuntimeNavigatorContext.tsx Re-exports provider for compatibility.
frontend/src/features/contest/contexts/ContestRuntimeNavigatorContext.ts Adds .ts compatibility export for module resolution.
frontend/src/features/contest/components/exam/ExamNavigator.tsx Makes overview icon customizable via overviewIcon.
frontend/src/features/app/components/workspace/WorkspaceTopNav.tsx Applies runtime/read-only locking to context switch menus and click handling.
frontend/src/features/app/components/workspace/WorkspaceTopNav.module.scss Adds read-only styling for locked context links.
frontend/src/features/app/components/SideMenuContestRuntimeSection.tsx Uses a left-arrow overview icon for runtime navigator overview entry.
frontend/src/features/app/components/SideMenuContestIdleSection.tsx Adds hideClassroomBack option to conditionally hide classroom return link.
frontend/src/features/app/components/SideMenu.tsx Computes and passes hideClassroomBack based on runtime/lock policy.
frontend/src/features/app/components/SideMenu.scss Extends disabled styling to also apply when aria-disabled="true".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 171 to +179
const { isRuntime } = useContestRuntimeMode();
const effectiveOpenMenu = isRuntime ? null : openMenu;
const contestData = useOptionalContest();
const contestNavigationReadOnly =
isRuntime || shouldLockContestWorkspaceNavigation(contestData?.contest);
const effectiveOpenMenu = contestNavigationReadOnly ? null : openMenu;
const toggleMenu = useCallback((kind: Exclude<MenuKind, null>) => {
if (contestNavigationReadOnly) return;
setOpenMenu((menu) => menu === kind ? null : kind);
}, [contestNavigationReadOnly]);
Comment on lines +123 to +128
it("locks workspace navigation only while a joined exam is actively running", () => {
expect(
shouldLockContestWorkspaceNavigation(
createContest({ hasJoined: true, examStatus: "in_progress" }),
),
).toBe(true);
@quan0715 quan0715 merged commit b893c28 into main May 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants