Skip to content

Commit 6fcd42c

Browse files
authored
[DevOverlay]: hook up issue click handlers in NextLogo (vercel#75069)
vercel#74975 hooked up the issue count to the NextLogo indicator but we still need to attach a click handler so it toggles / dismisses issues. https://github.com/user-attachments/assets/ef434937-5c99-44a6-8fef-4c0c6d8d5860
1 parent 386a89b commit 6fcd42c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ const DevToolsPopover = ({
114114
>
115115
<div ref={buttonRef}>
116116
<NextLogo
117+
key={issueCount}
117118
issueCount={issueCount}
118119
onClick={togglePopover}
120+
onIssuesClick={onIssuesClick}
119121
isDevBuilding={useIsDevBuilding()}
120122
isDevRendering={useIsDevRendering()}
121123
aria-haspopup="true"

packages/next/src/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface Props extends React.ComponentProps<'button'> {
66
onClick: () => void
77
isDevBuilding: boolean
88
isDevRendering: boolean
9+
onIssuesClick: () => void
910
}
1011

1112
const SIZE = 36
@@ -15,9 +16,11 @@ export const NextLogo = ({
1516
onClick,
1617
isDevBuilding,
1718
isDevRendering,
19+
onIssuesClick,
1820
...props
1921
}: Props) => {
2022
const hasError = issueCount > 0
23+
const [isErrorExpanded, setIsErrorExpanded] = useState(hasError)
2124
const [isLoading, setIsLoading] = useState(false)
2225

2326
const ref = useRef<HTMLDivElement | null>(null)
@@ -223,12 +226,22 @@ export const NextLogo = ({
223226
<button data-next-mark onClick={onClick} {...props}>
224227
<NextMark isLoading={isLoading} />
225228
</button>
226-
{hasError && (
229+
{isErrorExpanded && (
227230
<div data-issues>
228-
<button data-issues-open aria-label="Open issues overlay">
231+
<button
232+
data-issues-open
233+
aria-label="Open issues overlay"
234+
onClick={onIssuesClick}
235+
>
229236
{issueCount} {issueCount === 1 ? 'Issue' : 'Issues'}
230237
</button>
231-
<button data-issues-close aria-label="Clear issues">
238+
<button
239+
data-issues-close
240+
aria-label="Dismiss"
241+
onClick={() => {
242+
setIsErrorExpanded(false)
243+
}}
244+
>
232245
<Cross />
233246
</button>
234247
</div>

0 commit comments

Comments
 (0)