-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
84 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
keep-ui/app/(keep)/incidents/[id]/incident-layout-client.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use client"; | ||
|
||
import { ReactNode } from "react"; | ||
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"; | ||
import { IncidentDto } from "@/entities/incidents/model"; | ||
import { IncidentChatClientPage } from "./chat/page.client"; | ||
import { useIncident } from "@/utils/hooks/useIncidents"; | ||
import { IncidentHeader } from "./incident-header"; | ||
import { IncidentTabsNavigation } from "./incident-tabs-navigation"; | ||
|
||
function ResizeHandle() { | ||
return ( | ||
<PanelResizeHandle className="w-2 group hover:bg-tremor-brand-subtle transition-colors"> | ||
<div className="h-full w-1 mx-auto bg-tremor-border group-hover:bg-tremor-brand group-hover:w-1.5 transition-all" /> | ||
</PanelResizeHandle> | ||
); | ||
} | ||
|
||
export function IncidentLayoutClient({ | ||
children, | ||
initialIncident, | ||
AIEnabled, | ||
}: { | ||
children: ReactNode; | ||
initialIncident: IncidentDto; | ||
AIEnabled: boolean; | ||
}) { | ||
const { data: incident } = useIncident(initialIncident.id, { | ||
fallbackData: initialIncident, | ||
}); | ||
|
||
if (!incident) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<IncidentHeader incident={incident} /> | ||
<IncidentTabsNavigation incident={incident} /> | ||
<PanelGroup direction="horizontal"> | ||
<Panel defaultSize={60} minSize={30}> | ||
<div className="pr-2"> | ||
<div className="flex-1 min-w-0">{children}</div> | ||
</div> | ||
</Panel> | ||
{AIEnabled && ( | ||
<> | ||
<ResizeHandle /> | ||
<Panel defaultSize={40} minSize={25}> | ||
<div className="pl-2"> | ||
<IncidentChatClientPage incident={incident} /> | ||
</div> | ||
</Panel> | ||
</> | ||
)} | ||
</PanelGroup> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters