diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e0e629..06204ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/); until 1.0, minor versions may contain breaking changes. +## [Unreleased] + +### Added + +- **New folder in the folder picker:** creating an automation or a chat, *New folder* creates a + subfolder of the shown folder and selects it. + ## [v202611-00013] – 2026-11-10 ### Added diff --git a/web/src/components/NewSession.tsx b/web/src/components/NewSession.tsx index 5a8c70f..0b65ebc 100644 --- a/web/src/components/NewSession.tsx +++ b/web/src/components/NewSession.tsx @@ -1,6 +1,7 @@ import { Icon } from "./Icon"; import { useEffect, useMemo, useRef, useState, type ReactNode } from "react"; import { post, uploadFile } from "../api"; +import { promptDialog, toast } from "../dialogs"; import { useAgents, useFetch } from "../hooks"; import { useT, type Key } from "../i18n"; import type { ImageData } from "../types"; @@ -602,6 +603,20 @@ export function FolderPicker({ path, onPick }: { path: string; onPick: (p: strin // eslint-disable-next-line react-hooks/exhaustive-deps }, [listing?.path]); const rel = listing ? listing.path.slice(listing.workspace.length) || "/" : ""; + /** Create a subfolder of the shown folder and select it. */ + const newFolder = async () => { + if (!listing) return; + const name = (await promptDialog({ title: t("files.newFolder"), message: t("files.newFolderName") }))?.trim(); + if (!name) return; + if (name.includes("/") || name === "." || name === "..") return toast(t("new.invalidFolderName")); + const target = `${listing.path.replace(/\/$/, "")}/${name}`; + try { + await post("/files/create", { path: target, dir: true }); + setBrowse(target); + } catch (e: any) { + toast(e.message); + } + }; return (