Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(heatmap): SDS Heatmap init #546

Merged
merged 1 commit into from Aug 11, 2023
Merged

feat(heatmap): SDS Heatmap init #546

merged 1 commit into from Aug 11, 2023

Conversation

tihuan
Copy link
Contributor

@tihuan tihuan commented Jul 28, 2023

Summary

Structural Element (Base, Gene, DNA, Chromosome or Cell)
Github issue: #XXXX
Copy isuue descirption here

Checklist

  • Default Story in Storybook
  • LivePreview Story in Storybook
  • Test Story in Storybook
  • Tests written
  • Variables from defaultTheme.ts used wherever possible
  • If updating an existing component, depreciate flag has been used where necessary
  • Chromatic build verified by @chanzuckerberg/sds-design

@tihuan tihuan force-pushed the thuang-heatmap branch 2 times, most recently from e6728ba to 0d05af2 Compare July 31, 2023 14:27
@masoudmanson
Copy link
Contributor

Wow, @tihuan, this is such a big deal 😯🤩🎉

Thank you very much for putting forth the effort to make this happen! I'm pretty excited to get started on it.

I still need to go over the PR. I want to go over everything thoroughly to completely understand the API you established. Thank you a lot. 🙏🏻❤️

@tihuan
Copy link
Contributor Author

tihuan commented Aug 2, 2023

Thanks, Masoud!! I'll try to publish the heatmap to npm this week and import it in single cell to use it!

And in the meantime if it's easier for me to walkthrough the code with you, we can just schedule a zoom call!

@tihuan tihuan force-pushed the thuang-heatmap branch 3 times, most recently from bad0acc to 96f8952 Compare August 4, 2023 15:24
const path = require("path");

/**
* (thuang): Inspired by https://github.com/cwmoo740/jest-svg-transformer/issues/3#issuecomment-1229928189
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this replaces svg-jest, since that package doesn't work with the latest jest, due to jest's API changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to lock yarn version to 1.19.0 to avoid installation issue

@@ -0,0 +1,20 @@
// Mock IntersectionObserver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgraded jest and jest-dom no longer has intersectionObserver mock, so we need to create one ourselves

@@ -0,0 +1,16 @@
module.exports = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract a common config file for reuse

@@ -78,9 +79,10 @@
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-storybook": "^0.6.13",
"husky": "^5.1.3",
"jest": "^27.2.5",
"jest": "^29.6.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgrade jest to the latest version!

},
};

export interface CreateChartOptionsProps {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the selected echarts API that we document and expose as part of the SDS HeatmapChart API

const customGrid =
typeof gridProp === "function" ? gridProp(defaultGrid) : gridProp;

return {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot more echarts default configs we set for users here, but once we add HeatmapChartProps.configs, users will be able to customize all the echarts options


if (onChartMouseMove) {
rawChart.getZr().on("mousemove", function (event: ElementEvent) {
onChartMouseMove(event, rawChart);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onChartMouseMove is not in its final API form yet. The ideal API should expose the underlying item, itemIndex, etc. as described in the API doc:

https://docs.google.com/document/d/1GuO-vUFylQpU7D-IB1HPuInvVk6Z0iJ0ZXchFDyxZLY/edit#bookmark=id.2qu5o335a820

This is how the current onChartMouseMove API is being used on the SC side. Note that SC still needs to use low level echarts API to convert screen pixel coordinates to actual item index, which the final API will do the conversion for the SDS users

https://github.com/chanzuckerberg/single-cell-data-portal/blob/b77e2da6eb3ec09afb5cc60506534c02fd75aba4/frontend/src/views/WheresMyGene/components/HeatMap/components/Chart/index.tsx#L121

"files": [
"src/core/Heatmap/Heatmap.namespace-test.tsx",
"include": [
"src/core/**/*.namespace-test.tsx",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using wildcard is easier!

"src/core/TooltipCondensed/TooltipCondensed.namespace-test.tsx",
"src/core/TooltipTable/TooltipTable.namespace-test.tsx",
"include": [
"src/core/**/*.namespace-test.tsx",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using wildcard is easier!

@tihuan tihuan marked this pull request as ready for review August 4, 2023 15:25
Comment on lines +31 to +32
'data-file-name': ${name}.name,
'data-testid': ${name}.name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only add these two props for backward compatibility. The snapshot files are updated, since we no longer have prop data-jest-svg-name. E.g., data-jest-svg-name="IconChevronDownSmall"

@tihuan
Copy link
Contributor Author

tihuan commented Aug 4, 2023

@masoudmanson I was able to verify that the component works in Single Cell by installing it locally 🚀 !

How should we publish this lol? Thank you!

Copy link
Contributor

@masoudmanson masoudmanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this thorough and well-written PR, @tihuan. I went over everything, and it looks good to me. 🤩💯

@masoudmanson
Copy link
Contributor

@masoudmanson I was able to verify that the component works in Single Cell by installing it locally 🚀 !

How should we publish this lol? Thank you!

The release process still has some bugs and does not work correctly; once you merge this PR, I can manually release the new packages.

@masoudmanson masoudmanson added the Ready for release This PR is ready for release label Aug 10, 2023
@tihuan
Copy link
Contributor Author

tihuan commented Aug 11, 2023

Amazing! Thanks so much for the thorough review, @masoudmanson 🙏 Merging now and appreciate you deploying this! Please let me know when it's done and I'll use it in Single Cell 🚀 🤩

@tihuan tihuan merged commit 1dcc639 into main Aug 11, 2023
10 checks passed
@tihuan tihuan deleted the thuang-heatmap branch August 11, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for release This PR is ready for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants