From 316bf24f4a9da7259c1aebf0bb6ee792555ea90e Mon Sep 17 00:00:00 2001
From: Andrew Liu <159852527+aliu39@users.noreply.github.com>
Date: Mon, 22 Jul 2024 14:28:44 -0700
Subject: [PATCH 1/4] fix(toolbar): hide feedback panel when submit feedback
form opens
---
.../components/feedback/feedbackPanel.tsx | 9 ++++++--
.../devtoolbar/components/panelLayout.tsx | 23 +++++++++++++++++--
.../devtoolbar/hooks/useSDKFeedbackButton.tsx | 12 +++++++---
3 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx
index 08aa45f01383a3..d9eb1bf9e85bdd 100644
--- a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx
+++ b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx
@@ -1,4 +1,4 @@
-import {useMemo} from 'react';
+import {useMemo, useState} from 'react';
import {css} from '@emotion/react';
import ActorAvatar from 'sentry/components/avatar/actorAvatar';
@@ -34,7 +34,11 @@ import SentryAppLink from '../sentryAppLink';
import useInfiniteFeedbackList from './useInfiniteFeedbackList';
export default function FeedbackPanel() {
- const buttonRef = useSDKFeedbackButton();
+ const [visible, setVisible] = useState(true);
+ const buttonRef = useSDKFeedbackButton({
+ onFormOpen: () => setVisible(false),
+ onFormClose: () => setVisible(true),
+ });
const transactionName = useCurrentTransactionName();
const queryResult = useInfiniteFeedbackList({
query: `url:*${transactionName}`,
@@ -58,6 +62,7 @@ export default function FeedbackPanel() {
) : null
}
+ visible={visible}
>
diff --git a/static/app/components/devtoolbar/components/panelLayout.tsx b/static/app/components/devtoolbar/components/panelLayout.tsx
index 34df3ce5131b16..ba04358b270cdc 100644
--- a/static/app/components/devtoolbar/components/panelLayout.tsx
+++ b/static/app/components/devtoolbar/components/panelLayout.tsx
@@ -1,3 +1,5 @@
+import {css} from '@emotion/react';
+
import {buttonCss} from 'sentry/components/devtoolbar/styles/typography';
import {panelCss, panelHeadingCss, panelSectionCss} from '../styles/panel';
@@ -8,11 +10,28 @@ interface Props {
children?: React.ReactNode;
titleLeft?: React.ReactNode;
titleRight?: React.ReactNode;
+ visible?: boolean;
}
-export default function PanelLayout({children, title, titleLeft, titleRight}: Props) {
+export default function PanelLayout({
+ children,
+ title,
+ titleLeft,
+ titleRight,
+ visible = true,
+}: Props) {
return (
-