Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jgespinosa10 committed Jul 15, 2024
1 parent 39d16f1 commit 749d96d
Show file tree
Hide file tree
Showing 39 changed files with 4,820 additions and 4,446 deletions.
70 changes: 28 additions & 42 deletions packages/ove/demo/src/utils/renderToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,25 @@ export default function renderToggle({
}
}
if (isButton) {
toggleOrButton = (
<Button
{...{
...sharedProps,
onClick: onClick || hook
}}
/>
);
toggleOrButton = <Button {...sharedProps} onClick={onClick || hook} />;
} else if (isSelect) {
const { style, label, ...rest } = sharedProps;
toggleOrButton = (
<div key={type + "iwuhwp"} style={sharedProps.style}>
{label && <span>{label} &nbsp;</span>}
<EnhancedSelect
{...{
options,
...rest,
didMount: () => {
hook && hook((that.state || {})[type], true);
},
value: (that.state || {})[type],
disabled: disabled,
onChange: newType => {
hook && hook(newType.target.value);
that.setState({
[type]: newType.target.value
});
}
options={options}
{...rest}
didMount={() => {
hook && hook((that.state || {})[type], true);
}}
value={(that.state || {})[type]}
disabled={disabled}
onChange={newType => {
hook && hook(newType.target.value);
that.setState({
[type]: newType.target.value
});
}}
/>
</div>
Expand All @@ -109,15 +100,13 @@ export default function renderToggle({
};
toggleOrButton = (
<EnhancedSwitch
{...{
...sharedProps,
didMount: () => {
hook && hook(!!(that.state || {})[type]);
},
checked: (that.state || {})[type],
disabled: disabled,
onChange: switchOnChange
{...sharedProps}
didMount={() => {
hook && hook(!!(that.state || {})[type]);
}}
checked={(that.state || {})[type]}
disabled={disabled}
onChange={switchOnChange}
/>
);
}
Expand All @@ -127,23 +116,20 @@ export default function renderToggle({
style={{ display: "flex", alignItems: "center", margin: "5px 5px" }}
className="toggle-button-holder"
>
<ShowInfo {...{ description, info, type }}></ShowInfo>
<ShowInfo description={description} info={info} type={type} />
{toggleOrButton}
{switchOnChange && hotkey && (
<React.Fragment>
<HandleHotkeys
onKeyDown={switchOnChange}
combo={hotkey}
></HandleHotkeys>
<>
<HandleHotkeys onKeyDown={switchOnChange} combo={hotkey} />
<div
style={{
marginLeft: 5,
transform: "scale(0.8)"
}}
>
<KeyCombo minimal combo={hotkey}></KeyCombo>
<KeyCombo minimal combo={hotkey} />
</div>
</React.Fragment>
</>
)}
</div>
);
Expand All @@ -166,7 +152,7 @@ function HandleHotkeys({ combo, onKeyDown }) {
function ShowInfo({ description, info, type }) {
const [isOpen, setOpen] = useState(false);
return (
<React.Fragment>
<>
<Dialog
onClose={() => {
setOpen(false);
Expand All @@ -190,12 +176,12 @@ function ShowInfo({ description, info, type }) {
}}
minimal
icon="info-sign"
></Button>
/>
</div>
) : (
<div style={{ minWidth: 30, width: 30, height: 30 }}></div>
<div style={{ minWidth: 30, width: 30, height: 30 }} />
)}
</React.Fragment>
</>
);
}

Expand Down
27 changes: 14 additions & 13 deletions packages/ove/src/AutoAnnotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ export const AutoAnnotateModal = compose(
>
download example
</a>
) with the following columns:<br></br>
<br></br>
) with the following columns:
<br />
<br />
<div style={{ display: "flex" }}>
name,description,sequence,type,
<span style={{ display: "flex" }}>
Expand All @@ -185,15 +186,15 @@ export const AutoAnnotateModal = compose(
regex matching
</span>
}
></InfoHelper>
/>
</span>
,matchType
</div>
<br></br>
<br />
{annotationType !== "feature" && (
<>
<i>Note: the "type" column is optional</i>
<br></br>
<br />
</>
)}
</div>
Expand All @@ -203,12 +204,12 @@ export const AutoAnnotateModal = compose(
fileLimit={1}
isRequired
accept=".csv"
></FileUploadField>
/>
</div>
}
id="csvFile"
title="CSV"
></Tab>
/>
<Tab
panel={
<div>
Expand All @@ -234,18 +235,18 @@ FRT GAAGTTCCTATTCTCTAGAAAGTATAGGAACTTC misc_recomb orchid pink 0 0`,
name="apeFile"
isRequired
accept=".txt"
></FileUploadField>
/>
{error && (
<div style={{ padding: 5, color: Colors.RED1 }}>{error}</div>
)}
</div>
}
id="apeFile"
title="ApE File"
></Tab>
/>
{getCustomAutoAnnotateList &&
(loadingCustomAnnList ? (
<Tab disabled title="Loading..."></Tab>
<Tab disabled title="Loading..." />
) : (
customAnnResponse &&
customAnnResponse.list && (
Expand All @@ -263,13 +264,13 @@ FRT GAAGTTCCTATTCTCTAGAAAGTATAGGAACTTC misc_recomb orchid pink 0 0`,
: customAnnsSchemaNoType
}
entities={customAnnResponse.list}
></DataTable>
/>
</div>
) : (
<div>No Annotations Found</div>
)
}
></Tab>
/>
)
))}
</Tabs>
Expand Down Expand Up @@ -451,7 +452,7 @@ FRT GAAGTTCCTATTCTCTAGAAAGTATAGGAACTTC misc_recomb orchid pink 0 0`,
}
})}
text="Annotate"
></DialogFooter>
/>
</div>
);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/ove/src/CreateAnnotationsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default compose(
}))}
withCheckboxes
schema={annotationType === "feature" ? schemaFeatures : schemaOther}
></DataTable>
/>
</div>
<DialogFooter
hideModal={hideDialog}
Expand Down Expand Up @@ -92,7 +92,7 @@ export default compose(
hideDialog();
})}
text="Add"
></DialogFooter>
/>
</div>
);
});
12 changes: 2 additions & 10 deletions packages/ove/src/DigestTool/DigestTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "@blueprintjs/core";
import withEditorInteractions from "../withEditorInteractions";
import { userDefinedHandlersAndOpts } from "../Editor/userDefinedHandlersAndOpts";
import { noop, pick } from "lodash-es";
import { pick } from "lodash-es";

const MAX_DIGEST_CUTSITES = 50;
const MAX_PARTIAL_DIGEST_CUTSITES = 10;
Expand All @@ -30,7 +30,7 @@ export class DigestTool extends React.Component {
// height = 100,
dimensions = {},
lanes,
digestTool: { selectedFragment, computePartialDigest },
digestTool: { computePartialDigest },
onDigestSave,
computePartialDigestDisabled,
computeDigestDisabled,
Expand Down Expand Up @@ -131,14 +131,6 @@ export class DigestTool extends React.Component {
onSingleRowSelect={({ onFragmentSelect }) => {
onFragmentSelect();
}}
reduxFormSelectedEntityIdMap={{
input: {
value: {
[selectedFragment]: true
},
onChange: noop
}
}}
formName="digestInfoTable"
entities={lanes[0].map(
({ id, cut1, cut2, start, end, size, ...rest }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const genericAnnotationProperties = ({
)
});
}}
></AnchorButton>
/>
</Tooltip>
<Tooltip
position="top"
Expand All @@ -251,7 +251,7 @@ const genericAnnotationProperties = ({
annotationPropertiesSelectedEntities.length !== 1
}
icon="edit"
></AnchorButton>
/>
</Tooltip>

{["feature"].includes(annotationType) && (
Expand Down Expand Up @@ -291,7 +291,7 @@ const genericAnnotationProperties = ({
intent="danger"
disabled={!annotationPropertiesSelectedEntities.length}
icon="trash"
></AnchorButton>
/>
</Tooltip>
</ButtonGroup>
)}
Expand Down Expand Up @@ -399,6 +399,6 @@ export function getVisFilter(submenu) {
className="propertiesVisFilter"
data-tip="Visibility Filter"
menu={<Menu>{submenu}</Menu>}
></DropdownButton>
/>
);
}
4 changes: 2 additions & 2 deletions packages/shared-demo/src/DemoPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DemoPage = ({ moduleName, demos, showComponentList }) => {
minimal
intent="primary"
icon="chevron-right"
></Button>
/>
)
}
packageName={`${moduleName}`}
Expand Down Expand Up @@ -173,7 +173,7 @@ const DemoComponentWrapper = ({
} else {
component = (
<>
<Demo history={history}></Demo>
<Demo history={history} />
{!!props.length && (
<>
<h6
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/cypress/e2e/EditableCellTable.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from "path";
import os from "os";

describe("EditableCellTable.spec", () => {
it(`cell checkboxes and the header checkbox should work`, () => {
Expand Down Expand Up @@ -170,7 +171,7 @@ describe("EditableCellTable.spec", () => {
// });
it(`arrow keys should work together with shift and dragging should work`, () => {
cy.visit("#/DataTable%20-%20EditableCellTable");
cy.get(`[data-test="tgCell_howMany"]`).eq(3).click({ force: true });
cy.get(`[data-test="tgCell_howMany"]`).eq(3).click();
cy.focused().type(`{leftArrow}`);
cy.get(
`.rt-td.isSelectedCell.isPrimarySelected [data-test="tgCell_weather"]`
Expand Down Expand Up @@ -239,8 +240,7 @@ describe("EditableCellTable.spec", () => {
);
});
it(`undo/redo should work`, () => {
const IS_LINUX =
window.navigator.platform.toLowerCase().search("linux") > -1;
const IS_LINUX = os.platform().toLowerCase().search("linux") > -1;
const undoCmd = IS_LINUX ? `{alt}z` : "{meta}z";
const redoCmd = IS_LINUX ? `{alt}{shift}z` : "{meta}{shift}z";
cy.visit("#/DataTable%20-%20EditableCellTable");
Expand Down
Loading

0 comments on commit 749d96d

Please sign in to comment.