From 3ac04bd59cdcc41e29372ece8b35e37130d758e0 Mon Sep 17 00:00:00 2001 From: fccview Date: Mon, 18 Aug 2025 13:00:10 +0100 Subject: [PATCH] latest changes --- app/_components/BashEditor.tsx | 33 +- app/_components/CronJobForm.tsx | 348 ++++++++------- app/_components/CronJobList.tsx | 86 +++- app/_components/ScriptsManager.tsx | 416 ++++++++---------- app/_components/TabbedInterface.tsx | 66 +++ app/_components/modals/CloneScriptModal.tsx | 101 +++++ app/_components/modals/CloneTaskModal.tsx | 101 +++++ app/_components/modals/CreateScriptModal.tsx | 115 +++++ app/_components/modals/CreateTaskModal.tsx | 44 +- app/_components/modals/DeleteScriptModal.tsx | 106 +++++ app/_components/modals/EditScriptModal.tsx | 118 +++++ app/_components/ui/Toast.tsx | 117 +++++ app/_server/actions/cronjobs/index.ts | 94 ++-- app/_server/actions/scripts/index.ts | 210 +++++++-- app/_utils/scripts.ts | 22 + app/page.tsx | 40 +- data/scripts-metadata.json | 9 + data/scripts.json | 1 - docker-compose.yml | 9 +- ...ipt_1755515279446_cmfvd4ed7.sh => test.sh} | 0 20 files changed, 1543 insertions(+), 493 deletions(-) create mode 100644 app/_components/TabbedInterface.tsx create mode 100644 app/_components/modals/CloneScriptModal.tsx create mode 100644 app/_components/modals/CloneTaskModal.tsx create mode 100644 app/_components/modals/CreateScriptModal.tsx create mode 100644 app/_components/modals/DeleteScriptModal.tsx create mode 100644 app/_components/modals/EditScriptModal.tsx create mode 100644 app/_components/ui/Toast.tsx create mode 100644 app/_utils/scripts.ts create mode 100644 data/scripts-metadata.json delete mode 100644 data/scripts.json rename scripts/{script_1755515279446_cmfvd4ed7.sh => test.sh} (100%) diff --git a/app/_components/BashEditor.tsx b/app/_components/BashEditor.tsx index dc43bf7..2636d24 100644 --- a/app/_components/BashEditor.tsx +++ b/app/_components/BashEditor.tsx @@ -1,11 +1,10 @@ "use client"; -import { useState, useEffect } from "react"; +import { useState, useRef, useEffect } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/prism"; -import { Card, CardContent, CardHeader, CardTitle } from "./ui/Card"; import { Button } from "./ui/Button"; -import { Terminal, Copy, Check, Edit3 } from "lucide-react"; +import { Terminal, Copy, Check } from "lucide-react"; interface BashEditorProps { value: string; @@ -22,8 +21,8 @@ export function BashEditor({ className = "", label = "Bash Script", }: BashEditorProps) { - const [isEditing, setIsEditing] = useState(false); const [copied, setCopied] = useState(false); + const textareaRef = useRef(null); const handleCopy = async () => { await navigator.clipboard.writeText(value); @@ -31,12 +30,19 @@ export function BashEditor({ setTimeout(() => setCopied(false), 2000); }; - const handleFocus = () => { - setIsEditing(true); - }; + // Sync scroll position between textarea and syntax highlighter + const handleScroll = () => { + if (textareaRef.current) { + const scrollTop = textareaRef.current.scrollTop; + const scrollLeft = textareaRef.current.scrollLeft; - const handleBlur = () => { - setIsEditing(false); + const syntaxElement = textareaRef.current + .nextElementSibling as HTMLElement; + if (syntaxElement) { + syntaxElement.scrollTop = scrollTop; + syntaxElement.scrollLeft = scrollLeft; + } + } }; const SyntaxHighlighterComponent = SyntaxHighlighter as any; @@ -66,22 +72,23 @@ export function BashEditor({ )}