feat(canvas): preview generated task images in app
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Task: Add enlarged image preview to AI Design task results
|
||||
|
||||
## Identity
|
||||
|
||||
- Task ID: 20260915-design-image-preview-b24997a6
|
||||
- Mode: Feature
|
||||
- Branch: codex/20260915-design-image-preview-b24997a6-design-image-preview
|
||||
- Worktree: D:\Datas\OthersProjects\.codex-worktrees\makelore\20260915-design-image-preview-b24997a6
|
||||
- Base commit: 80e52496d2696c3b579c911ee7c07f9588b368a6
|
||||
- Owner: codex
|
||||
- Status: Ready for Integration
|
||||
|
||||
## Scope
|
||||
|
||||
- Add an in-app enlarged image viewer to generated images in AI Design task history, on desktop and compact layouts. Preserve the existing download action.
|
||||
- Own DesignPlanHistory, its new image-preview component, focused unit/Electron coverage, README, and this record.
|
||||
|
||||
## Intent And Constraints
|
||||
|
||||
- Concurrent Gate Passed: bundled check/start succeeded and status confirmed the exact task, feature mode, branch, worktree and base above. Main contains three pre-existing untracked task records, so work is isolated from main.
|
||||
- Planning Gate Passed: read agent entry, own task, memory index, positioning, integrated state, decision index, architecture, domain/success criteria, ADR-007, evidence/reflection/commitment/stale indexes and peer task scopes. Most registered peers are completed packaging/integration or historical reviews; active known work is unrelated, except an old Enter-key E2E test in a retired file. Placeholder peer scopes remain unknown, with no concrete semantic dependency on this feature.
|
||||
- Positioning contains placeholders; use README, executable code and accepted V2 rules. Asset URL resolution remains through the existing Main-owned Host API helper. No contract, generation, billing, provider, persistence or global theme change.
|
||||
- User prohibits subagents without consent; implementation and verification are performed directly.
|
||||
- Implement a persistent enlarge icon beside download, a light modal that fits the complete image, optional native-size scrolling, load/error state, and accessible close/Escape behavior. Reset preview across Workspace switches.
|
||||
- Verify selected-asset correctness, absence of download side effects, failures and dismissal with focused tests; verify rendered dimensions and desktop/compact interaction in Electron, then typecheck/lint/build for renderer integration.
|
||||
|
||||
## Outcome
|
||||
|
||||
- Generated image thumbnails now expose a persistent enlarge button beside the existing download button in task history. Desktop rail and compact conversation history share the same implementation.
|
||||
- The light in-app dialog uses the existing canonical Asset content URL, initially fits the complete image, and supports native-size scrolling, dimensions, loading/error feedback, close button, Escape, and focus restoration. Viewing never calls the download endpoint. Video actions remain unchanged.
|
||||
- Workspace changes remount history content to dismiss the old preview; reopening resets the viewer and permits retry after a load error. README reflects the new behavior.
|
||||
- Feature complete in the isolated task branch; no main merge, push, package or installed-client update performed.
|
||||
|
||||
## Verification
|
||||
|
||||
- Exact pinned pnpm 10.33.4; frozen-lockfile install succeeded without lockfile changes.
|
||||
- `pnpm run typecheck`: passed.
|
||||
- `pnpm exec vitest run tests/unit/design-image-preview.test.tsx tests/unit/image-canvas-page.test.tsx tests/unit/image-workspace-api.test.ts --maxWorkers=4`: 31 passed, including five new preview cases. Covers selected result, image-only action, fit/native mode, reopening, close/Escape/focus, independent download, URL/image failures, and Workspace changes.
|
||||
- Scoped ESLint over both changed product files and both test files: passed with no warnings or errors.
|
||||
- `pnpm run build:vite`: all Renderer/Main/Preload/utility targets passed. Existing Browserslist age, chunk-size and mixed-import warnings remain; none prevented compilation.
|
||||
- `pnpm exec playwright test tests/e2e/image-workspace-v2.spec.ts -g 'keeps conversation'`: 1 passed on Windows Electron. Existing V2 edit/confirmation flow remains covered; completed task preview verifies a 1600×2400 fixture, fit behavior, exact native dimensions and scrolling, Escape/focus restoration, 375px compact bounds and close action, with zero download requests.
|
||||
- Electron uses deterministic local Host API/media fixtures; no paid generation or production asset access is claimed. The full unrelated unit suite was not run.
|
||||
- Task Documentation Gate: reviewed changes against recorded base; `git diff --check` and the bundled task-aware documentation drift check passed.
|
||||
|
||||
## Follow-ups
|
||||
|
||||
- Integrate this feature branch and rebuild the desktop client to deliver the button to installed users.
|
||||
|
||||
## Promotion Candidates
|
||||
|
||||
- None. This is a local presentation improvement within the accepted V2 Asset and Main-network boundaries; README documents the user-visible behavior without changing canonical architecture or domain rules.
|
||||
Reference in New Issue
Block a user