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

wip: feedback screenshot annotations #11175

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented Mar 18, 2024

DO NOT MERGE:
This is currently all code copied over from the hackweek project and will be modified. This is just a reference for a working version of annotations

Screen.Recording.2024-03-15.at.1.01.55.PM.mov

Relates to getsentry/sentry#63749

@c298lee c298lee requested a review from ryan953 March 18, 2024 17:56
Copy link
Contributor

github-actions bot commented Mar 18, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) 80.9 KB (added)
@sentry/browser (incl. Tracing, Replay) 72.24 KB (added)
@sentry/browser (incl. Tracing, Replay with Canvas) 76.04 KB (added)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 65.81 KB (added)
@sentry/browser (incl. Tracing) 36.83 KB (added)
@sentry/browser (incl. browserTracingIntegration) 36.83 KB (added)
@sentry/browser (incl. feedbackIntegration) 31.35 KB (added)
@sentry/browser (incl. feedbackModalIntegration) 31.47 KB (added)
@sentry/browser (incl. feedbackScreenshotIntegration) 31.48 KB (added)
@sentry/browser (incl. sendFeedback) 27.43 KB (added)
@sentry/browser 22.6 KB (added)
CDN Bundle (incl. Tracing, Replay, Feedback) 75.21 KB (added)
CDN Bundle (incl. Tracing, Replay) 70.05 KB (added)
CDN Bundle (incl. Tracing) 36.41 KB (added)
CDN Bundle 23.97 KB (added)
CDN Bundle (incl. Tracing, Replay) - uncompressed 220.04 KB (added)
CDN Bundle (incl. Tracing) - uncompressed 109.98 KB (added)
CDN Bundle - uncompressed 71 KB (added)
@sentry/react (incl. Tracing, Replay) 72.22 KB (added)
@sentry/react 22.63 KB (added)

const gray100 = '#F0ECF3';

style.textContent = `
.canvas {
Copy link
Member

Choose a reason for hiding this comment

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

I'd be careful with these class names as they can conflict with other css we are injecting into the shadow dom. I tried to use BEM naming convention for the other components

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for bringing that up, we would need to modify this for screenshots & cropping too!

Comment on lines +9 to +10
const surface200 = '#FAF9FB';
const gray100 = '#F0ECF3';
Copy link
Member

Choose a reason for hiding this comment

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

Looks to be unused

Copy link
Member

Choose a reason for hiding this comment

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

Let's be consistent with file naming, ScreenshotEditor vs imageEditorWrapper (I think we should have it match the exported component)

Comment on lines +10 to +15
export interface Rect {
height: number;
width: number;
x: number;
y: number;
}
Copy link
Member

Choose a reason for hiding this comment

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

Should be in a types file

Comment on lines +32 to +33
const maxWidth = containerElement.getBoundingClientRect().width;
const maxHeight = containerElement.getBoundingClientRect().height;
Copy link
Member

Choose a reason for hiding this comment

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

Let's have an intermediate var to store getBoundingClientRect() so it's only called once

Comment on lines +86 to +92
useEffect(() => {
resizeCanvas();
WINDOW.addEventListener('resize', resizeCanvas);
return () => {
WINDOW.removeEventListener('resize', resizeCanvas);
};
}, [resizeCanvas]);
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to throttle or debounce this otherwise many resize events end up getting fired when the window resizes and it will slowdown the browser due to the number of events it has to handle and forced reflows inside of resizeCanvas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants