Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jgespinosa10 committed Jul 17, 2024
1 parent 25d46e1 commit d513955
Show file tree
Hide file tree
Showing 51 changed files with 5,609 additions and 5,216 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Added menu item to allow user to export DNA as FASTA when looking at a protein sequence to resolve https://github.com/TeselaGen/tg-oss/issues/61 [`#61`](https://github.com/TeselaGen/tg-oss/issues/61)
- Added fix for clipboard commands when there are multiple editors on a page to resolve https://github.com/TeselaGen/tg-oss/issues/24 [`#24`](https://github.com/TeselaGen/tg-oss/issues/24)
- closes #35 [`#35`](https://github.com/TeselaGen/tg-oss/issues/35)
- refactor [`ec2050c`](https://github.com/TeselaGen/tg-oss/commit/ec2050cfce60e27cb9fc3ef6242303ded2e7ef5e)
- updating yarn lock [`ff41df0`](https://github.com/TeselaGen/tg-oss/commit/ff41df0b49b8051fcba084f7eaa44cf23284926d)
- updating deps, moving to lodash-es, moving all packages to type: module [`bc7312c`](https://github.com/TeselaGen/tg-oss/commit/bc7312ccbe27c2d9a11cf2563ba978199428b50a)
- updating table styling to remove table last row bottom margin, removing unused S3Download, removing axios dep, updating deps [`8a6fb1f`](https://github.com/TeselaGen/tg-oss/commit/8a6fb1f047550f617c3e56b8c3ebf145967076ef)
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>
/>
);
}
3 changes: 2 additions & 1 deletion packages/shared-demo/src/DemoNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default ({ demos, isOpen, setIsOpen }) => {
</div>

<InputGroup
name="Filter"
rightElement={
search && (
<Button
Expand All @@ -61,7 +62,7 @@ export default ({ demos, isOpen, setIsOpen }) => {
style={{ marginBottom: 5 /* maxWidth: 200 */ }}
placeholder="Filter..."
leftElement={<Icon style={{ marginTop: 6 }} icon="search"></Icon>}
></InputGroup>
/>
{Object.keys(demos)
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
.map(function (name, index) {
Expand Down
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
5 changes: 3 additions & 2 deletions packages/shared-demo/src/VersionSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,20 @@ export default function VersionSwitcher({
width="100"
height="20"
title="GitHub"
></iframe>
/>
{testBadge && <ReactMarkdown children={testBadge} />}
</div>
{options.length ? (
<div>
<HTMLSelect
name="version-select"
minimal
onChange={function onChange(e) {
window.location.href = `https://teselagen.github.io/tg-oss/${packageName}/version/${e.currentTarget.value}/#/Editor`;
}}
value={version}
options={options}
></HTMLSelect>
/>
<a
target="_blank"
rel="noopener noreferrer"
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 d513955

Please sign in to comment.