Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 64e486d

Browse files
authored
feat(feedback): Add more labels so people can configure Highlight and Hide labels (#17513)
Fixes #17493
1 parent e647ba1 commit 64e486d

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

‎packages/core/src/types-hoist/feedback/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ export interface FeedbackTextConfiguration {
176176
* The label for the button that removes a screenshot and hides the image editor
177177
*/
178178
removeScreenshotButtonLabel: string;
179+
180+
/**
181+
* The label for the button that highlights portions ofthe screenshot
182+
*/
183+
highlightToolText: string;
184+
185+
/**
186+
* The label for the button that hides portions of the screenshot
187+
*/
188+
hideToolText: string;
189+
190+
/**
191+
* The label for the button that removed a highlight/hidden section of the screenshot.
192+
*/
193+
removeHighlightText: string;
179194
}
180195

181196
/**

‎packages/feedback/src/constants/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export const SUCCESS_MESSAGE_TEXT = 'Thank you for your report!';
2222
export const IS_REQUIRED_LABEL = '(required)';
2323
export const ADD_SCREENSHOT_LABEL = 'Add a screenshot';
2424
export const REMOVE_SCREENSHOT_LABEL = 'Remove screenshot';
25+
export const HIGHLIGHT_TOOL_TEXT = 'Highlight';
26+
export const HIDE_TOOL_TEXT = 'Hide';
27+
export const REMOVE_HIGHLIGHT_TEXT = 'Remove';
2528

2629
export const FEEDBACK_WIDGET_SOURCE = 'widget';
2730
export const FEEDBACK_API_SOURCE = 'api';

‎packages/feedback/src/core/integration.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable max-lines */
2+
13
import type {
24
FeedbackInternalOptions,
35
FeedbackModalIntegration,
@@ -14,11 +16,14 @@ import {
1416
EMAIL_LABEL,
1517
EMAIL_PLACEHOLDER,
1618
FORM_TITLE,
19+
HIDE_TOOL_TEXT,
20+
HIGHLIGHT_TOOL_TEXT,
1721
IS_REQUIRED_LABEL,
1822
MESSAGE_LABEL,
1923
MESSAGE_PLACEHOLDER,
2024
NAME_LABEL,
2125
NAME_PLACEHOLDER,
26+
REMOVE_HIGHLIGHT_TEXT,
2227
REMOVE_SCREENSHOT_LABEL,
2328
SUBMIT_BUTTON_LABEL,
2429
SUCCESS_MESSAGE_TEXT,
@@ -110,6 +115,9 @@ export const buildFeedbackIntegration = ({
110115
successMessageText = SUCCESS_MESSAGE_TEXT,
111116
triggerLabel = TRIGGER_LABEL,
112117
triggerAriaLabel = '',
118+
highlightToolText = HIGHLIGHT_TOOL_TEXT,
119+
hideToolText = HIDE_TOOL_TEXT,
120+
removeHighlightText = REMOVE_HIGHLIGHT_TEXT,
113121

114122
// FeedbackCallbacks
115123
onFormOpen,
@@ -152,6 +160,9 @@ export const buildFeedbackIntegration = ({
152160
isRequiredLabel,
153161
addScreenshotButtonLabel,
154162
removeScreenshotButtonLabel,
163+
highlightToolText,
164+
hideToolText,
165+
removeHighlightText,
155166

156167
onFormClose,
157168
onFormOpen,

‎packages/feedback/src/screenshot/components/ScreenshotEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export function ScreenshotEditorFactory({
310310
}}
311311
>
312312
<button
313-
aria-label="Remove"
313+
aria-label={options.removeHighlightText}
314314
onClick={deleteRect(index)}
315315
onMouseDown={handleStopPropagation}
316316
onMouseUp={handleStopPropagation}
@@ -323,7 +323,7 @@ export function ScreenshotEditorFactory({
323323
</div>
324324
</div>
325325
</div>
326-
<Toolbar action={action} setAction={setAction} />
326+
<Toolbar options={options}action={action} setAction={setAction} />
327327
</div>
328328
);
329329
};

‎packages/feedback/src/screenshot/components/Toolbar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { FeedbackInternalOptions } from '@sentry/core';
12
import type { h as hType, VNode } from 'preact';
23
import type * as Hooks from 'preact/hooks';
34

@@ -11,9 +12,11 @@ export default function ToolbarFactory({
1112
return function Toolbar({
1213
action,
1314
setAction,
15+
options,
1416
}: {
1517
action: 'highlight' | 'hide' | '';
1618
setAction: Hooks.StateUpdater<'highlight' | 'hide' | ''>;
19+
options: FeedbackInternalOptions;
1720
}): VNode {
1821
return (
1922
<div class="editor__tool-container">
@@ -25,7 +28,7 @@ export default function ToolbarFactory({
2528
setAction(action === 'highlight' ? '' : 'highlight');
2629
}}
2730
>
28-
Highlight
31+
{options.highlightToolText}
2932
</button>
3033
<button
3134
type="button"
@@ -34,7 +37,7 @@ export default function ToolbarFactory({
3437
setAction(action === 'hide' ? '' : 'hide');
3538
}}
3639
>
37-
Hide
40+
{options.hideToolText}
3841
</button>
3942
</div>
4043
</div>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /