Skip to content

Commit

Permalink
fix: 270 analytics expand events (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
tihuan authored May 17, 2022
1 parent dbbbb5e commit 6a75d87
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 0 additions & 2 deletions client/src/components/categorical/category/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ class Category extends React.PureComponent {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
handleCategoryClick = () => {
track(EVENTS.EXPLORER_CATEGORY_EXPAND_BUTTON_CLICKED);

// @ts-expect-error ts-migrate(2339) FIXME: Property 'annotations' does not exist on type 'Rea... Remove this comment to see the full error message
const { annotations, metadataField, onExpansionChange } = this.props;
const editingCategory =
Expand Down
1 change: 1 addition & 0 deletions client/src/components/categorical/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class Categories extends React.Component<{}, State> {
_expandedCats.delete(catName);
this.setState({ expandedCats: _expandedCats });
} else {
track(EVENTS.EXPLORER_CATEGORY_EXPAND_BUTTON_CLICKED);
const _expandedCats = new Set(expandedCats);
_expandedCats.add(catName);
this.setState({ expandedCats: _expandedCats });
Expand Down
7 changes: 5 additions & 2 deletions client/src/components/geneExpression/geneSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ class GeneSet extends React.Component<{}, State> {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
onGenesetMenuClick = () => {
track(EVENTS.EXPLORER_GENESET_EXPAND_BUTTON_CLICKED);

const { isOpen } = this.state;

if (!isOpen) {
track(EVENTS.EXPLORER_GENESET_EXPAND_BUTTON_CLICKED);
}

this.setState({ isOpen: !isOpen });
};

Expand Down
16 changes: 10 additions & 6 deletions client/src/components/geneExpression/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ class GeneExpression extends React.Component<{}, State> {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
handleExpandGeneSets = () => {
track(EVENTS.EXPLORER_GENESET_HEADING_EXPAND_BUTTON_CLICKED);

// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
this.setState((state: any) => ({
...state,
geneSetsExpanded: !state.geneSetsExpanded,
}));
this.setState((state: any) => {
if (!state.geneSetsExpanded) {
track(EVENTS.EXPLORER_GENESET_HEADING_EXPAND_BUTTON_CLICKED);
}

return {
...state,
geneSetsExpanded: !state.geneSetsExpanded,
};
});
};

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
Expand Down

0 comments on commit 6a75d87

Please sign in to comment.