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

Reposition feedback button in DDM #61043

Closed
ArthurKnaus opened this issue Dec 4, 2023 · 0 comments · Fixed by #61997
Closed

Reposition feedback button in DDM #61043

ArthurKnaus opened this issue Dec 4, 2023 · 0 comments · Fixed by #61997
Assignees

Comments

@ArthurKnaus
Copy link
Member

As the default position of the button would conflict with controls on the bottom tray, we should place it somewhere else / have a dedicated custom button.

See:
https://www.npmjs.com/package/@sentry-internal/feedback#additional-ui-customization
https://www.npmjs.com/package/@sentry-internal/feedback#bring-your-own-button

Custom button example in crons:

import {useEffect, useRef} from 'react';
import {BrowserClient, getCurrentHub} from '@sentry/react';
import {Feedback} from '@sentry-internal/feedback';
import {Button} from 'sentry/components/button';
import {IconMegaphone} from 'sentry/icons/iconMegaphone';
import ConfigStore from 'sentry/stores/configStore';
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
function CronsFeedbackButton() {
const config = useLegacyStore(ConfigStore);
const ref = useRef(null);
const title = 'Give Feedback';
const widgetTheme = config.theme === 'dark' ? 'dark' : 'light';
const hub = getCurrentHub();
const client = hub && hub.getClient<BrowserClient>();
const feedback = client?.getIntegration(Feedback);
useEffect(() => {
const widget =
ref.current &&
feedback?.attachTo(ref.current, {
colorScheme: widgetTheme,
formTitle: title,
submitButtonLabel: 'Send Feedback',
messagePlaceholder: 'What did you expect?',
});
return () => {
if (widget && feedback) {
feedback.removeWidget(widget);
}
};
}, [widgetTheme, feedback]);
// Do not show button if Feedback integration is not enabled
if (!feedback) {
return null;
}
return (
<Button ref={ref} data-feedback="crons" size="sm" icon={<IconMegaphone />}>
{title}
</Button>
);
}
export default CronsFeedbackButton;

ArthurKnaus added a commit that referenced this issue Dec 19, 2023
Move Feedback button to header

- closes #61043
@github-actions github-actions bot locked and limited conversation to collaborators Jan 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant