Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 12, 2023
1 parent 2f056e7 commit 700775e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 42 deletions.
26 changes: 8 additions & 18 deletions taxonium_component/src/Deck.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Deck({
isCurrentlyOutsideBounds,
deckRef,
jbrowseRef,
setAdditionalColorMapping
setAdditionalColorMapping,
}) {
const zoomReset = view.zoomReset;
const snapshot = useSnapshot(deckRef);
Expand Down Expand Up @@ -78,8 +78,6 @@ function Deck({

const mouseDownPos = useRef();



const onClickOrMouseMove = useCallback(
(event) => {
if (event.buttons === 0 && event._reactName === "onPointerMove") {
Expand Down Expand Up @@ -264,21 +262,14 @@ function Deck({
<ColorSettingModal
isOpen={colorSettingOpen}
setIsOpen={setColorSettingOpen}
color = {colorHook.toRGB(currentColorSettingKey)}
setColor = {

(color) => {
setAdditionalColorMapping(x => {
return {...x, [currentColorSettingKey]: color};
});
}

}
title = {currentColorSettingKey}
color={colorHook.toRGB(currentColorSettingKey)}
setColor={(color) => {
setAdditionalColorMapping((x) => {
return { ...x, [currentColorSettingKey]: color };
});
}}
title={currentColorSettingKey}
/>



<DeckGL
pickingRadius={10}
//getCursor={() => hoverInfo && hoverInfo.object ? "default" : "pointer"}
Expand Down Expand Up @@ -364,7 +355,6 @@ function Deck({
config={config}
setCurrentColorSettingKey={setCurrentColorSettingKey}
setColorSettingOpen={setColorSettingOpen}

/>
<DeckButtons
zoomReset={zoomReset}
Expand Down
2 changes: 1 addition & 1 deletion taxonium_component/src/Taxonium.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 7 additions & 11 deletions taxonium_component/src/components/ColorSettingModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
};

Expand All @@ -24,19 +24,15 @@ const ColorSettingModal = ({ isOpen, setIsOpen, color, setColor, title }) => {
contentLabel={title}
>
<h2 className="font-medium mb-5 text-lg">{title}</h2>

<div className="space-y-3">
<div>
<label>
Select Color:
<ColorPicker
color={color}
setColor={setColor}
/>
Select Color:
<ColorPicker color={color} setColor={setColor} />
</label>
</div>
</div>

</Modal>
);
};
Expand Down
17 changes: 6 additions & 11 deletions taxonium_component/src/components/Key.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const Key = ({
colorByPosition,
config,
setCurrentColorSettingKey,
setColorSettingOpen


setColorSettingOpen,
}) => {
const numLegendEntries = 10;
const [collapsed, setCollapsed] = useState(window.innerWidth < 800);
Expand Down Expand Up @@ -58,13 +56,10 @@ const Key = ({
<div
className="key-text text-xs text-gray-700 mt-0.5 break-all cursor-pointer"
key={index}
onClick={() =>
{
setCurrentColorSettingKey(item.value);
setColorSettingOpen(true);
}

}
onClick={() => {
setCurrentColorSettingKey(item.value);
setColorSettingOpen(true);
}}
title="Edit color"
>
<div
Expand All @@ -75,7 +70,7 @@ const Key = ({
</div>
);
})}

{isTruncated && <div className="text-xs text-gray-700">...</div>}
</>
)}
Expand Down
2 changes: 1 addition & 1 deletion taxonium_component/src/hooks/useColor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 700775e

Please sign in to comment.