feat: update button run scripts
ci-front / build (push) Successful in 2m35s

This commit is contained in:
nikita
2026-04-05 04:57:16 +03:00
parent f14490c076
commit d6512d6c97
5 changed files with 87 additions and 38 deletions
+10 -3
View File
@@ -41,6 +41,8 @@ const convertTreeToFileNode = (data: any[]): FileNode => {
export const TemplatesPage = () => {
const navigate = useNavigate();
const selectedPaths = useFilePickerStore((s) => s.selectedPaths);
const runningScripts = useFilePickerStore((s) => s.runningScripts);
const runScript = useFilePickerStore((s) => s.runScript);
const [files, setFiles] = useState<FileNode | null>(null);
const [loading, setLoading] = useState(true);
@@ -57,6 +59,12 @@ export const TemplatesPage = () => {
.finally(() => setLoading(false));
}, []);
const handleRun = async (path: string) => {
await runScript(path);
};
const runningCount = runningScripts.size;
return (
<div
style={{
@@ -91,8 +99,7 @@ export const TemplatesPage = () => {
>
<FiPlay size={13} color="#61c454" />
<span style={{ fontSize: "12px", color: "var(--text-secondary)" }}>
{selectedPaths.size} script{selectedPaths.size !== 1 ? "s" : ""}{" "}
running
{runningCount} script{runningCount !== 1 ? "s" : ""} running
</span>
</div>
@@ -145,7 +152,7 @@ export const TemplatesPage = () => {
/>
</div>
) : files ? (
<FilePicker files={files} />
<FilePicker files={files} onRun={handleRun} />
) : null}
</div>
</div>