Skip to content

Commit

Permalink
fix format and validate
Browse files Browse the repository at this point in the history
  • Loading branch information
jgespinosa10 committed Aug 8, 2024
1 parent e57e553 commit 2fc8d16
Show file tree
Hide file tree
Showing 17 changed files with 585 additions and 455 deletions.
106 changes: 51 additions & 55 deletions packages/ove/src/CutsiteFilter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,48 +152,46 @@ export function CutsiteFilter(props) {
filteredRestrictionEnzymes.length > 1;
const [queryTracker, setQueryTracker] = useState("");

const renderOptions = ({ label, value, canBeHidden }, props) => {
const { filteredRestrictionEnzymes, filteredRestrictionEnzymesUpdate } =
props;
const renderOptions = (
{ label, value, canBeHidden },
{ filteredRestrictionEnzymes, filteredRestrictionEnzymesUpdate }
) => (
<div
style={{
display: "flex",
justifyContent: "space-between",
width: "100%"
}}
>
{label}{" "}
{canBeHidden && (
<Icon
onClick={e => {
e.stopPropagation();

return (
<div
style={{
display: "flex",
justifyContent: "space-between",
width: "100%"
}}
>
{label}{" "}
{canBeHidden && (
<Icon
onClick={e => {
e.stopPropagation();

filteredRestrictionEnzymesUpdate(
flatMap(filteredRestrictionEnzymes, e => {
if (e.value === value) return [];
return e;
}).concat({
label,
className: "veHiddenEnzyme",
value,
// hiddenEnzyme: true,
isHidden: true,
canBeHidden
})
);
}}
htmlTitle="Hide this enzyme"
className="veHideEnzymeBtn"
style={{ paddingTop: 5 }}
iconSize={14}
icon="eye-off"
></Icon>
)}
</div>
);
};
filteredRestrictionEnzymesUpdate(
flatMap(filteredRestrictionEnzymes, e => {
if (e.value === value) return [];
return e;
}).concat({
label,
className: "veHiddenEnzyme",
value,
// hiddenEnzyme: true,
isHidden: true,
canBeHidden
})
);
}}
htmlTitle="Hide this enzyme"
className="veHideEnzymeBtn"
style={{ paddingTop: 5 }}
iconSize={14}
icon="eye-off"
/>
)}
</div>
);
const filteredRestrictionEnzymesUpdate = enzymes => {
_filteredRestrictionEnzymesUpdate(enzymes);
if (sequenceData?.id) {
Expand Down Expand Up @@ -285,7 +283,7 @@ export function CutsiteFilter(props) {
data-tip="Manage Enzymes"
onClick={onManageClick}
icon="cog"
></Button>
/>
)}
<div
style={{
Expand Down Expand Up @@ -345,19 +343,17 @@ export function CutsiteFilter(props) {
wrapperStyle={{ zIndex: 11 }}
noResultsText={
<NoResults
{...{
inputSequenceToTestAgainst: sequenceData.sequence,
manageEnzymesLink,
closeDropDown,
onHiddenEnzymeAdd,
queryString: queryTracker,
additionalEnzymes,
enzymeGroupsOverride,
cutsitesByNameActive: filteredCutsites.cutsitesByName,
cutsitesByName: allCutsites.cutsitesByName,
editorName
}}
></NoResults>
inputSequenceToTestAgainst={sequenceData.sequence}
manageEnzymesLink={manageEnzymesLink}
closeDropDown={closeDropDown}
onHiddenEnzymeAdd={onHiddenEnzymeAdd}
queryString={queryTracker}
additionalEnzymes={additionalEnzymes}
enzymeGroupsOverride={enzymeGroupsOverride}
cutsitesByNameActive={filteredCutsites.cutsitesByName}
cutsitesByName={allCutsites.cutsitesByName}
editorName={editorName}
/>
}
onInputChange={queryTracker => {
setQueryTracker(queryTracker);
Expand Down
2 changes: 1 addition & 1 deletion packages/ove/src/DigestTool/DigestTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { pick } from "lodash-es";
const MAX_DIGEST_CUTSITES = 50;
const MAX_PARTIAL_DIGEST_CUTSITES = 10;

const DigestTool = props => {
export const DigestTool = props => {
const [selectedTab, setSelectedTab] = useState("virtualDigest");
const {
editorName,
Expand Down
5 changes: 2 additions & 3 deletions packages/shared-demo/src/DemoNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ export default ({ demos, isOpen, setIsOpen }) => {
text={"Hide Sidebar"}
intent="primary"
icon="chevron-left"
/>
></Button>
</div>

<InputGroup
name="Filter"
rightElement={
search && (
<Button
Expand All @@ -53,7 +52,7 @@ export default ({ demos, isOpen, setIsOpen }) => {
onClick={() => {
setSearch("");
}}
/>
></Button>
)
}
onChange={e => {
Expand Down
51 changes: 24 additions & 27 deletions packages/ui/demo/src/examples/EditableCellTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,29 @@ import OptionsSection from "../OptionsSection";
import { toNumber } from "lodash-es";

const chance = new Chance();
function getEnts(num) {
return times(num).map(i => {
return {
name:
i < 20
? "Tom" + (88 + i) + (i % 5 !== 0 ? " a" : "")
: i < 25
? "Nancy" + (88 + i)
: chance.name(),
id: nanoid(),
type:
i === 0
? "fail"
: i === 1 || i === 22
? "too old"
: chance.pickone(["new", "old"]),
howMany:
i === 0 ? "fail" : i === 1 ? "15" : chance.pickone(["3", 40, 2, 5]),
isProtein: true,
weather:
i === 0 ? "WAY TOO HOT" : chance.pickone(["rainy", "cloudy", "HOT"])
};
});
}
const getEnts = num =>
times(num).map(i => ({
name:
i < 20
? "Tom" + (88 + i) + (i % 5 !== 0 ? " a" : "")
: i < 25
? "Nancy" + (88 + i)
: chance.name(),
id: nanoid(),
type:
i === 0
? "fail"
: i === 1 || i === 22
? "too old"
: chance.pickone(["new", "old"]),
howMany:
i === 0 ? "fail" : i === 1 ? "15" : chance.pickone(["3", 40, 2, 5]),
isProtein: true,
weather:
i === 0 ? "WAY TOO HOT" : chance.pickone(["rainy", "cloudy", "HOT"])
}));

export default function EditableCellTable(p) {
export default function EditableCellTable(props) {
const key = useRef(0);

const [entities, setEnts] = useState([]);
Expand All @@ -43,7 +40,7 @@ export default function EditableCellTable(p) {
label: "Number of Entities",
isSelect: true,
defaultValue: 50,
controlledValue: p.entities?.length,
controlledValue: props.entities?.length,
setControlledValue: v => {
key.current++;
setEnts(getEnts(toNumber(v)));
Expand Down Expand Up @@ -120,7 +117,7 @@ export default function EditableCellTable(p) {
</OptionsSection>
<DemoWrapper>
<DataTable
{...p}
{...props}
key={key.current}
formName="editableCellTable"
isSimple
Expand Down
1 change: 0 additions & 1 deletion packages/ui/demo/src/useToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from "@blueprintjs/core";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";

import {
doesSearchValMatchText,
getCurrentParamsFromUrl,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/DataTable/FilterAndSortMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const FilterAndSortMenu = ({
secondaryText="Clear"
secondaryIntent={Intent.DANGER}
secondaryAction={() => {
currentFilter && removeSingleFilter(currentFilter.filterOn);
if (currentFilter) removeSingleFilter(currentFilter.filterOn);
}}
/>
</Menu>
Expand Down
9 changes: 8 additions & 1 deletion packages/ui/src/DataTable/PagingTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const PagingTool = ({
pageSize,
pagingDisabled,
persistPageSize = noop,
scrollToTop,
setPage: _setPage,
setPageSize: _setPageSize,
setSelectedEntityIdMap
Expand All @@ -75,7 +76,13 @@ const PagingTool = ({
) {
setSelectedEntityIdMap({});
}
}, [entities, keepSelectionOnPageChange, setSelectedEntityIdMap]);
scrollToTop();
}, [
entities,
keepSelectionOnPageChange,
scrollToTop,
setSelectedEntityIdMap
]);
// Define local state
const [refetching, setRefetching] = useState(false);

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/DataTable/dataTableEnhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default compose(
// in the params
branch(props => !props.alwaysRerender, pureNoFunc),
// form prop is needed for redux-form, but we are giving this prop as
// formName, so we need to rename it. Previously it was done in the withTableParams,
// but now we took it out by default.
// formName, so we need to rename it. Previously it was done in the withTableParams, but now
// it doesn't have it by default.
withProps(({ formName }) => ({ form: formName })),
// the formName is passed via withTableParams and is often user overridden
branch(props => !props.noForm, reduxForm({})),
Expand Down
Loading

0 comments on commit 2fc8d16

Please sign in to comment.