path selecting element

This commit is contained in:
2025-07-22 13:55:15 -06:00
parent 01d137efcf
commit 67b67100c1
12 changed files with 338 additions and 54 deletions

View File

@@ -0,0 +1,40 @@
"use client";
import ClientOnly from "@/components/ClientOnly";
import { StoragePathSelector } from "@/components/form/StoragePathSelector";
import { SuspenseAndErrorHandling } from "@/components/SuspenseAndErrorHandling";
import { FC, useState } from "react";
export const AddExistingCourseToGlobalSettings = () => {
const [showForm, setShowForm] = useState(false);
return (
<div>
<div className="flex justify-center">
<button className="" onClick={() => setShowForm((i) => !i)}>
Add Existing Course
</button>
</div>
<div className={" collapsible " + (showForm && "expand")}>
<div className="border rounded-md p-3 m-3">
<SuspenseAndErrorHandling>
<ClientOnly>{showForm && <ExistingCourseForm />}</ClientOnly>
</SuspenseAndErrorHandling>
</div>
</div>
</div>
);
};
const ExistingCourseForm: FC<{}> = () => {
const [path, setPath] = useState("./");
return (
<div>
<h2>Add Existing Course</h2>
<StoragePathSelector
startingValue={path}
submitValue={setPath}
label={"Course Directory Path"}
/>
</div>
);
};