Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/core/src/types-hoist/feedback/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ export interface FeedbackTextConfiguration {
* The label for the button that removes a screenshot and hides the image editor
*/
removeScreenshotButtonLabel: string;

/**
* The label for the button that highlights portions ofthe screenshot
*/
highlightToolText: string;

/**
* The label for the button that hides portions of the screenshot
*/
hideToolText: string;

/**
* The label for the button that removed a highlight/hidden section of the screenshot.
*/
removeHighlightText: string;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/feedback/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const SUCCESS_MESSAGE_TEXT = 'Thank you for your report!';
export const IS_REQUIRED_LABEL = '(required)';
export const ADD_SCREENSHOT_LABEL = 'Add a screenshot';
export const REMOVE_SCREENSHOT_LABEL = 'Remove screenshot';
export const HIGHLIGHT_TOOL_TEXT = 'Highlight';
export const HIDE_TOOL_TEXT = 'Hide';
export const REMOVE_HIGHLIGHT_TEXT = 'Remove';

export const FEEDBACK_WIDGET_SOURCE = 'widget';
export const FEEDBACK_API_SOURCE = 'api';
Expand Down
11 changes: 11 additions & 0 deletions packages/feedback/src/core/integration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable max-lines */

import type {
FeedbackInternalOptions,
FeedbackModalIntegration,
Expand All @@ -14,11 +16,14 @@ import {
EMAIL_LABEL,
EMAIL_PLACEHOLDER,
FORM_TITLE,
HIDE_TOOL_TEXT,
HIGHLIGHT_TOOL_TEXT,
IS_REQUIRED_LABEL,
MESSAGE_LABEL,
MESSAGE_PLACEHOLDER,
NAME_LABEL,
NAME_PLACEHOLDER,
REMOVE_HIGHLIGHT_TEXT,
REMOVE_SCREENSHOT_LABEL,
SUBMIT_BUTTON_LABEL,
SUCCESS_MESSAGE_TEXT,
Expand Down Expand Up @@ -110,6 +115,9 @@ export const buildFeedbackIntegration = ({
successMessageText = SUCCESS_MESSAGE_TEXT,
triggerLabel = TRIGGER_LABEL,
triggerAriaLabel = '',
highlightToolText = HIGHLIGHT_TOOL_TEXT,
hideToolText = HIDE_TOOL_TEXT,
removeHighlightText = REMOVE_HIGHLIGHT_TEXT,

// FeedbackCallbacks
onFormOpen,
Expand Down Expand Up @@ -152,6 +160,9 @@ export const buildFeedbackIntegration = ({
isRequiredLabel,
addScreenshotButtonLabel,
removeScreenshotButtonLabel,
highlightToolText,
hideToolText,
removeHighlightText,

onFormClose,
onFormOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export function ScreenshotEditorFactory({
}}
>
<button
aria-label="Remove"
aria-label={options.removeHighlightText}
onClick={deleteRect(index)}
onMouseDown={handleStopPropagation}
onMouseUp={handleStopPropagation}
Expand All @@ -323,7 +323,7 @@ export function ScreenshotEditorFactory({
</div>
</div>
</div>
<Toolbar action={action} setAction={setAction} />
<Toolbar options={options} action={action} setAction={setAction} />
</div>
);
};
Expand Down
7 changes: 5 additions & 2 deletions packages/feedback/src/screenshot/components/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { FeedbackInternalOptions } from '@sentry/core';
import type { h as hType, VNode } from 'preact';
import type * as Hooks from 'preact/hooks';

Expand All @@ -11,9 +12,11 @@ export default function ToolbarFactory({
return function Toolbar({
action,
setAction,
options,
}: {
action: 'highlight' | 'hide' | '';
setAction: Hooks.StateUpdater<'highlight' | 'hide' | ''>;
options: FeedbackInternalOptions;
}): VNode {
return (
<div class="editor__tool-container">
Expand All @@ -25,7 +28,7 @@ export default function ToolbarFactory({
setAction(action === 'highlight' ? '' : 'highlight');
}}
>
Highlight
{options.highlightToolText}
</button>
<button
type="button"
Expand All @@ -34,7 +37,7 @@ export default function ToolbarFactory({
setAction(action === 'hide' ? '' : 'hide');
}}
>
Hide
{options.hideToolText}
</button>
</div>
</div>
Expand Down
Loading