fix: add frontend registry entry for content-aware resize tool

The content-aware-resize tool had a full backend implementation (API route,
caire binary, seam-carving bridge) but was missing from the frontend
toolRegistry Map. Navigating to /content-aware-resize showed "Tool not found"
because ToolPage could not resolve a registry entry for the tool ID.

Added a dedicated ContentAwareResizeSettings component and registered it in
the tool registry with side-by-side display mode. Also added a guard test
that verifies every tool in the shared TOOLS[] array has a matching registry
entry, preventing this class of bug from recurring.

Closes #131
This commit is contained in:
SnapOtter
2026-05-07 09:38:38 +08:00
parent c9b24ada78
commit cc15821c5e
4 changed files with 297 additions and 0 deletions
+6
View File
@@ -72,6 +72,11 @@ export interface ToolRegistryEntry {
const ResizeSettings = lazy(() =>
import("@/components/tools/resize-settings").then((m) => ({ default: m.ResizeSettings })),
);
const ContentAwareResizeSettings = lazy(() =>
import("@/components/tools/content-aware-resize-settings").then((m) => ({
default: m.ContentAwareResizeSettings,
})),
);
const CropSettings = lazy(() =>
import("@/components/tools/crop-settings").then((m) => ({ default: m.CropSettings })),
);
@@ -457,6 +462,7 @@ export const toolRegistry = new Map<string, ToolRegistryEntry>([
["red-eye-removal", { displayMode: "before-after", Settings: RedEyeRemovalSettings }],
["restore-photo", { displayMode: "before-after", Settings: RestorePhotoSettings }],
["transparency-fixer", { displayMode: "before-after", Settings: TransparencyFixerSettings }],
["content-aware-resize", { displayMode: "side-by-side", Settings: ContentAwareResizeSettings }],
]);
export function getToolRegistryEntry(toolId: string): ToolRegistryEntry | undefined {