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 98ce57a commit d6be3e1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 85 deletions.
108 changes: 48 additions & 60 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,62 +262,54 @@ 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}
/>
<NodeHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
filterMutations={settings.filterMutations}
deckSize={deckSize}
/>
<TreenomeMutationHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
treenomeReferenceInfo={treenomeReferenceInfo}
/>
<MemoizedKey
keyStuff={keyStuff}
colorByField={colorBy.colorByField}
colorByGene={colorBy.colorByGene}
colorByPosition={colorBy.colorByPosition}
config={config}
setCurrentColorSettingKey={setCurrentColorSettingKey}
setColorSettingOpen={setColorSettingOpen}

/>
<DeckButtons
// we want this to intercept all mouse events
// so that we can prevent the default behavior
// of the browser


zoomReset={zoomReset}
zoomIncrement={zoomIncrement}
zoomAxis={zoomAxis}
setZoomAxis={setZoomAxis}
snapshot={snapshot}
loading={data.status === "loading"}
requestOpenSettings={() => setDeckSettingsOpen(true)}
settings={settings}
/>


hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
filterMutations={settings.filterMutations}
deckSize={deckSize}
/>
<TreenomeMutationHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
treenomeReferenceInfo={treenomeReferenceInfo}
/>
<MemoizedKey
keyStuff={keyStuff}
colorByField={colorBy.colorByField}
colorByGene={colorBy.colorByGene}
colorByPosition={colorBy.colorByPosition}
config={config}
setCurrentColorSettingKey={setCurrentColorSettingKey}
setColorSettingOpen={setColorSettingOpen}
/>
<DeckButtons
// we want this to intercept all mouse events
// so that we can prevent the default behavior
// of the browser

zoomReset={zoomReset}
zoomIncrement={zoomIncrement}
zoomAxis={zoomAxis}
setZoomAxis={setZoomAxis}
snapshot={snapshot}
loading={data.status === "loading"}
requestOpenSettings={() => setDeckSettingsOpen(true)}
settings={settings}
/>
<DeckGL
pickingRadius={10}
//getCursor={() => hoverInfo && hoverInfo.object ? "default" : "pointer"}
Expand Down Expand Up @@ -379,9 +369,7 @@ function Deck({
settings={settings}
/>
</View>
<View id="main">

</View>
<View id="main"></View>
</DeckGL>
</div>
);
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
1 change: 0 additions & 1 deletion taxonium_component/src/components/DeckButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const DeckButtons = ({
zIndex: 10,
pointerEvents: "none",
}}

className="flex flex-col items-end"
>
<div
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 @@ -60,13 +58,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 @@ -77,7 +72,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 d6be3e1

Please sign in to comment.