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

refactor: Moved tab rendering logic (annotations pt. 2) #500

Open
wants to merge 6 commits into
base: feature/annotation-data
Choose a base branch
from

Conversation

ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Dec 19, 2024

Problem

Part 2 of ??? for #484, prototyping annotations.

This change is a simple code move, with a little extra placeholder for the annotation tab thrown in.

Estimated review size: small, <10 minutes

Solution

  • Moved tab rendering logic out of returned JSX for readability.
  • Added placeholder for Annotation tab that's only visible in internal build mode.

Type of change

  • New feature (non-breaking change which adds functionality)

Steps to Verify:

  1. Open internal preview link: https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview-internal/pr-500/
  2. Compare with regular build. The annotation tab should not appear. https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview/pr-500/

@ShrimpCryptid ShrimpCryptid added the internals Tech debt, refactoring, dependencies, etc. label Dec 19, 2024
@ShrimpCryptid ShrimpCryptid self-assigned this Dec 19, 2024
Copy link

github-actions bot commented Dec 19, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview/pr-500/
on branch gh-pages at 2025-01-06 20:18 UTC

@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review December 19, 2024 19:59
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner December 19, 2024 19:59
@ShrimpCryptid ShrimpCryptid requested review from rugeli and ascibisz and removed request for a team December 19, 2024 19:59
Copy link

github-actions bot commented Dec 19, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 76% 5538 / 7286
🔵 Statements 76% 5538 / 7286
🔵 Functions 60.39% 154 / 255
🔵 Branches 81.42% 469 / 576
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/colorizer/types.ts 99.11% 100% 80% 99.11% 125-126
Generated in workflow #1332

Copy link

@rugeli rugeli left a comment

Choose a reason for hiding this comment

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

Just have one non-blocking comment about prop management. Looks good overall!

Comment on lines +880 to +898
<ScatterPlotTab
dataset={dataset}
currentFrame={currentFrame}
selectedTrack={selectedTrack}
findTrack={findTrack}
setFrame={setFrameAndRender}
isVisible={config.openTab === TabType.SCATTER_PLOT}
isPlaying={timeControls.isPlaying() || isRecording}
selectedFeatureKey={featureKey}
colorRampMin={colorRampMin}
colorRampMax={colorRampMax}
colorRamp={getColorMap(colorRampData, colorRampKey, colorRampReversed)}
categoricalPalette={categoricalPalette}
inRangeIds={inRangeLUT}
viewerConfig={config}
scatterPlotConfig={scatterPlotConfig}
updateScatterPlotConfig={updateScatterPlotConfig}
showAlert={showAlert}
/>
Copy link

Choose a reason for hiding this comment

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

This is already clean and readable, I just have a thought for future maintainability if we anticipate adding more props: would it be less error prone to group related props into a single config object instead of passing them individually?

For instance:

const scatterPlotDisplayConfig = {
dataset,
currentFrame,
...
};

const scatterPlotColorConfig = {
colorRampMin,
colorRampMax,
...
};

<ScatterPlotTab
  displayConfig={scatterPlotDisplayConfig}
...
>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh, yes! We already kind of do this for the scatterPlotConfig and viewerConfig, but you're right that the color ramps etc. could be bundled together into an object as well. I'll open an issue ticket for this and update here. :')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened as #502

Copy link

@ascibisz ascibisz left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Tech debt, refactoring, dependencies, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants