Skip to content

Commit 0847afe

Browse files
authored
Fix onboard intro capture and Git instructions routing (#297)
* Fix onboard intro output capture * Fix onboard intro capture
1 parent 5805f20 commit 0847afe

21 files changed

Lines changed: 242 additions & 578 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { ReactElement } from "react";
2+
3+
import { GitInstructionsPanel } from "@/components/git/git-instructions-panel";
4+
5+
export default function GitPage(): ReactElement {
6+
return (
7+
<section className="grid h-[100dvh] max-h-[100dvh] content-start gap-4 overflow-auto p-[clamp(0.75rem,3vw,1.25rem)]">
8+
<GitInstructionsPanel />
9+
</section>
10+
);
11+
}

packages/web/src/app/(operator)/settings/git/page.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/web/src/app/(operator)/settings/page.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.

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

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ import {
2323
import Link from "next/link";
2424
import { usePathname } from "next/navigation";
2525
import type { ComponentType, ReactElement } from "react";
26-
27-
import {
28-
isSettingsNavItemActive,
29-
settingsNavItems,
30-
} from "@/components/settings/settings-navigation";
31-
import type { SettingsView } from "@/components/settings/types/settings-navigation.types";
3226
import { Button } from "@/components/ui/button";
3327
import { Typography } from "@/components/ui/typography";
3428
import { cn } from "@/lib/utils";
@@ -39,6 +33,7 @@ const iconByKey: Record<
3933
ComponentType<{ size?: number }>
4034
> = {
4135
agents: Bot,
36+
git: Bot,
4237
autopilot: Sparkles,
4338
chat: MessageSquare,
4439
inbox: Inbox,
@@ -52,14 +47,6 @@ const iconByKey: Record<
5247
usage: ChartColumn,
5348
};
5449

55-
const settingsIconByKey: Record<
56-
SettingsView,
57-
ComponentType<{ size?: number }>
58-
> = {
59-
git: GitBranch,
60-
models: SlidersHorizontal,
61-
};
62-
6350
export function ChatRoomSettingsSidebar({
6451
isActive,
6552
onBack,
@@ -107,31 +94,6 @@ export function ChatRoomSettingsSidebar({
10794
<Typography className="mb-2 px-2" variant="eyebrow">
10895
Settings
10996
</Typography>
110-
<div className="grid gap-1">
111-
{settingsNavItems.map((item) => {
112-
const Icon = settingsIconByKey[item.key];
113-
const isActiveItem = isSettingsNavItemActive(pathname, item.href);
114-
return (
115-
<Link
116-
aria-current={isActiveItem ? "page" : undefined}
117-
className={cn(
118-
"flex h-9 items-center gap-2 rounded-md px-2 text-xs",
119-
isActiveItem
120-
? "bg-surface-active text-zinc-100"
121-
: "text-muted-foreground hover:bg-surface-hover hover:text-zinc-200",
122-
)}
123-
href={item.href}
124-
key={item.key}
125-
onClick={onNavigate}
126-
>
127-
<Icon size={15} />
128-
<Typography as="span" className="truncate" variant="muted">
129-
{item.label}
130-
</Typography>
131-
</Link>
132-
);
133-
})}
134-
</div>
13597
<Typography className="mb-2 mt-4 px-2" variant="eyebrow">
13698
Workspace
13799
</Typography>

packages/web/src/components/chat-room/chat-room-sidebar-utils.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ import type {
88
ProjectSessionListToggleMode,
99
VisibleProjectSessions,
1010
} from "./types/chat-room-sidebar.types";
11-
import type { ChatRoomSidebarView } from "./types/chat-room.types";
1211

1312
const UNASSIGNED_GROUP_ID = "unassigned";
1413
const UNASSIGNED_GROUP_LABEL = "Unassigned";
1514
const DEFAULT_VISIBLE_PROJECT_SESSION_COUNT = 5;
16-
const DEFAULT_CHAT_ROOM_SIDEBAR_VIEW: ChatRoomSidebarView = "main";
17-
const CHAT_ROOM_SIDEBAR_VIEW_STORAGE_KEY = "devos.chatRoom.sidebarView";
1815

1916
export function buildChatSessionSidebarContent({
2017
activeSessionId,
@@ -98,49 +95,6 @@ export function buildProjectSessionListToggleMode(
9895
return input.isExpanded ? "expanded" : "collapsed";
9996
}
10097

101-
export function getBrowserChatRoomSidebarViewStorage():
102-
| Pick<Storage, "getItem" | "setItem">
103-
| undefined {
104-
if (typeof window === "undefined") {
105-
return undefined;
106-
}
107-
try {
108-
return window.localStorage;
109-
} catch {
110-
return undefined;
111-
}
112-
}
113-
114-
export function readStoredChatRoomSidebarView(
115-
storage: Pick<Storage, "getItem"> | undefined,
116-
): ChatRoomSidebarView {
117-
if (!storage) {
118-
return DEFAULT_CHAT_ROOM_SIDEBAR_VIEW;
119-
}
120-
try {
121-
const storedValue = storage.getItem(CHAT_ROOM_SIDEBAR_VIEW_STORAGE_KEY);
122-
return isChatRoomSidebarView(storedValue)
123-
? storedValue
124-
: DEFAULT_CHAT_ROOM_SIDEBAR_VIEW;
125-
} catch {
126-
return DEFAULT_CHAT_ROOM_SIDEBAR_VIEW;
127-
}
128-
}
129-
130-
export function writeStoredChatRoomSidebarView(
131-
storage: Pick<Storage, "setItem"> | undefined,
132-
view: ChatRoomSidebarView,
133-
): void {
134-
if (!storage) {
135-
return;
136-
}
137-
try {
138-
storage.setItem(CHAT_ROOM_SIDEBAR_VIEW_STORAGE_KEY, view);
139-
} catch {
140-
return;
141-
}
142-
}
143-
14498
function createSessionProjectGroup(
14599
id: string,
146100
label: string,
@@ -152,9 +106,3 @@ function createSessionProjectGroup(
152106
sessions: [],
153107
};
154108
}
155-
156-
function isChatRoomSidebarView(
157-
value: string | null,
158-
): value is ChatRoomSidebarView {
159-
return value === "main" || value === "settings";
160-
}

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ import { cn } from "@/lib/utils";
1010
import { ChatRoomSessionList } from "./chat-room-session-list";
1111
import { ChatRoomSettingsSidebar } from "./chat-room-settings-sidebar";
1212
import { ChatRoomSidebarHeader } from "./chat-room-sidebar-header";
13-
import {
14-
buildChatSessionSidebarContent,
15-
getBrowserChatRoomSidebarViewStorage,
16-
readStoredChatRoomSidebarView,
17-
writeStoredChatRoomSidebarView,
18-
} from "./chat-room-sidebar-utils";
13+
import { buildChatSessionSidebarContent } from "./chat-room-sidebar-utils";
1914
import type { ChatRoomSidebarProps } from "./types/chat-room-sidebar.types";
2015
import type { ChatRoomSidebarView } from "./types/chat-room.types";
2116

@@ -36,12 +31,13 @@ export function ChatRoomSidebar({
3631
onSelectSession,
3732
onToggleCollapsed,
3833
}: ChatRoomSidebarProps): ReactElement {
39-
const [sidebarView, setSidebarViewState] = useState<ChatRoomSidebarView>(() =>
40-
readStoredChatRoomSidebarView(getBrowserChatRoomSidebarViewStorage()),
41-
);
4234
const [collapsedProjectIds, setCollapsedProjectIds] = useState<Set<string>>(
4335
() => new Set(),
4436
);
37+
const sidebarView = useUiStore((state) => state.chatRoomSidebarView);
38+
const setSidebarViewState = useUiStore(
39+
(state) => state.setChatRoomSidebarView,
40+
);
4541
const pinnedSessionIds = useUiStore((state) => state.pinnedSessionIds);
4642
const pinSession = useUiStore((state) => state.pinSession);
4743
const unpinSession = useUiStore((state) => state.unpinSession);
@@ -57,10 +53,6 @@ export function ChatRoomSidebar({
5753
if (view !== sidebarView) {
5854
setSidebarViewState(view);
5955
}
60-
writeStoredChatRoomSidebarView(
61-
getBrowserChatRoomSidebarViewStorage(),
62-
view,
63-
);
6456
}
6557

6658
function showMainSidebar(): void {
@@ -72,6 +64,7 @@ export function ChatRoomSidebar({
7264
}
7365

7466
function handleSettingsClick(): void {
67+
console.log("sidebarView", sidebarView)
7568
if (isCollapsed) {
7669
onToggleCollapsed();
7770
}

packages/web/src/components/settings/settings-github-panel.tsx renamed to packages/web/src/components/git/git-instructions-panel.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "@/lib/api/queries";
1414
import type { SettingsGithubUpdateRequest } from "@/lib/api/types/client.types";
1515

16-
export function SettingsGithubPanel(): ReactElement {
16+
export function GitInstructionsPanel(): ReactElement {
1717
const [draft, setDraft] = useState<Partial<SettingsGithubUpdateRequest>>({});
1818
const query = useGitHubSettingsQuery({ refetchIntervalMs: false });
1919
const mutation = useUpdateGitHubSettingsMutation();
@@ -39,7 +39,7 @@ export function SettingsGithubPanel(): ReactElement {
3939
return (
4040
<section className="grid gap-4 text-zinc-100">
4141
<Typography variant="description">
42-
Loading GitHub settings...
42+
Loading Git instructions...
4343
</Typography>
4444
</section>
4545
);
@@ -49,7 +49,7 @@ export function SettingsGithubPanel(): ReactElement {
4949
return (
5050
<section className="grid gap-4 text-zinc-100">
5151
<Typography className="text-red-200" variant="description">
52-
GitHub settings are unavailable.
52+
Git instructions are unavailable.
5353
</Typography>
5454
</section>
5555
);
@@ -58,7 +58,7 @@ export function SettingsGithubPanel(): ReactElement {
5858
return (
5959
<section className="grid gap-4 text-zinc-100">
6060
<div className="flex flex-wrap items-start justify-between gap-3">
61-
<Typography variant="sectionTitle">GitHub Workflow</Typography>
61+
<Typography variant="sectionTitle">Git Instructions</Typography>
6262
<div className="flex gap-2">
6363
<Button
6464
disabled={mutation.isPending || !hasChanges}
@@ -83,9 +83,9 @@ export function SettingsGithubPanel(): ReactElement {
8383
</div>
8484
<div className="grid gap-3 rounded-md border border-border bg-surface-panel p-3">
8585
<div className="grid gap-1.5">
86-
<Label htmlFor="github-commit-instruction">Commit</Label>
86+
<Label htmlFor="git-commit-instruction">Commit</Label>
8787
<Textarea
88-
id="github-commit-instruction"
88+
id="git-commit-instruction"
8989
onChange={(event) =>
9090
setDraft((current) => ({
9191
...current,
@@ -97,9 +97,9 @@ export function SettingsGithubPanel(): ReactElement {
9797
/>
9898
</div>
9999
<div className="grid gap-1.5">
100-
<Label htmlFor="github-pr-instruction">Pull request</Label>
100+
<Label htmlFor="git-pr-instruction">Pull request</Label>
101101
<Textarea
102-
id="github-pr-instruction"
102+
id="git-pr-instruction"
103103
onChange={(event) =>
104104
setDraft((current) => ({
105105
...current,
@@ -113,7 +113,7 @@ export function SettingsGithubPanel(): ReactElement {
113113
</div>
114114
{mutation.isError ? (
115115
<Typography className="text-red-200" variant="description">
116-
Could not save GitHub settings.
116+
Could not save Git instructions.
117117
</Typography>
118118
) : null}
119119
</section>

0 commit comments

Comments
 (0)