@@ -16,6 +16,7 @@ import {
1616 type RightPanelSurface ,
1717} from "~/rightPanelStore" ;
1818import { Button } from "~/components/ui/button" ;
19+ import { Collapsible , CollapsiblePanel , CollapsibleTrigger } from "~/components/ui/collapsible" ;
1920import { DiscoveryList } from "~/components/ui/discovery-list" ;
2021import { Dialog } from "~/components/ui/dialog" ;
2122import { WizardPopup } from "~/components/ui/wizard" ;
@@ -30,7 +31,6 @@ import {
3031} from "~/state/device" ;
3132import { formatEnvironmentQueryError } from "~/state/query" ;
3233import { useAtomCommand } from "~/state/use-atom-command" ;
33- import { DeviceDiscoveryStatus } from "./DeviceDiscoveryStatus" ;
3434import { DeviceLoadingView } from "./DeviceLoadingView" ;
3535import { DeviceSetup , deviceHubReadiness , isAndroidDiscoveryUncertain } from "./DeviceSetup" ;
3636import { DeviceWorkspace } from "./DeviceWorkspace" ;
@@ -212,8 +212,8 @@ export function DevicePanel(props: {
212212 >
213213 < div hidden = { ! ! activeDevice } >
214214 { diagnostics . map ( ( diagnostic ) => (
215- < DeviceDiscoveryStatus
216- key = { `${ environmentId } \u0000${ diagnostic . hostId } ` }
215+ < DeviceDiscoveryWarning
216+ key = { `${ environmentId } \u0000${ diagnostic . hostId } \u0000 ${ diagnostic . detail } ` }
217217 label = { diagnostic . label }
218218 detail = { diagnostic . detail }
219219 />
@@ -227,7 +227,9 @@ export function DevicePanel(props: {
227227 </ div >
228228 ) : null }
229229 { operationError ? (
230- < DeviceError onDismiss = { ( ) => setOperation ( null ) } > { operationError } </ DeviceError >
230+ < DeviceNotice tone = "error" onDismiss = { ( ) => setOperation ( null ) } >
231+ { operationError }
232+ </ DeviceNotice >
231233 ) : null }
232234 </ div >
233235 < div className = "@container relative flex min-h-0 flex-1" >
@@ -238,7 +240,9 @@ export function DevicePanel(props: {
238240 device = { activeDevice }
239241 hostLabel = { activeHost ?. label ?? "Device host" }
240242 simlock = { activeHost ?. kind === "simlock" }
241- hostDiagnostics = { diagnostics . find ( ( { hostId } ) => hostId === activeDevice . hostId ) }
243+ hostDiagnostics = {
244+ diagnostics . find ( ( { hostId } ) => hostId === activeDevice . hostId ) ?. detail
245+ }
242246 visible = { props . visible }
243247 onFloat = { floatActive }
244248 onClose = { ( ) => closeActive ( false ) }
@@ -360,11 +364,20 @@ export function DevicePanel(props: {
360364 ) ;
361365}
362366
363- function DeviceError ( props : { readonly onDismiss : ( ) => void ; readonly children : ReactNode } ) {
367+ function DeviceNotice ( props : {
368+ readonly tone : "warning" | "error" ;
369+ readonly onDismiss : ( ) => void ;
370+ readonly children : ReactNode ;
371+ } ) {
364372 return (
365373 < div
366374 role = "alert"
367- className = "flex items-start gap-2 border-b bg-destructive/5 px-3 py-2 text-xs text-destructive"
375+ className = { cn (
376+ "flex items-start gap-2 border-b px-3 py-2 text-xs" ,
377+ props . tone === "warning"
378+ ? "bg-warning-surface text-warning-foreground"
379+ : "bg-destructive/5 text-destructive" ,
380+ ) }
368381 >
369382 < CircleAlert className = "mt-1 size-3.5 shrink-0" />
370383 < div
@@ -376,7 +389,7 @@ function DeviceError(props: { readonly onDismiss: () => void; readonly children:
376389 < Button
377390 size = "icon-xs"
378391 variant = "ghost"
379- aria-label = " Dismiss device error"
392+ aria-label = { props . tone === "warning" ? " Dismiss device warning" : "Dismiss device error"}
380393 onClick = { props . onDismiss }
381394 >
382395 < X />
@@ -385,6 +398,29 @@ function DeviceError(props: { readonly onDismiss: () => void; readonly children:
385398 ) ;
386399}
387400
401+ function DeviceDiscoveryWarning ( props : { readonly label : string ; readonly detail : string } ) {
402+ const [ open , setOpen ] = useState ( false ) ;
403+ return (
404+ < Collapsible open = { open } onOpenChange = { setOpen } >
405+ < div
406+ role = "status"
407+ className = "flex items-center gap-2 border-b px-3 py-1.5 text-xs text-muted-foreground"
408+ >
409+ < CircleAlert className = "size-3.5 shrink-0" />
410+ < span className = "min-w-0 flex-1 truncate" >
411+ Some devices on { props . label } could not be listed.
412+ </ span >
413+ < CollapsibleTrigger className = "shrink-0 hover:text-foreground" > Details</ CollapsibleTrigger >
414+ </ div >
415+ < CollapsiblePanel >
416+ < DeviceNotice tone = "warning" onDismiss = { ( ) => setOpen ( false ) } >
417+ { props . detail }
418+ </ DeviceNotice >
419+ </ CollapsiblePanel >
420+ </ Collapsible >
421+ ) ;
422+ }
423+
388424function groupDevices ( state : DeviceServiceState ) {
389425 const groups : Array < { platform : DevicePlatform ; devices : DeviceSummary [ ] } > = [ ] ;
390426 for ( const platform of [ "ios" , "android" ] as const ) {
0 commit comments