From 0b63d882ab0ddc23711eca8181f2e40d476fa631 Mon Sep 17 00:00:00 2001 From: Codex Review Integration Date: Wed, 16 Sep 2026 19:05:02 -0300 Subject: [PATCH] refactor(services): split registry management view --- .../services-registry-components.tsx | 342 ++++++++++ .../_components/services-registry-view.tsx | 201 ++++++ src/app/(protected)/settings/services.tsx | 610 +----------------- src/domain/services/api/services-api.ts | 19 +- .../use-services-registry-controller.ts | 223 +++++++ .../domain/services/api/services-api.test.ts | 10 +- 6 files changed, 793 insertions(+), 612 deletions(-) create mode 100644 src/app/(protected)/settings/_components/services-registry-components.tsx create mode 100644 src/app/(protected)/settings/_components/services-registry-view.tsx create mode 100644 src/domain/services/use-cases/use-services-registry-controller.ts diff --git a/src/app/(protected)/settings/_components/services-registry-components.tsx b/src/app/(protected)/settings/_components/services-registry-components.tsx new file mode 100644 index 00000000..81fff5cb --- /dev/null +++ b/src/app/(protected)/settings/_components/services-registry-components.tsx @@ -0,0 +1,342 @@ +import { + Autocomplete, + Box, + Button, + Checkbox, + Chip, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + Divider, + Drawer, + FormControl, + FormControlLabel, + FormHelperText, + InputLabel, + MenuItem, + Select, + Stack, + Switch, + TextField, + Typography, +} from "@mui/material"; +import { Droplets, Hammer, Settings2, Wrench, Zap } from "lucide-react"; +import type { DropdownOption } from "@/domain/settings/dropdown-options/types/dropdown-option"; +import type { TaskTemplate } from "@/domain/settings/task-templates/types/task-template"; +import { + SERVICE_WORK_ORDER_TYPES, + type Service, + type ServiceWorkOrderType, +} from "@/domain/services/types/service"; +import type { ServiceForm } from "@/domain/services/use-cases/use-services-registry-controller"; + +const ICONS = [ + { key: "wrench", label: "Wrench", Icon: Wrench }, + { key: "droplets", label: "Droplets", Icon: Droplets }, + { key: "zap", label: "Zap", Icon: Zap }, + { key: "hammer", label: "Hammer", Icon: Hammer }, + { key: "settings", label: "Settings", Icon: Settings2 }, +] as const; + +export function ServiceIcon({ iconKey, size = 18 }: { iconKey: string; size?: number }) { + const icon = ICONS.find((item) => item.key === iconKey) ?? ICONS[0]; + const Icon = icon.Icon; + return