-
Notifications
You must be signed in to change notification settings - Fork 114
H-6327: Integrate Sentry feedback button into ViewportControls #8537
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
Open
kube
wants to merge
6
commits into
cf/h-6324-migrate-petrinaut-to-oxlint-and-verify-react-compiler
Choose a base branch
from
cf/petrinaut-sentry-integrated-button-in-ui
base: cf/h-6324-migrate-petrinaut-to-oxlint-and-verify-react-compiler
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+147
β68
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
47f46c8
Integrate Sentry feedback button into ViewportControls
kube 0b34f57
Update yarn.lock for react-icons dependency
kube e61b5cd
Clean and force "use memo" for React Compiler
kube f0ec408
Remove manual memoization in DevApp, let React Compiler handle it
kube 888cdb8
Remove unused useCallback/useMemo imports
kube e95f163
Lint
kube File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
apps/petrinaut-website/src/main/app/sentry-feedback-button.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { ViewportAction } from "@hashintel/petrinaut"; | ||
| import * as Sentry from "@sentry/react"; | ||
| import { MdBugReport } from "react-icons/md"; | ||
|
|
||
| const feedbackButtonStyle: React.CSSProperties = { | ||
| backgroundColor: "#8b5cf6dd", | ||
| borderColor: "#7c3aed", | ||
| color: "#fff", | ||
| }; | ||
|
|
||
| export function useSentryFeedbackAction(): ViewportAction { | ||
| // Wouldn't be optimized by React Compiler otherwise | ||
| "use memo"; | ||
|
|
||
| return { | ||
kube marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| key: "sentry-feedback", | ||
| icon: <MdBugReport size={14} />, | ||
| label: "Give feedback", | ||
| tooltip: "Give feedback", | ||
| style: feedbackButtonStyle, | ||
| ref: (node) => { | ||
| const feedback = Sentry.getFeedback(); | ||
|
|
||
| if (!node || !feedback) { | ||
| return; | ||
| } | ||
|
|
||
| // Attach feedback to the button and return the unsubscribe function | ||
| return feedback.attachTo(node, { | ||
| formTitle: "Give feedback", | ||
| messagePlaceholder: "Report a bug or suggest an improvement", | ||
| submitButtonLabel: "Submit feedback", | ||
| }); | ||
| }, | ||
| }; | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export type ViewportAction = { | ||
| /** Unique key for React rendering. */ | ||
| key: string; | ||
| /** Icon element to render inside the button. */ | ||
| icon: React.ReactNode; | ||
| /** Accessible label for the button. */ | ||
| label: string; | ||
| /** Tooltip text shown on hover. */ | ||
| tooltip: string; | ||
| /** Click handler. */ | ||
| onClick?: () => void; | ||
| /** Inline styles applied to the button element. */ | ||
| style?: React.CSSProperties; | ||
| /** CSS class name applied to the button element. */ | ||
| className?: string; | ||
| /** Ref callback to access the underlying button DOM element. */ | ||
| ref?: React.Ref<HTMLButtonElement>; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.