From 85db05f88968dd97425cadcddd12588779e1168a Mon Sep 17 00:00:00 2001 From: hatim dinia Date: Tue, 10 Sep 2024 10:47:23 +0200 Subject: [PATCH] refactor(ui): remove unused `fillPatternRef` --- .../components/common/MatrixGrid/index.tsx | 20 ++----------------- .../src/components/common/MatrixGrid/utils.ts | 4 ++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/webapp/src/components/common/MatrixGrid/index.tsx b/webapp/src/components/common/MatrixGrid/index.tsx index 17efe20965..48c736df0b 100644 --- a/webapp/src/components/common/MatrixGrid/index.tsx +++ b/webapp/src/components/common/MatrixGrid/index.tsx @@ -7,7 +7,7 @@ import DataEditor, { Item, } from "@glideapps/glide-data-grid"; import { useGridCellContent } from "./useGridCellContent"; -import { useMemo, useRef, useState } from "react"; +import { useMemo, useState } from "react"; import { type CellFillPattern, type EnhancedGridColumn } from "./types"; import { darkTheme, readOnlyDarkTheme } from "./utils"; import { useColumnMapping } from "./useColumnMapping"; @@ -47,8 +47,6 @@ function MatrixGrid({ rows: CompactSelection.empty(), }); - const fillPatternRef = useRef(null); - const { gridToData } = useColumnMapping(columns); const theme = useMemo(() => { @@ -119,27 +117,14 @@ function MatrixGrid({ } if (onMultipleCellsEdit) { - onMultipleCellsEdit(updates, fillPatternRef.current || undefined); + onMultipleCellsEdit(updates); } - // Reset fillPatternRef after use - fillPatternRef.current = null; - // Return true to prevent calling `onCellEdit` // for each cell after`onMultipleCellsEdit` is called return true; }; - // Used for fill handle updates to send one batch update object - // instead of an array of updates using `onCellsEdited` callback - const handleFillPattern = ({ - patternSource, - fillDestination, - }: CellFillPattern) => { - fillPatternRef.current = { patternSource, fillDestination }; - // Don't prevent default, allow the grid to apply the fill pattern - }; - //////////////////////////////////////////////////////////////// // JSX //////////////////////////////////////////////////////////////// @@ -160,7 +145,6 @@ function MatrixGrid({ getCellsForSelection // Enable copy support onPaste fillHandle - onFillPattern={handleFillPattern} rowMarkers="both" />
diff --git a/webapp/src/components/common/MatrixGrid/utils.ts b/webapp/src/components/common/MatrixGrid/utils.ts index f9cfb1e900..66278fe838 100644 --- a/webapp/src/components/common/MatrixGrid/utils.ts +++ b/webapp/src/components/common/MatrixGrid/utils.ts @@ -23,9 +23,9 @@ export const ColumnDataType = { //////////////////////////////////////////////////////////////// export const darkTheme: Theme = { - accentColor: "#6366F1", + accentColor: "rgba(255, 184, 0, 0.9)", + accentLight: "rgba(255, 184, 0, 0.2)", accentFg: "#FFFFFF", - accentLight: "rgba(99, 102, 241, 0.2)", textDark: "#FFFFFF", textMedium: "#C1C3D9", textLight: "#A1A5B9",