Skip to content

Commit 58c413d

Browse files
committed
feat: add backend framework assets and backend chat components
1 parent 3b63347 commit 58c413d

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

src/components/backend-chat/BackendChatInput.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
} from "lucide-react";
2121
import type React from "react";
2222
import { useState, useEffect, useCallback } from "react";
23-
import log from "electron-log";
2423

2524
import { useSettings } from "@/hooks/useSettings";
2625
import { IpcClient } from "@/ipc/ipc_client";
@@ -67,7 +66,6 @@ import { selectedComponentPreviewAtom } from "@/atoms/previewAtoms";
6766
import { SelectedComponentDisplay } from "../chat/SelectedComponentDisplay";
6867

6968
const showTokenBarAtom = atom(false);
70-
const logger = log.scope("BackendChatInput");
7169

7270
export function BackendChatInput({ chatId }: { chatId?: number }) {
7371
const posthog = usePostHog();
@@ -100,25 +98,6 @@ export function BackendChatInput({ chatId }: { chatId?: number }) {
10098
handlePaste,
10199
} = useAttachments();
102100

103-
// Auto-start backend server when entering backend mode
104-
useEffect(() => {
105-
const startBackendServer = async () => {
106-
if (!appId) return;
107-
108-
try {
109-
logger.info(`Auto-starting backend server for app: ${appId}`);
110-
await IpcClient.getInstance().startBackendServer(appId);
111-
logger.info("Backend server started successfully");
112-
} catch (error) {
113-
logger.error("Failed to auto-start backend server:", error);
114-
}
115-
};
116-
117-
// Small delay to ensure component is fully mounted
118-
const timeoutId = setTimeout(startBackendServer, 1000);
119-
return () => clearTimeout(timeoutId);
120-
}, [appId]);
121-
122101
// Use the hook to fetch the proposal
123102
const {
124103
proposalResult,
@@ -349,7 +328,7 @@ export function BackendChatInput({ chatId }: { chatId?: number }) {
349328
</div>
350329
<div className="pl-2 pr-1 flex items-center justify-between pb-2">
351330
<div className="flex items-center">
352-
<ChatInputControls showContextFilesPicker={true} appId={appId ?? undefined} />
331+
<ChatInputControls showContextFilesPicker={true} appId={appId} />
353332
{/* File attachment dropdown */}
354333
<FileAttachmentDropdown
355334
onFileSelect={handleFileSelect}

src/components/backend-chat/BackendChatPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function BackendChatPanel({
2525
const [error, setError] = useState<string | null>(null);
2626
const streamCount = useAtomValue(chatStreamCountAtom);
2727

28-
const messagesEndRef = useRef<HTMLDivElement>(null);
28+
const messagesEndRef = useRef<HTMLDivElement | null>(null);
2929
const messagesContainerRef = useRef<HTMLDivElement | null>(null);
3030

3131
// Scroll-related properties

src/components/backend-chat/BackendMessagesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BackendChatMessage } from "./BackendChatMessage";
44

55
interface BackendMessagesListProps {
66
messages: Message[];
7-
messagesEndRef: React.RefObject<HTMLDivElement | null>;
7+
messagesEndRef: React.RefObject<HTMLDivElement>;
88
}
99

1010
export const BackendMessagesList = forwardRef<

src/components/backend-chat/BackendVersionPane.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ export function BackendVersionPane({ isVisible, onClose }: BackendVersionPanePro
5858
<p className="text-sm text-gray-900 dark:text-gray-100 mb-2">
5959
{version.message || "Backend changes"}
6060
</p>
61-
<div className="flex items-center gap-1 text-xs text-muted-foreground">
62-
<Clock size={12} />
63-
<span>
64-
{formatDistanceToNow(new Date(version.timestamp * 1000), { addSuffix: true })}
65-
</span>
66-
</div>
61+
{version.author && (
62+
<div className="flex items-center gap-1 text-xs text-muted-foreground">
63+
<GitBranch size={12} />
64+
<span>{version.author.name}</span>
65+
<span></span>
66+
<Clock size={12} />
67+
<span>
68+
{formatDistanceToNow(new Date(version.date), { addSuffix: true })}
69+
</span>
70+
</div>
71+
)}
6772
</div>
6873
</div>
6974
</div>

0 commit comments

Comments
 (0)