Skip to content

Commit 0485be6

Browse files
committed
Adds the incident panel to the collapsed state
1 parent 2188f3e commit 0485be6

File tree

2 files changed

+87
-47
lines changed

2 files changed

+87
-47
lines changed

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,7 @@ export function SideMenu({
415415
</div>
416416
</div>
417417
<div>
418-
<CollapsibleHeight isCollapsed={isCollapsed}>
419-
<IncidentStatusPanel />
420-
</CollapsibleHeight>
418+
<IncidentStatusPanel isCollapsed={isCollapsed} />
421419
<div className={cn("flex flex-col gap-1 border-t border-grid-bright p-1", isCollapsed && "items-center")}>
422420
<div className="flex w-full items-center justify-between">
423421
<HelpAndAI isCollapsed={isCollapsed} />
@@ -763,17 +761,15 @@ function CollapsibleHeight({
763761
className?: string;
764762
}) {
765763
return (
766-
<motion.div
767-
className={cn("overflow-hidden", className)}
768-
initial={false}
769-
animate={{
770-
opacity: isCollapsed ? 0 : 1,
771-
height: isCollapsed ? 0 : "auto",
772-
}}
773-
transition={{ duration: 0.15, ease: "easeOut" }}
764+
<div
765+
className={cn(
766+
"grid transition-all duration-200 ease-in-out",
767+
isCollapsed ? "grid-rows-[0fr] opacity-0" : "grid-rows-[1fr] opacity-100",
768+
className
769+
)}
774770
>
775-
{children}
776-
</motion.div>
771+
<div className="overflow-hidden">{children}</div>
772+
</div>
777773
);
778774
}
779775

apps/webapp/app/routes/resources.incidents.tsx

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { ExclamationTriangleIcon } from "@heroicons/react/20/solid";
22
import { json } from "@remix-run/node";
33
import { useFetcher } from "@remix-run/react";
44
import { useCallback, useEffect } from "react";
5-
import { motion } from "framer-motion";
65
import { LinkButton } from "~/components/primitives/Buttons";
76
import { Paragraph } from "~/components/primitives/Paragraph";
7+
import { Popover, PopoverContent, PopoverTrigger } from "~/components/primitives/Popover";
8+
import { SimpleTooltip } from "~/components/primitives/Tooltip";
89
import { useFeatures } from "~/hooks/useFeatures";
10+
import { cn } from "~/utils/cn";
911
import { BetterStackClient } from "~/services/betterstack/betterstack.server";
1012

1113
export 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

Comments
 (0)