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

feature: Toggle backdrop visibility #483

Merged
merged 12 commits into from
Dec 5, 2024

Conversation

ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Nov 27, 2024

Problem

Closes #480, "make background image toggle more visible"!

This change adds a new onscreen toggle for the backdrop image to help make it more discoverable for users.

Estimated review size: ~20 minutes, medium

Solution

  • Added a backdrop visible flag to the ViewerConfig type.
  • Synced the new backdrop visibility flag to the URL.
  • Changed object opacity so it is only applied when backdrops are visible.
  • Updated SettingsTab with the new vector config.
    • This change moves object opacity to live under the backdrop settings area.
  • Adds a new onscreen toggle for the background image in CanvasWrapper.

Type of change

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

Steps to Verify:

  1. Open the preview link: https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview-internal/pr-483/viewer?collection=https%3A%2F%2Fdev-aics-dtp-001.int.allencell.org%2Fassay-dev%2Fusers%2FChantelle%2Fcolorizer%2Fnew_backdrop%2Fexploratory_dataset%2Fcollection.json
  2. Hover over the backdrop button on the UI. Try clicking the link to go to the viewer settings. Toggle the button.
  3. Open a preview link where backdrops are not included: https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview-internal/pr-483/viewer?collection=https%3A%2F%2Fallencell.s3.amazonaws.com%2Faics%2Fnuc-morph-dataset%2Ftimelapse_feature_explorer_datasets%2Fexploratory_dataset%2Fcollection.json
  4. Observe the disabled state.

Screenshots (optional):

Video Talk-through (🔊):

2024-12-02.14-35-36.mp4

image

image

image

@ShrimpCryptid ShrimpCryptid added new feature New feature or request ux-implementation UX research completed, this ticket is ready for implementation. labels Nov 27, 2024
@ShrimpCryptid ShrimpCryptid self-assigned this Nov 27, 2024
Copy link

github-actions bot commented Nov 27, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-12-05 22:27 UTC

Copy link

github-actions bot commented Nov 28, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 75.09% 5260 / 7004
🔵 Statements 75.09% 5260 / 7004
🔵 Functions 57.62% 136 / 236
🔵 Branches 80.81% 438 / 542
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/assets/images/index.ts 100% 100% 100% 100%
src/colorizer/Dataset.ts 78.54% 74.35% 70.27% 78.54% 189, 225-226, 244-245, 257-258, 285-288, 310-311, 315-317, 321-322, 334-335, 338-339, 345-346, 349-364, 392-393, 397-398, 414-423, 438-439, 458-460, 470-476, 494-497, 514-520, 524-525, 529-530, 536-543, 546-550, 553-577, 584-591
src/colorizer/constants.ts 92.59% 100% 66.66% 92.59% 51-54
src/colorizer/types.ts 99.09% 100% 75% 99.09% 125-126
src/colorizer/utils/url_utils.ts 90.5% 94.3% 88% 90.5% 96-102, 107-129, 194-200, 230-241, 298-299, 361-365, 540-547
src/components/AppStyle.tsx 76.79% 100% 0% 76.79% 322-418
Generated in workflow #1253

Comment on lines +34 to +59
function TooltipWithSubtext(
props: TooltipProps & { title: ReactNode; subtitle?: ReactNode; subtitleList?: ReactNode[] }
): ReactElement {
const divRef = useRef<HTMLDivElement>(null);
return (
<Tooltip
{...props}
title={
<>
<p style={{ margin: 0 }}>{props.title}</p>
<p style={{ margin: 0, fontSize: "12px" }}>{props.subtext}</p>
</>
}
>
{props.children}
</Tooltip>
<div ref={divRef}>
<Tooltip
{...props}
trigger={["hover", "focus"]}
title={
<>
<p style={{ margin: 0 }}>{props.title}</p>
{props.subtitle && <p style={{ margin: 0, fontSize: "12px" }}>{props.subtitle}</p>}
{props.subtitleList &&
props.subtitleList.map((text, i) => (
<p key={i} style={{ margin: 0, fontSize: "12px" }}>
{text}
</p>
))}
</>
}
getPopupContainer={() => divRef.current ?? document.body}
>
{props.children}
</Tooltip>
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recommend reviewing this with whitespace off!

@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review December 2, 2024 22:42
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner December 2, 2024 22:42
@ShrimpCryptid ShrimpCryptid requested review from interim17 and rugeli and removed request for a team December 2, 2024 22:42
canv.setBackdropBrightness(props.config.backdropBrightness);
canv.setBackdropSaturation(props.config.backdropSaturation);
}, [props.selectedBackdropKey, props.config.backdropBrightness, props.config.backdropSaturation]);
if (props.selectedBackdropKey !== null && props.config.backdropVisible) {
Copy link

Choose a reason for hiding this comment

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

This is a nice and important check to have!

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.

LGTM! Thank you for the demo and the always-helpful comments.

I noticed that clicking outside the checkbox (while hovering over the same row) still toggles it in Viewer Settings. This feels like something a user might accidentally trigger. Are we planning to address this in upcoming PRs?

@ShrimpCryptid
Copy link
Contributor Author

LGTM! Thank you for the demo and the always-helpful comments.

I noticed that clicking outside the checkbox (while hovering over the same row) still toggles it in Viewer Settings. This feels like something a user might accidentally trigger. Are we planning to address this in upcoming PRs?

It's semi-addressed in issue #472, but it's on hold for now pending a redesign of the settings area in #486.

@ShrimpCryptid ShrimpCryptid merged commit 85751a9 into main Dec 5, 2024
3 checks passed
@ShrimpCryptid ShrimpCryptid deleted the feature/onscreen-backdrops-toggle branch December 5, 2024 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request ux-implementation UX research completed, this ticket is ready for implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make background image toggle more visible
3 participants