-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: DP#7155 Update analytics Part 1 (#1041)
- Loading branch information
Showing
19 changed files
with
430 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Action, ActionCreator } from "redux"; | ||
import { ThunkAction } from "redux-thunk"; | ||
import { AppDispatch, GetState, RootState } from "../reducers"; | ||
import { | ||
isColorByHistogramColorMode, | ||
trackColorByCategoryExpand, | ||
trackColorByHistogramExpandCategory, | ||
} from "../analytics"; | ||
|
||
export const toggleCategoryExpansion: ActionCreator< | ||
ThunkAction< | ||
Promise<void>, | ||
RootState, | ||
never, | ||
Action<"controls category expansion change"> | ||
> | ||
> = | ||
(category: string, isExpanding: boolean) => | ||
async (dispatch: AppDispatch, getState: GetState) => { | ||
dispatch({ | ||
type: "controls category expansion change", | ||
category, | ||
}); | ||
|
||
const { | ||
colors: { colorMode }, | ||
} = getState(); | ||
|
||
trackColorByCategoryExpand( | ||
colorMode === "color by categorical metadata", | ||
isExpanding | ||
); | ||
|
||
trackColorByHistogramExpandCategory( | ||
isColorByHistogramColorMode(colorMode), | ||
isExpanding | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { track } from "../../analytics"; | ||
import { EVENTS } from "../../analytics/events"; | ||
import { GetState } from "../../reducers"; | ||
|
||
export function thunkTrackColorByContinuousHistogram() { | ||
return (_: unknown, getState: GetState) => { | ||
const { | ||
colors: { colorMode }, | ||
} = getState(); | ||
|
||
const isColorByContinuousHistogram = | ||
colorMode === "color by continuous metadata"; | ||
|
||
if (!isColorByContinuousHistogram) return; | ||
|
||
track(EVENTS.EXPLORER_COLORBY_HISTOGRAM_CONTINUOUS_BUTTON_CLICKED); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { | ||
trackColorByCategoryExpand, | ||
trackColorByCategoryHighlightHistogram, | ||
} from "../../../analytics"; | ||
import { GetState } from "../../../reducers"; | ||
|
||
export function thunkTrackColorByCategoryExpand(isColorByCategory: boolean) { | ||
return (_: unknown, getState: GetState) => { | ||
const { | ||
controls: { expandedCategories }, | ||
} = getState(); | ||
|
||
trackColorByCategoryExpand( | ||
isColorByCategory, | ||
expandedCategories.length > 0 | ||
); | ||
}; | ||
} | ||
|
||
export function thunkTrackColorByCategoryHighlightHistogram( | ||
isColorByCategory: boolean | ||
) { | ||
return (_: unknown, getState: GetState) => { | ||
const { continuousSelection } = getState(); | ||
|
||
trackColorByCategoryHighlightHistogram( | ||
isColorByCategory, | ||
Object.keys(continuousSelection).length > 0 | ||
); | ||
}; | ||
} |
Oops, something went wrong.