Unverified Commit 6fcd42c9 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

[DevOverlay]: hook up issue click handlers in NextLogo (#75069)

#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
parent 386a89b9
...@@ -114,8 +114,10 @@ const DevToolsPopover = ({ ...@@ -114,8 +114,10 @@ const DevToolsPopover = ({
> >
<div ref={buttonRef}> <div ref={buttonRef}>
<NextLogo <NextLogo
key={issueCount}
issueCount={issueCount} issueCount={issueCount}
onClick={togglePopover} onClick={togglePopover}
onIssuesClick={onIssuesClick}
isDevBuilding={useIsDevBuilding()} isDevBuilding={useIsDevBuilding()}
isDevRendering={useIsDevRendering()} isDevRendering={useIsDevRendering()}
aria-haspopup="true" aria-haspopup="true"
......
...@@ -6,6 +6,7 @@ interface Props extends React.ComponentProps<'button'> { ...@@ -6,6 +6,7 @@ interface Props extends React.ComponentProps<'button'> {
onClick: () => void onClick: () => void
isDevBuilding: boolean isDevBuilding: boolean
isDevRendering: boolean isDevRendering: boolean
onIssuesClick: () => void
} }
const SIZE = 36 const SIZE = 36
...@@ -15,9 +16,11 @@ export const NextLogo = ({ ...@@ -15,9 +16,11 @@ export const NextLogo = ({
onClick, onClick,
isDevBuilding, isDevBuilding,
isDevRendering, isDevRendering,
onIssuesClick,
...props ...props
}: Props) => { }: Props) => {
const hasError = issueCount > 0 const hasError = issueCount > 0
const [isErrorExpanded, setIsErrorExpanded] = useState(hasError)
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const ref = useRef<HTMLDivElement | null>(null) const ref = useRef<HTMLDivElement | null>(null)
...@@ -223,12 +226,22 @@ export const NextLogo = ({ ...@@ -223,12 +226,22 @@ export const NextLogo = ({
<button data-next-mark onClick={onClick} {...props}> <button data-next-mark onClick={onClick} {...props}>
<NextMark isLoading={isLoading} /> <NextMark isLoading={isLoading} />
</button> </button>
{hasError && ( {isErrorExpanded && (
<div data-issues> <div data-issues>
<button data-issues-open aria-label="Open issues overlay"> <button
data-issues-open
aria-label="Open issues overlay"
onClick={onIssuesClick}
>
{issueCount} {issueCount === 1 ? 'Issue' : 'Issues'} {issueCount} {issueCount === 1 ? 'Issue' : 'Issues'}
</button> </button>
<button data-issues-close aria-label="Clear issues"> <button
data-issues-close
aria-label="Dismiss"
onClick={() => {
setIsErrorExpanded(false)
}}
>
<Cross /> <Cross />
</button> </button>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment