+
l.id)} strategy={verticalListSortingStrategy}>
{items.map((lesson) => (
@@ -139,12 +184,25 @@ export function SortableLessons({
{items.length === 0 && (
-
Уроков пока нет. Добавьте первый.
+
+ Уроков пока нет. Добавьте первый.
+
)}
-
);
diff --git a/src/components/admin/sortable-modules.tsx b/src/components/admin/sortable-modules.tsx
index bc643de..0f4cc29 100644
--- a/src/components/admin/sortable-modules.tsx
+++ b/src/components/admin/sortable-modules.tsx
@@ -17,8 +17,6 @@ import {
} from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import Link from "next/link";
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
import { createModule, deleteModule, updateModule, reorderModules } from "@/app/admin/courses/[courseId]/actions";
interface Module {
@@ -28,14 +26,9 @@ interface Module {
_count: { lessons: number };
}
-function SortableModule({
- mod,
- courseId,
-}: {
- mod: Module;
- courseId: string;
-}) {
+function SortableModule({ mod, courseId }: { mod: Module; courseId: string }) {
const [editing, setEditing] = useState(false);
+ const [editValue, setEditValue] = useState(mod.title);
const [pending, startTransition] = useTransition();
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
useSortable({ id: mod.id });
@@ -43,7 +36,7 @@ function SortableModule({
const style = {
transform: CSS.Transform.toString(transform),
transition,
- opacity: isDragging ? 0.5 : 1,
+ opacity: isDragging ? 0.4 : 1,
};
function handleUpdate(e: React.FormEvent
) {
@@ -59,30 +52,72 @@ function SortableModule({
}
return (
-
-