import { useEffect, useRef, useState } from "react"; import { DndContext, closestCenter, PointerSensor, TouchSensor, useSensor, useSensors, } from "@dnd-kit/core"; import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy, } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { BiCopy, BiDotsVertical, BiX } from "react-icons/bi"; import { DengiButton, DengiYesOrNoDialog, LoadingSpinner, } from "./trash-components"; import { motion, AnimatePresence } from "motion/react"; import { BiCheck, BiPlus, BiRedo, BiTime, BiTrash, BiUndo, } from "react-icons/bi"; // import { ifstyle } from "../App"; import { apiFormatDate, convertApiToEditor, convertEditorToApi, formatDate, } from "./dengi"; import { EditorPrefillRequest, EditorPublishRequest, EditorRemoveRequest, } from "./editor_req_mgr"; import { API_BASE_URL } from "../App"; // Configuration const COLUMNS = [ [ { key: "position", label: "номер", width: "w-9", placeholder: "№", useinput: true, }, { key: "subject", label: "предмет", width: "w-40", placeholder: "предмет", useinput: false, }, { key: "room", label: "кабинет", width: "w-14", placeholder: "123", useinput: false, }, { key: "time1", label: "начало", width: "w-16", placeholder: "00:00", useinput: true, }, { key: "time2", label: "конец", width: "w-16", placeholder: "00:00", useinput: true, }, ], [ { key: "position", label: "номер", width: "w-9", placeholder: "№", useinput: true, }, { key: "subject", label: "предмет", width: "w-40", placeholder: "предмет", useinput: false, }, { key: "room", label: "кабинет", width: "w-14", placeholder: "123", useinput: false, }, ], [ { key: "position", label: "номер", width: "w-9", placeholder: "№", useinput: true, }, { key: "time1", label: "начало", width: "w-16", placeholder: "00:00", useinput: true, }, { key: "time2", label: "конец", width: "w-16", placeholder: "00:00", useinput: true, }, ], ]; const INITIAL_DATA = [ // { // id: "1", // position: "1", // subject: "Mathematics", // time: "09:00", // room: "A-1", // }, // { id: "2", position: "2", subject: "Physics", time: "10:00", room: "B-2" }, // { id: "3", position: "3", subject: "Chemistry", time: "11:00", room: "A-3" }, // { id: "4", position: "4", subject: "Biology", time: "13:00", room: "C-1" }, ]; function TableInput(props) { return props.useinput ? :