-
ระบบหยุด Autosave ไว้เพื่อไม่ให้ Draft นี้เขียนทับข้อมูลล่าสุด{conflictVersion ? ` (version ${conflictVersion})` : ""}
-
- {onReloadLatest ? : null}
- {onOverwrite ? : null}
-
+ if (state === "saving")
+ return (
+
+
+ Saving…
+
+ );
+ if (state === "unsaved")
+ return (
+
+
+ Waiting to save…
+
+ );
+ if (state === "incomplete")
+ return (
+
+
+ {showIssues ? (
+
+
+ กรุณากรอกข้อมูลให้ครบ
+
+
+
+ แก้ไขรายการด้านล่าง แล้วระบบจะบันทึกให้อัตโนมัติ
+ ข้อมูลที่กรอกไว้ยังไม่หาย
+
+ {issues.length ? (
+
+ {issues.map((issue, index) => (
+ - {issue}
+ ))}
+
+ ) : null}
+
+
+
+ ) : null}
-
- ;
- if (state === "error") return
Autosave failed{onSave ?
: null}
;
- return
Saved;
+ );
+ if (state === "conflict")
+ return (
+
+
+ มีการบันทึกข้อมูลใหม่จากผู้แก้ไขคนอื่น
+
+
+
+ ระบบหยุด Autosave ไว้เพื่อไม่ให้ Draft นี้เขียนทับข้อมูลล่าสุด
+ {conflictVersion ? ` (version ${conflictVersion})` : ""}
+
+
+ {onReloadLatest ? (
+
+ ) : null}
+ {onOverwrite ? (
+
+ ) : null}
+
+
+
+
+ );
+ if (state === "error")
+ return (
+
+
+
+ Autosave failed
+
+ {onSave ? (
+
+ ) : null}
+
+ );
+ return (
+
+
+ Saved
+
+ );
}
diff --git a/components/admin/extra-sheet-editor.tsx b/components/admin/extra-sheet-editor.tsx
index e2e054d..46c598f 100644
--- a/components/admin/extra-sheet-editor.tsx
+++ b/components/admin/extra-sheet-editor.tsx
@@ -17,7 +17,14 @@ import Spreadsheet, {
type RowIndicatorProps,
type SpreadsheetRef,
} from "react-spreadsheet";
-import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react";
+import {
+ useCallback,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ type KeyboardEvent,
+} from "react";
import {
closestCenter,
DndContext,
@@ -90,8 +97,8 @@ const sameAxisCollision: CollisionDetection = (args) => {
const axis = String(args.active.id).split(":", 1)[0];
return closestCenter({
...args,
- droppableContainers: args.droppableContainers.filter(
- (container) => String(container.id).startsWith(`${axis}:`),
+ droppableContainers: args.droppableContainers.filter((container) =>
+ String(container.id).startsWith(`${axis}:`),
),
});
};
@@ -103,13 +110,23 @@ function movedIndex(current: number, from: number, to: number): number {
return current;
}
-function LiteralDataViewer({ cell }: { cell?: { value?: unknown; backgroundColor?: string } }) {
+function LiteralDataViewer({
+ cell,
+}: {
+ cell?: { value?: unknown; backgroundColor?: string };
+}) {
return (
-
+
);
}
@@ -153,14 +170,25 @@ function EditableColumnIndicator({
selected,
onRename,
}: ColumnIndicatorProps & { id: string; onRename: (column: number) => void }) {
- const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
+ const {
+ attributes,
+ listeners,
+ setNodeRef,
+ transform,
+ transition,
+ isDragging,
+ } = useSortable({
id,
strategy: horizontalListSortingStrategy,
});
return (
|