Skip to content

Commit 24b93b3

Browse files
Christian SmithChristian Smith
authored andcommitted
fix: formatter
1 parent c3f017e commit 24b93b3

20 files changed

Lines changed: 809 additions & 1647 deletions

apps/web/src/components/ChatView.logic.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@ import { type ProviderKind, type ThreadId } from "@t3tools/contracts";
22
import { type ChatMessage, type Thread } from "../types";
33
import { randomUUID } from "~/lib/utils";
44
import { getAppModelOptions } from "../appSettings";
5-
import {
6-
type ComposerImageAttachment,
7-
type DraftThreadState,
8-
} from "../composerDraftStore";
5+
import { type ComposerImageAttachment, type DraftThreadState } from "../composerDraftStore";
96

10-
export const LAST_INVOKED_SCRIPT_BY_PROJECT_KEY =
11-
"t3code:last-invoked-script-by-project";
7+
export const LAST_INVOKED_SCRIPT_BY_PROJECT_KEY = "t3code:last-invoked-script-by-project";
128
const WORKTREE_BRANCH_PREFIX = "t3code";
139

14-
export function readLastInvokedScriptByProjectFromStorage(): Record<
15-
string,
16-
string
17-
> {
10+
export function readLastInvokedScriptByProjectFromStorage(): Record<string, string> {
1811
const stored = localStorage.getItem(LAST_INVOKED_SCRIPT_BY_PROJECT_KEY);
1912
if (!stored) return {};
2013

@@ -61,11 +54,7 @@ export function buildLocalDraftThread(
6154
}
6255

6356
export function revokeBlobPreviewUrl(previewUrl: string | undefined): void {
64-
if (
65-
!previewUrl ||
66-
typeof URL === "undefined" ||
67-
!previewUrl.startsWith("blob:")
68-
) {
57+
if (!previewUrl || typeof URL === "undefined" || !previewUrl.startsWith("blob:")) {
6958
return;
7059
}
7160
URL.revokeObjectURL(previewUrl);
@@ -83,17 +72,14 @@ export function revokeUserMessagePreviewUrls(message: ChatMessage): void {
8372
}
8473
}
8574

86-
export function collectUserMessageBlobPreviewUrls(
87-
message: ChatMessage,
88-
): string[] {
75+
export function collectUserMessageBlobPreviewUrls(message: ChatMessage): string[] {
8976
if (message.role !== "user" || !message.attachments) {
9077
return [];
9178
}
9279
const previewUrls: string[] = [];
9380
for (const attachment of message.attachments) {
9481
if (attachment.type !== "image") continue;
95-
if (!attachment.previewUrl || !attachment.previewUrl.startsWith("blob:"))
96-
continue;
82+
if (!attachment.previewUrl || !attachment.previewUrl.startsWith("blob:")) continue;
9783
previewUrls.push(attachment.previewUrl);
9884
}
9985
return previewUrls;

apps/web/src/components/ChatView.tsx

Lines changed: 326 additions & 821 deletions
Large diffs are not rendered by default.

apps/web/src/components/chat/ChangedFilesTree.tsx

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { type TurnId } from "@t3tools/contracts";
22
import { memo, useCallback, useEffect, useMemo, useState } from "react";
33
import { type TurnDiffFileChange } from "../../types";
4-
import {
5-
buildTurnDiffTree,
6-
type TurnDiffTreeNode,
7-
} from "../../lib/turnDiffTree";
4+
import { buildTurnDiffTree, type TurnDiffTreeNode } from "../../lib/turnDiffTree";
85
import { ChevronRightIcon, FolderIcon, FolderClosedIcon } from "lucide-react";
96
import { cn } from "~/lib/utils";
107
import { DiffStatLabel, hasNonZeroStat } from "./DiffStatLabel";
@@ -17,13 +14,7 @@ export const ChangedFilesTree = memo(function ChangedFilesTree(props: {
1714
resolvedTheme: "light" | "dark";
1815
onOpenTurnDiff: (turnId: TurnId, filePath?: string) => void;
1916
}) {
20-
const {
21-
files,
22-
allDirectoriesExpanded,
23-
onOpenTurnDiff,
24-
resolvedTheme,
25-
turnId,
26-
} = props;
17+
const { files, allDirectoriesExpanded, onOpenTurnDiff, resolvedTheme, turnId } = props;
2718
const treeNodes = useMemo(() => buildTurnDiffTree(files), [files]);
2819
const directoryPathsKey = useMemo(
2920
() => collectDirectoryPaths(treeNodes).join("\u0000"),
@@ -37,27 +28,19 @@ export const ChangedFilesTree = memo(function ChangedFilesTree(props: {
3728
),
3829
[allDirectoriesExpanded, directoryPathsKey],
3930
);
40-
const [expandedDirectories, setExpandedDirectories] = useState<
41-
Record<string, boolean>
42-
>(() =>
43-
buildDirectoryExpansionState(
44-
directoryPathsKey ? directoryPathsKey.split("\u0000") : [],
45-
true,
46-
),
31+
const [expandedDirectories, setExpandedDirectories] = useState<Record<string, boolean>>(() =>
32+
buildDirectoryExpansionState(directoryPathsKey ? directoryPathsKey.split("\u0000") : [], true),
4733
);
4834
useEffect(() => {
4935
setExpandedDirectories(allDirectoryExpansionState);
5036
}, [allDirectoryExpansionState]);
5137

52-
const toggleDirectory = useCallback(
53-
(pathValue: string, fallbackExpanded: boolean) => {
54-
setExpandedDirectories((current) => ({
55-
...current,
56-
[pathValue]: !(current[pathValue] ?? fallbackExpanded),
57-
}));
58-
},
59-
[],
60-
);
38+
const toggleDirectory = useCallback((pathValue: string, fallbackExpanded: boolean) => {
39+
setExpandedDirectories((current) => ({
40+
...current,
41+
[pathValue]: !(current[pathValue] ?? fallbackExpanded),
42+
}));
43+
}, []);
6144

6245
const renderTreeNode = (node: TurnDiffTreeNode, depth: number) => {
6346
const leftPadding = 8 + depth * 14;
@@ -88,18 +71,13 @@ export const ChangedFilesTree = memo(function ChangedFilesTree(props: {
8871
</span>
8972
{hasNonZeroStat(node.stat) && (
9073
<span className="ml-auto shrink-0 font-mono text-[10px] tabular-nums">
91-
<DiffStatLabel
92-
additions={node.stat.additions}
93-
deletions={node.stat.deletions}
94-
/>
74+
<DiffStatLabel additions={node.stat.additions} deletions={node.stat.deletions} />
9575
</span>
9676
)}
9777
</button>
9878
{isExpanded && (
9979
<div className="space-y-0.5">
100-
{node.children.map((childNode) =>
101-
renderTreeNode(childNode, depth + 1),
102-
)}
80+
{node.children.map((childNode) => renderTreeNode(childNode, depth + 1))}
10381
</div>
10482
)}
10583
</div>
@@ -126,26 +104,17 @@ export const ChangedFilesTree = memo(function ChangedFilesTree(props: {
126104
</span>
127105
{node.stat && (
128106
<span className="ml-auto shrink-0 font-mono text-[10px] tabular-nums">
129-
<DiffStatLabel
130-
additions={node.stat.additions}
131-
deletions={node.stat.deletions}
132-
/>
107+
<DiffStatLabel additions={node.stat.additions} deletions={node.stat.deletions} />
133108
</span>
134109
)}
135110
</button>
136111
);
137112
};
138113

139-
return (
140-
<div className="space-y-0.5">
141-
{treeNodes.map((node) => renderTreeNode(node, 0))}
142-
</div>
143-
);
114+
return <div className="space-y-0.5">{treeNodes.map((node) => renderTreeNode(node, 0))}</div>;
144115
});
145116

146-
function collectDirectoryPaths(
147-
nodes: ReadonlyArray<TurnDiffTreeNode>,
148-
): string[] {
117+
function collectDirectoryPaths(nodes: ReadonlyArray<TurnDiffTreeNode>): string[] {
149118
const paths: string[] = [];
150119
for (const node of nodes) {
151120
if (node.kind !== "directory") continue;

apps/web/src/components/chat/ChatHeader.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import GitActionsControl from "../GitActionsControl";
99
import { DiffIcon } from "lucide-react";
1010
import { Badge } from "../ui/badge";
1111
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
12-
import ProjectScriptsControl, {
13-
type NewProjectScriptInput,
14-
} from "../ProjectScriptsControl";
12+
import ProjectScriptsControl, { type NewProjectScriptInput } from "../ProjectScriptsControl";
1513
import { Toggle } from "../ui/toggle";
1614
import { SidebarTrigger } from "../ui/sidebar";
1715
import { OpenInPicker } from "./OpenInPicker";
@@ -31,10 +29,7 @@ interface ChatHeaderProps {
3129
diffOpen: boolean;
3230
onRunProjectScript: (script: ProjectScript) => void;
3331
onAddProjectScript: (input: NewProjectScriptInput) => Promise<void>;
34-
onUpdateProjectScript: (
35-
scriptId: string,
36-
input: NewProjectScriptInput,
37-
) => Promise<void>;
32+
onUpdateProjectScript: (scriptId: string, input: NewProjectScriptInput) => Promise<void>;
3833
onDeleteProjectScript: (scriptId: string) => Promise<void>;
3934
onToggleDiff: () => void;
4035
}
@@ -74,10 +69,7 @@ export const ChatHeader = memo(function ChatHeader({
7469
</Badge>
7570
)}
7671
{activeProjectName && !isGitRepo && (
77-
<Badge
78-
variant="outline"
79-
className="shrink-0 text-[10px] text-amber-700"
80-
>
72+
<Badge variant="outline" className="shrink-0 text-[10px] text-amber-700">
8173
No Git
8274
</Badge>
8375
)}
@@ -101,9 +93,7 @@ export const ChatHeader = memo(function ChatHeader({
10193
openInCwd={openInCwd}
10294
/>
10395
)}
104-
{activeProjectName && (
105-
<GitActionsControl gitCwd={gitCwd} activeThreadId={activeThreadId} />
106-
)}
96+
{activeProjectName && <GitActionsControl gitCwd={gitCwd} activeThreadId={activeThreadId} />}
10797
<Tooltip>
10898
<TooltipTrigger
10999
render={

apps/web/src/components/chat/CodexTraitsPicker.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,12 @@ export const CodexTraitsPicker = memo(function CodexTraitsPicker(props: {
5656
</MenuTrigger>
5757
<MenuPopup align="start">
5858
<MenuGroup>
59-
<div className="px-2 py-1.5 font-medium text-muted-foreground text-xs">
60-
Reasoning
61-
</div>
59+
<div className="px-2 py-1.5 font-medium text-muted-foreground text-xs">Reasoning</div>
6260
<MenuRadioGroup
6361
value={props.effort}
6462
onValueChange={(value) => {
6563
if (!value) return;
66-
const nextEffort = props.options.find(
67-
(option) => option === value,
68-
);
64+
const nextEffort = props.options.find((option) => option === value);
6965
if (!nextEffort) return;
7066
props.onEffortChange(nextEffort);
7167
}}
@@ -80,9 +76,7 @@ export const CodexTraitsPicker = memo(function CodexTraitsPicker(props: {
8076
</MenuGroup>
8177
<MenuDivider />
8278
<MenuGroup>
83-
<div className="px-2 py-1.5 font-medium text-muted-foreground text-xs">
84-
Fast Mode
85-
</div>
79+
<div className="px-2 py-1.5 font-medium text-muted-foreground text-xs">Fast Mode</div>
8680
<MenuRadioGroup
8781
value={props.fastModeEnabled ? "on" : "off"}
8882
onValueChange={(value) => {

0 commit comments

Comments
 (0)