fix : bg color
CI / Verify (push) Successful in 1m19s
CI / Build immutable images and deploy (push) Successful in 1m51s

This commit is contained in:
2026-09-05 18:51:43 +07:00 Unverified
parent 75e3e22e9b
commit 612a8494ac
+13 -4
View File
@@ -13,7 +13,7 @@ import {
Trash2Icon,
} from "lucide-react";
import Spreadsheet, { type ColumnIndicatorProps, type DataEditorProps, type Point, type Selection } from "react-spreadsheet";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { DeleteConfirmationDialog } from "@/components/admin/delete-confirmation-dialog";
import { RichTextContent } from "@/components/rich-text-content";
@@ -126,6 +126,7 @@ export function ExtraSheetEditor({
const [cellDialogOpen, setCellDialogOpen] = useState(false);
const [cellDraft, setCellDraft] = useState("");
const [selection, setSelection] = useState<Selection | null>(null);
const colorSelectionRef = useRef<Point[] | null>(null);
const matrix = useMemo(() => extraSheetToMatrix(value), [value]);
const activeColumn = value.columns[active.column];
const activeRow = value.rows[active.row];
@@ -224,9 +225,17 @@ export function ExtraSheetEditor({
aria-label="เลือกสีพื้นหลังเซลล์"
className="absolute inset-0 cursor-pointer opacity-0"
value={activeRow?.backgrounds?.[activeColumn?.id ?? ""] ?? DEFAULT_CELL_BACKGROUND}
onChange={(event) => onChange(updateExtraSheetCells(value, selectedPoints(), {
backgroundColor: event.target.value,
}))}
onPointerDown={() => {
colorSelectionRef.current = selectedPoints();
}}
onChange={(event) => {
onChange(updateExtraSheetCells(
value,
colorSelectionRef.current ?? selectedPoints(),
{ backgroundColor: event.target.value },
));
colorSelectionRef.current = null;
}}
/>
</label>
<Button