@@ -2,10 +2,12 @@ import { ExclamationTriangleIcon } from "@heroicons/react/20/solid";
22import { json } from "@remix-run/node" ;
33import { useFetcher } from "@remix-run/react" ;
44import { useCallback , useEffect } from "react" ;
5- import { motion } from "framer-motion" ;
65import { LinkButton } from "~/components/primitives/Buttons" ;
76import { Paragraph } from "~/components/primitives/Paragraph" ;
7+ import { Popover , PopoverContent , PopoverTrigger } from "~/components/primitives/Popover" ;
8+ import { SimpleTooltip } from "~/components/primitives/Tooltip" ;
89import { useFeatures } from "~/hooks/useFeatures" ;
10+ import { cn } from "~/utils/cn" ;
911import { BetterStackClient } from "~/services/betterstack/betterstack.server" ;
1012
1113export async function loader ( ) {
@@ -21,7 +23,7 @@ export async function loader() {
2123 } ) ;
2224}
2325
24- export function IncidentStatusPanel ( ) {
26+ export function IncidentStatusPanel ( { isCollapsed = false } : { isCollapsed ?: boolean } ) {
2527 const { isManagedCloud } = useFeatures ( ) ;
2628 if ( ! isManagedCloud ) {
2729 return null ;
@@ -45,39 +47,81 @@ export function IncidentStatusPanel() {
4547
4648 const operational = fetcher . data ?. operational ?? true ;
4749
50+ if ( operational ) {
51+ return null ;
52+ }
53+
4854 return (
49- < >
50- { ! operational && (
51- < motion . div
52- initial = { { opacity : 0 } }
53- animate = { { opacity : 1 } }
54- exit = { { opacity : 0 } }
55- transition = { { duration : 0.3 } }
56- className = "p-1"
57- >
58- < div className = "flex flex-col gap-2 rounded border border-warning/20 bg-warning/5 p-2 pt-1.5" >
59- < div className = "flex items-center gap-1 border-b border-warning/20 pb-1 text-warning" >
60- < ExclamationTriangleIcon className = "size-4" />
61- < Paragraph variant = "small/bright" className = "text-warning" >
62- Active incident
63- </ Paragraph >
64- </ div >
65- < Paragraph variant = "extra-small/bright" className = "text-warning/80" >
66- Our team is working on resolving the issue. Check our status page for more
67- information.
68- </ Paragraph >
69- < LinkButton
70- variant = "secondary/small"
71- to = "https://status.trigger.dev"
72- target = "_blank"
73- fullWidth
74- className = "border-warning/20 bg-warning/10 hover:!border-warning/30 hover:!bg-warning/20"
75- >
76- < span className = "text-warning" > View status page</ span >
77- </ LinkButton >
55+ < div className = "relative" >
56+ { /* Expanded: Full incident panel */ }
57+ < div
58+ className = { cn (
59+ "grid transition-all duration-200 ease-in-out" ,
60+ isCollapsed ? "grid-rows-[0fr] opacity-0 pointer-events-none" : "grid-rows-[1fr] opacity-100"
61+ ) }
62+ >
63+ < div className = "overflow-hidden" >
64+ < IncidentPanelContent />
65+ </ div >
66+ </ div >
67+
68+ { /* Collapsed: Icon button with popover */ }
69+ < div
70+ className = { cn (
71+ "grid transition-all duration-200 ease-in-out" ,
72+ isCollapsed ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"
73+ ) }
74+ >
75+ < div className = "overflow-hidden" >
76+ < div className = "p-1" >
77+ < Popover >
78+ < SimpleTooltip
79+ button = {
80+ < PopoverTrigger className = "flex h-8 w-full items-center justify-center rounded bg-warning/10 transition-colors hover:bg-warning/20" >
81+ < ExclamationTriangleIcon className = "size-5 text-warning" />
82+ </ PopoverTrigger >
83+ }
84+ content = "Active incident"
85+ side = "right"
86+ sideOffset = { 8 }
87+ buttonClassName = "!h-8 w-full"
88+ asChild
89+ disableHoverableContent
90+ />
91+ < PopoverContent side = "right" sideOffset = { 8 } align = "start" className = "!min-w-0 w-52 p-0" >
92+ < IncidentPanelContent inPopover />
93+ </ PopoverContent >
94+ </ Popover >
7895 </ div >
79- </ motion . div >
80- ) }
81- </ >
96+ </ div >
97+ </ div >
98+ </ div >
99+ ) ;
100+ }
101+
102+ function IncidentPanelContent ( { inPopover = false } : { inPopover ?: boolean } ) {
103+ return (
104+ < div className = { cn ( ! inPopover && "p-1" ) } >
105+ < div className = "flex flex-col gap-2 rounded border border-warning/20 bg-warning/5 p-2 pt-1.5" >
106+ < div className = "flex items-center gap-1 border-b border-warning/20 pb-1 text-warning" >
107+ < ExclamationTriangleIcon className = "size-4" />
108+ < Paragraph variant = "small/bright" className = "text-warning" >
109+ Active incident
110+ </ Paragraph >
111+ </ div >
112+ < Paragraph variant = "extra-small/bright" className = "text-warning/80" >
113+ Our team is working on resolving the issue. Check our status page for more information.
114+ </ Paragraph >
115+ < LinkButton
116+ variant = "secondary/small"
117+ to = "https://status.trigger.dev"
118+ target = "_blank"
119+ fullWidth
120+ className = "border-warning/20 bg-warning/10 hover:!border-warning/30 hover:!bg-warning/20"
121+ >
122+ < span className = "text-warning" > View status page</ span >
123+ </ LinkButton >
124+ </ div >
125+ </ div >
82126 ) ;
83127}
0 commit comments