History

Add JJ VCS driver support

- Detect and route jj repositories alongside git - Thread VCS kind through status and UI labels - Add jj driver contract coverage and shared freshness helper

Julius Marminge committed 6 months ago

Commit c31beca1 parent 128b43230 files · +838 −44Browse files

Showing the changes to apps/web/src/components/chat (1 of 30 files). Show all

Unified · Split

apps/web/src/components/chat/ChatHeader.tsx+12−7
@@ -17,6 +17,8 @@ import { Toggle } from "../ui/toggle"; · 16 unmodified lines
17import { SidebarTrigger } from "../ui/sidebar";17import { SidebarTrigger } from "../ui/sidebar";
18import { OpenInPicker } from "./OpenInPicker";18import { OpenInPicker } from "./OpenInPicker";
19import { usePrimaryEnvironmentId } from "../../environments/primary";19import { usePrimaryEnvironmentId } from "../../environments/primary";
20import { resolveVcsTerms } from "../../vcsPresentation";
21import type { VcsDriverKind } from "@t3tools/contracts";
20 22
21interface ChatHeaderProps {23interface ChatHeaderProps {
22 activeThreadEnvironmentId: EnvironmentId;24 activeThreadEnvironmentId: EnvironmentId;
@@ -24,7 +26,8 @@ interface ChatHeaderProps { · 1 unmodified line
24 draftId?: DraftId;26 draftId?: DraftId;
25 activeThreadTitle: string;27 activeThreadTitle: string;
26 activeProjectName: string | undefined;28 activeProjectName: string | undefined;
27 isGitRepo: boolean;29 isVcsRepo: boolean;
30 vcsKind: VcsDriverKind | null;
28 openInCwd: string | null;31 openInCwd: string | null;
29 activeProjectScripts: ProjectScript[] | undefined;32 activeProjectScripts: ProjectScript[] | undefined;
30 preferredScriptId: string | null;33 preferredScriptId: string | null;
@@ -50,7 +53,8 @@ export const ChatHeader = memo(function ChatHeader({ · 19 unmodified lines
50 draftId,53 draftId,
51 activeThreadTitle,54 activeThreadTitle,
52 activeProjectName,55 activeProjectName,
53 isGitRepo,56 isVcsRepo,
57 vcsKind,
54 openInCwd,58 openInCwd,
55 activeProjectScripts,59 activeProjectScripts,
56 preferredScriptId,60 preferredScriptId,
@@ -72,6 +76,7 @@ export const ChatHeader = memo(function ChatHeader({ · 15 unmodified lines
72 const primaryEnvironmentId = usePrimaryEnvironmentId();76 const primaryEnvironmentId = usePrimaryEnvironmentId();
73 const isRemoteEnvironment =77 const isRemoteEnvironment =
74 primaryEnvironmentId !== null && activeThreadEnvironmentId !== primaryEnvironmentId;78 primaryEnvironmentId !== null && activeThreadEnvironmentId !== primaryEnvironmentId;
79 const vcsTerms = resolveVcsTerms(vcsKind);
75 80
76 return (81 return (
77 <div className="@container/header-actions flex min-w-0 flex-1 items-center gap-2">82 <div className="@container/header-actions flex min-w-0 flex-1 items-center gap-2">
@@ -88,9 +93,9 @@ export const ChatHeader = memo(function ChatHeader({ · 10 unmodified lines
88 <span className="min-w-0 truncate">{activeProjectName}</span>93 <span className="min-w-0 truncate">{activeProjectName}</span>
89 </Badge>94 </Badge>
90 )}95 )}
91 {activeProjectName && !isGitRepo && (96 {activeProjectName && !isVcsRepo && (
92 <Badge variant="outline" className="shrink-0 text-[10px] text-amber-700">97 <Badge variant="outline" className="shrink-0 text-[10px] text-amber-700">
93 No Git98 No repository
94 </Badge>99 </Badge>
95 )}100 )}
96 </div>101 </div>
@@ -154,15 +159,15 @@ export const ChatHeader = memo(function ChatHeader({ · 57 unmodified lines
154 aria-label="Toggle diff panel"159 aria-label="Toggle diff panel"
155 variant="outline"160 variant="outline"
156 size="xs"161 size="xs"
157 disabled={!isGitRepo && !diffOpen}162 disabled={!isVcsRepo && !diffOpen}
158 >163 >
159 <DiffIcon className="size-3" />164 <DiffIcon className="size-3" />
160 </Toggle>165 </Toggle>
161 }166 }
162 />167 />
163 <TooltipPopup side="bottom">168 <TooltipPopup side="bottom">
164 {!isGitRepo && !diffOpen169 {!isVcsRepo && !diffOpen
165 ? "Diff panel is unavailable because this project is not a git repository."170 ? `Diff panel is unavailable because this project is not a supported ${vcsTerms.repositoryNoun}.`
166 : diffToggleShortcutLabel171 : diffToggleShortcutLabel
167 ? `Toggle diff panel (${diffToggleShortcutLabel})`172 ? `Toggle diff panel (${diffToggleShortcutLabel})`
168 : "Toggle diff panel"}173 : "Toggle diff panel"}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t