-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(feedback): Revamp of user feedback screenshot editing #15424
Conversation
size-limit report 📦
|
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotInput.css.ts
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotInput.css.ts
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditorv2.tsx
Outdated
Show resolved
Hide resolved
@@ -131,12 +132,34 @@ export function createScreenshotInputStyles(styleNonce?: string): HTMLStyleEleme | |||
border: var(--button-border, var(--border)); | |||
border-radius: var(--button-border-radius, 6px); | |||
background: var(--button-background, var(--background)); | |||
color: var(--button-foreground, var(--foreground)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this wrong before, not matching docs? now it's fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when I added the annotation stuff, I mixed up the names and used the wrong one. This is technically not in the docs, but now it matches what's used in the form buttons
} | ||
|
||
.editor__tool--active { | ||
background: var(--button-primary-background, var(--accent-background)); | ||
color: var(--button-primary-foreground, var(--accent-foreground)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this wrong before, not matching docs? now it's fixed?
if (sentryFeedback) { | ||
strokeColor = | ||
getComputedStyle(sentryFeedback).getPropertyValue('--button-primary-background') || | ||
getComputedStyle(sentryFeedback).getPropertyValue('--accent-background'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (sentryFeedback) { | |
strokeColor = | |
getComputedStyle(sentryFeedback).getPropertyValue('--button-primary-background') || | |
getComputedStyle(sentryFeedback).getPropertyValue('--accent-background'); | |
} | |
if (sentryFeedback) { | |
const computedStyle = getComputedStyle(sentryFeedback); | |
strokeColor = | |
computedStyle.getPropertyValue('--button-primary-background') || | |
computedStyle.getPropertyValue('--accent-background'); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, not sure if this is the best way to do this, but it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly nits about naming/comments
packages/feedback/src/screenshot/components/ScreenshotEditor.tsx
Outdated
Show resolved
Hide resolved
<Annotations action={action} imageBuffer={imageBuffer} annotatingRef={annotatingRef} /> | ||
<div class="editor__canvas-container" ref={measurementRef}> | ||
<canvas ref={screenshotRef}></canvas> | ||
<canvas class="editor__canvas-annotate" ref={graywashRef} onMouseDown={handleMouseDown}></canvas> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if the class names and ref name were more aligned. Also, graywash
makes me think it's only used to draw the backdrop, but handleMouseDown
looks like it's also handling the drawing of the boxes/rects. maybe this doesn't matter as much if we had some code comments about what the different refs are do.
packages/feedback/src/screenshot/components/ScreenshotEditor.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditor.tsx
Outdated
Show resolved
Hide resolved
packages/feedback/src/screenshot/components/ScreenshotEditor.tsx
Outdated
Show resolved
Hide resolved
}; | ||
|
||
const handleMouseUp = (e: MouseEvent): void => { | ||
setCurrentRect(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment why we're setting current rect as undefined?
} | ||
}, [currentRect]); | ||
|
||
const drawBuffer = hooks.useCallback((): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of the buffer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated with a comment
packages/feedback/src/screenshot/components/ScreenshotEditor.tsx
Outdated
Show resolved
Hide resolved
const [drawCommands, setDrawCommands] = hooks.useState<Rect[]>([]); | ||
const [currentRect, setCurrentRect] = hooks.useState<Rect | undefined>(undefined); | ||
const measurementRef = hooks.useRef<HTMLDivElement>(null); | ||
const screenshotRef = hooks.useRef<HTMLCanvasElement>(null); | ||
const graywashRef = hooks.useRef<HTMLCanvasElement>(null); | ||
const rectDivRef = hooks.useRef<HTMLDivElement>(null); | ||
const [imageSource, setimageSource] = hooks.useState<HTMLCanvasElement | null>(null); | ||
const [displayEditor, setdisplayEditor] = hooks.useState<boolean>(true); | ||
const [scaleFactor, setScaleFactor] = hooks.useState<number>(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might help to have comments explaining the purposes these (where it makes sense)
e.g. what is the purpose of the graywashRef
|
||
// draws outline around rectangle in the same colour as the submit button | ||
let strokeColor; | ||
const sentryFeedback = DOCUMENT.getElementById('sentry-feedback'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is sentry-feedback
id always guaranteed to exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the id attribute of the div
that contains the feedback widget. Good catch tho, this can actually be customized
c9daae0
into
ryan953/feedback-highlight-mask
Allows you to edit screenshots with highlight and hide boxes, with the ability to delete individual boxes and resize the page. This will replace the previous cropping and pen annotation.  Related to getsentry/sentry#69786
DO NOT MERGE
Allows you to edit screenshots with highlight and hide boxes, with the ability to delete individual boxes and resize the page. This will replace the previous cropping and pen annotation.

Closes getsentry/sentry#69786