Skip to content

Commit a117037

Browse files
authored
Codex/global chat room sidebar (#274)
* Fix chat sidebar collapse overlap * Restore chat shell nav and session link behavior
1 parent 5eb1341 commit a117037

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

packages/web/src/components/chat-room/chat-room-session-row.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Archive, Loader2, Pin, PinOff } from "lucide-react";
44
import type { ReactElement } from "react";
55

6-
import { Button } from "@/components/ui/button";
6+
import { Button, buttonVariants } from "@/components/ui/button";
77
import {
88
Dialog,
99
DialogClose,
@@ -48,11 +48,13 @@ export function ChatRoomSessionRow({
4848
: "text-zinc-400",
4949
)}
5050
>
51-
<Button
52-
className="h-auto min-w-0 justify-start gap-2 pl-2 pr-0 py-2 text-left text-sm"
51+
<a
52+
className={cn(
53+
buttonVariants({ variant: "ghost" }),
54+
"h-auto min-w-0 justify-start gap-2 pl-2 pr-0 py-2 text-left text-sm",
55+
)}
56+
href={`/session/${encodeURIComponent(session.id)}`}
5357
onClick={() => onSelectSession(session.id)}
54-
type="button"
55-
variant="ghost"
5658
>
5759
{isRunning ? (
5860
<span
@@ -68,7 +70,7 @@ export function ChatRoomSessionRow({
6870
{session.title}
6971
</Typography>
7072
</span>
71-
</Button>
73+
</a>
7274
<Button
7375
aria-label={pinLabel}
7476
aria-pressed={isPinned}

packages/web/src/components/chat-room/chat-room-settings-sidebar.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
X,
1919
} from "lucide-react";
2020
import Link from "next/link";
21+
import { usePathname } from "next/navigation";
2122
import type { ComponentType, ReactElement } from "react";
2223

2324
import { Button } from "@/components/ui/button";
@@ -48,6 +49,8 @@ export function ChatRoomSettingsSidebar({
4849
onClose,
4950
onNavigate,
5051
}: ChatRoomSettingsSidebarProps): ReactElement {
52+
const pathname = usePathname();
53+
5154
return (
5255
<div
5356
aria-hidden={!isActive}
@@ -90,7 +93,10 @@ export function ChatRoomSettingsSidebar({
9093
<div className="grid gap-1">
9194
{navItems.map((item) => {
9295
const Icon = iconByKey[item.key];
93-
const isActiveItem = item.key === "chat";
96+
const isActiveItem =
97+
pathname === item.href ||
98+
pathname.startsWith(`${item.href}/`) ||
99+
(item.key === "chat" && pathname.startsWith("/session/"));
94100
return (
95101
<Link
96102
aria-current={isActiveItem ? "page" : undefined}

0 commit comments

Comments
 (0)