From d6be3e1ef585506711093616763d80fed1816785 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:47:26 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taxonium_component/src/Deck.jsx | 108 ++++++++---------- taxonium_component/src/Taxonium.jsx | 2 +- .../src/components/ColorSettingModal.jsx | 18 ++- .../src/components/DeckButtons.jsx | 1 - taxonium_component/src/components/Key.jsx | 17 +-- taxonium_component/src/hooks/useColor.jsx | 2 +- 6 files changed, 63 insertions(+), 85 deletions(-) diff --git a/taxonium_component/src/Deck.jsx b/taxonium_component/src/Deck.jsx index 7bc54d8c..8308ae19 100644 --- a/taxonium_component/src/Deck.jsx +++ b/taxonium_component/src/Deck.jsx @@ -43,7 +43,7 @@ function Deck({ isCurrentlyOutsideBounds, deckRef, jbrowseRef, - setAdditionalColorMapping + setAdditionalColorMapping, }) { const zoomReset = view.zoomReset; const snapshot = useSnapshot(deckRef); @@ -78,8 +78,6 @@ function Deck({ const mouseDownPos = useRef(); - - const onClickOrMouseMove = useCallback( (event) => { if (event.buttons === 0 && event._reactName === "onPointerMove") { @@ -264,62 +262,54 @@ function Deck({ { - setAdditionalColorMapping(x => { - return {...x, [currentColorSettingKey]: color}; - }); - } - - } - title = {currentColorSettingKey} + color={colorHook.toRGB(currentColorSettingKey)} + setColor={(color) => { + setAdditionalColorMapping((x) => { + return { ...x, [currentColorSettingKey]: color }; + }); + }} + title={currentColorSettingKey} /> - - - setDeckSettingsOpen(true)} - settings={settings} - /> - - + hoverInfo={hoverInfo} + hoverDetails={hoverDetails} + colorHook={colorHook} + colorBy={colorBy} + config={config} + filterMutations={settings.filterMutations} + deckSize={deckSize} + /> + + + setDeckSettingsOpen(true)} + settings={settings} + /> hoverInfo && hoverInfo.object ? "default" : "pointer"} @@ -379,9 +369,7 @@ function Deck({ settings={settings} /> - - - + ); diff --git a/taxonium_component/src/Taxonium.jsx b/taxonium_component/src/Taxonium.jsx index aef794c3..e974c874 100644 --- a/taxonium_component/src/Taxonium.jsx +++ b/taxonium_component/src/Taxonium.jsx @@ -98,7 +98,7 @@ function Taxonium({ const colorBy = useColorBy(config, query, updateQuery); const [additionalColorMapping, setAdditionalColorMapping] = useState({}); const colorMapping = useMemo(() => { - const initial = config.colorMapping ? config.colorMapping : {}; + const initial = config.colorMapping ? config.colorMapping : {}; return { ...initial, ...additionalColorMapping }; }, [config.colorMapping, additionalColorMapping]); const colorHook = useColor(colorMapping); diff --git a/taxonium_component/src/components/ColorSettingModal.jsx b/taxonium_component/src/components/ColorSettingModal.jsx index 638e91ce..b1410794 100644 --- a/taxonium_component/src/components/ColorSettingModal.jsx +++ b/taxonium_component/src/components/ColorSettingModal.jsx @@ -8,10 +8,10 @@ const modalStyle = { left: "50%", transform: "translate(-50%, -50%)", backgroundColor: "#fafafa", - border: '1px solid #e2e8f0', - borderRadius: '8px', - padding: '20px', - maxWidth: '400px', + border: "1px solid #e2e8f0", + borderRadius: "8px", + padding: "20px", + maxWidth: "400px", }, }; @@ -24,19 +24,15 @@ const ColorSettingModal = ({ isOpen, setIsOpen, color, setColor, title }) => { contentLabel={title} >

{title}

- +
- ); }; diff --git a/taxonium_component/src/components/DeckButtons.jsx b/taxonium_component/src/components/DeckButtons.jsx index 922eee88..27adc5f6 100644 --- a/taxonium_component/src/components/DeckButtons.jsx +++ b/taxonium_component/src/components/DeckButtons.jsx @@ -47,7 +47,6 @@ export const DeckButtons = ({ zIndex: 10, pointerEvents: "none", }} - className="flex flex-col items-end" >
{ const numLegendEntries = 10; const [collapsed, setCollapsed] = useState(window.innerWidth < 800); @@ -60,13 +58,10 @@ const Key = ({
- { - setCurrentColorSettingKey(item.value); - setColorSettingOpen(true); - } - - } + onClick={() => { + setCurrentColorSettingKey(item.value); + setColorSettingOpen(true); + }} title="Edit color" >
); })} - + {isTruncated &&
...
} )} diff --git a/taxonium_component/src/hooks/useColor.jsx b/taxonium_component/src/hooks/useColor.jsx index b04175b9..d5fcb755 100644 --- a/taxonium_component/src/hooks/useColor.jsx +++ b/taxonium_component/src/hooks/useColor.jsx @@ -140,7 +140,7 @@ const useColor = (colorMapping) => { const toRGB = useCallback( (string) => { - if (rgb_cache[string]&& !colorMapping[string]) { + if (rgb_cache[string] && !colorMapping[string]) { return rgb_cache[string]; } else { const result = toRGB_uncached(string);