From e993c21a744d76f403a90f06767c4e8ce5224341 Mon Sep 17 00:00:00 2001 From: rharkor Date: Tue, 3 Sep 2024 14:36:24 +0200 Subject: [PATCH] feat: edit dest --- package-lock.json | 1 + packages/cli/package.json | 1 + .../src/app/src/api/configuration/schemas.ts | 8 +- .../components/current-configuration.dr.ts | 1 + .../app/components/current-configuration.tsx | 43 +++++++--- packages/cli/src/app/src/langs/en.json | 3 +- packages/cli/src/app/src/langs/fr.json | 3 +- .../src/app/src/lib/configuration/index.ts | 7 +- packages/cli/src/app/tsconfig.tsbuildinfo | 2 +- .../scripts/src/ci-check/templates-config.ts | 40 ++++----- .../src/utils/template-config/index.ts | 84 +++++++++++-------- 11 files changed, 108 insertions(+), 85 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9db15cf0..f1c557a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17613,6 +17613,7 @@ "@nextui-org/button": "^2.0.37", "@nextui-org/checkbox": "^2.1.4", "@nextui-org/chip": "^2.0.32", + "@nextui-org/divider": "^2.0.31", "@nextui-org/dropdown": "^2.1.29", "@nextui-org/input": "^2.2.4", "@nextui-org/link": "^2.0.34", diff --git a/packages/cli/package.json b/packages/cli/package.json index bafecd8e..f4a1d2db 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -84,6 +84,7 @@ "@nextui-org/button": "^2.0.37", "@nextui-org/checkbox": "^2.1.4", "@nextui-org/chip": "^2.0.32", + "@nextui-org/divider": "^2.0.31", "@nextui-org/dropdown": "^2.1.29", "@nextui-org/input": "^2.2.4", "@nextui-org/link": "^2.0.34", diff --git a/packages/cli/src/app/src/api/configuration/schemas.ts b/packages/cli/src/app/src/api/configuration/schemas.ts index 269fb3ce..54618347 100644 --- a/packages/cli/src/app/src/api/configuration/schemas.ts +++ b/packages/cli/src/app/src/api/configuration/schemas.ts @@ -5,13 +5,7 @@ import { fullPluginSchema } from "@/lib/plugins/store" export const configurationSchema = () => z.object({ name: z.string().optional(), - plugins: z - .array( - fullPluginSchema.extend({ - outputPath: z.string().optional(), - }) - ) - .optional(), + plugins: z.array(fullPluginSchema).optional(), }) export type TConfiguration = z.infer> diff --git a/packages/cli/src/app/src/app/components/current-configuration.dr.ts b/packages/cli/src/app/src/app/components/current-configuration.dr.ts index b602a891..a262c68a 100644 --- a/packages/cli/src/app/src/app/components/current-configuration.dr.ts +++ b/packages/cli/src/app/src/app/components/current-configuration.dr.ts @@ -13,6 +13,7 @@ export const CurrentConfigurationDr = dictionaryRequirements( outputPath: true, save: true, close: true, + pluginSettings: true, }, NoConfigurationDr, HeaderDr diff --git a/packages/cli/src/app/src/app/components/current-configuration.tsx b/packages/cli/src/app/src/app/components/current-configuration.tsx index 165d472a..5888b001 100644 --- a/packages/cli/src/app/src/app/components/current-configuration.tsx +++ b/packages/cli/src/app/src/app/components/current-configuration.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from "react" +import { Fragment, useRef, useState } from "react" import { AnimatePresence, motion } from "framer-motion" import { Eye, MoreHorizontal, Pencil } from "lucide-react" @@ -15,7 +15,9 @@ import { TDictionary } from "@/lib/langs" import { trpc } from "@/lib/trpc/client" import { RouterOutputs } from "@/lib/trpc/utils" import { Button } from "@nextui-org/button" +import { Divider } from "@nextui-org/divider" import { Dropdown, DropdownItem, DropdownMenu, DropdownTrigger } from "@nextui-org/dropdown" +import { Input } from "@nextui-org/input" import { Modal, ModalBody, ModalContent, ModalFooter, useDisclosure } from "@nextui-org/modal" import { Spinner } from "@nextui-org/spinner" @@ -234,8 +236,16 @@ function Plugin({ onClose: onEditClose, } = useDisclosure() + const [overridedTo, setOverridedTo] = useState>({}) + const onEdit = async () => { - await _onEdit(plugin) + await _onEdit({ + ...plugin, + paths: plugin.paths.map((p) => ({ + from: plugin.sourcePath, + to: overridedTo[p.to] ?? p.to, + })), + }) onEditClose() } @@ -321,16 +331,27 @@ function Plugin({ {(onClose) => ( <> - Modal Title + {dictionary.pluginSettings} - {/* //TODO EDIT ALL PATHS */} - {/* - */} + {plugin.paths.map((p, i) => ( + + {i !== 0 && } +
+ + { + setOverridedTo((prev) => ({ + ...prev, + [p.to]: value, + })) + }} + placeholder={p.to} + label={dictionary.outputPath} + /> +
+
+ ))}