Skip to content

Commit 3347208

Browse files
committed
feat: update IPC handlers and utilities
1 parent 58c413d commit 3347208

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2197
-171
lines changed

src/components/AppUpgrades.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function AppUpgrades({ appId }: { appId: number | null }) {
125125
onClick={(e) => {
126126
e.stopPropagation();
127127
IpcClient.getInstance().openExternalUrl(
128-
upgrade.manualUpgradeUrl ?? "https://dyad.sh/docs",
128+
upgrade.manualUpgradeUrl ?? "https://alifullstack.com/docs",
129129
);
130130
}}
131131
className="underline font-medium hover:dark:text-red-200"

src/components/CapacitorControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function CapacitorControls({ appId }: CapacitorControlsProps) {
136136
onClick={() => {
137137
// TODO: Add actual help link
138138
IpcClient.getInstance().openExternalUrl(
139-
"https://dyad.sh/docs/guides/mobile-app#troubleshooting",
139+
"https://alifullstack.com/docs/guides/mobile-app#troubleshooting",
140140
);
141141
}}
142142
className="text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 flex items-center gap-1"

src/components/ChatInputControls.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import { ChatModeSelector } from "./ChatModeSelector";
55

66
export function ChatInputControls({
77
showContextFilesPicker = false,
8+
appId,
89
}: {
910
showContextFilesPicker?: boolean;
11+
appId?: number;
1012
}) {
1113
return (
1214
<div className="flex">
13-
<ChatModeSelector />
15+
<ChatModeSelector appId={appId} />
1416
<div className="w-1.5"></div>
1517
<ModelPicker />
1618
<div className="w-1.5"></div>

src/components/ChatModeSelector.tsx

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,47 @@ import {
1313
import { useSettings } from "@/hooks/useSettings";
1414
import type { ChatMode } from "@/lib/schemas";
1515
import { cn } from "@/lib/utils";
16+
import { IpcClient } from "@/ipc/ipc_client";
17+
import { showError } from "@/lib/toast";
18+
import { useState } from "react";
19+
import { Loader2 } from "lucide-react";
1620

17-
export function ChatModeSelector() {
21+
export function ChatModeSelector({ appId }: { appId?: number }) {
1822
const { settings, updateSettings } = useSettings();
23+
const [isCreatingFolder, setIsCreatingFolder] = useState(false);
1924

2025
const selectedMode = settings?.selectedChatMode || "build";
2126

22-
const handleModeChange = (value: string) => {
23-
updateSettings({ selectedChatMode: value as ChatMode });
27+
const handleModeChange = async (value: string) => {
28+
const newMode = value as ChatMode;
29+
30+
// If switching to backend mode and we have an app ID, check if backend folder exists
31+
if (newMode === "backend" && appId) {
32+
try {
33+
setIsCreatingFolder(true);
34+
// Get the app to check its structure
35+
const app = await IpcClient.getInstance().getApp(appId);
36+
const backendFiles = app.files.filter((file: string) => file.startsWith("backend/"));
37+
38+
// If no backend files exist, create the backend folder
39+
if (backendFiles.length === 0) {
40+
await IpcClient.getInstance().invoke("create-missing-folder", {
41+
appId,
42+
folderType: "backend",
43+
backendFramework: settings?.selectedBackendFramework,
44+
});
45+
}
46+
} catch (error) {
47+
console.error("Error creating backend folder:", error);
48+
showError(error);
49+
return; // Don't change the mode if folder creation failed
50+
} finally {
51+
setIsCreatingFolder(false);
52+
}
53+
}
54+
55+
// Update the chat mode
56+
updateSettings({ selectedChatMode: newMode });
2457
};
2558

2659
const getModeDisplayName = (mode: ChatMode) => {
@@ -29,13 +62,15 @@ export function ChatModeSelector() {
2962
return "Build";
3063
case "ask":
3164
return "Ask";
65+
case "backend":
66+
return "Backend";
3267
default:
3368
return "Build";
3469
}
3570
};
3671

3772
return (
38-
<Select value={selectedMode} onValueChange={handleModeChange}>
73+
<Select value={selectedMode} onValueChange={handleModeChange} disabled={isCreatingFolder}>
3974
<Tooltip>
4075
<TooltipTrigger asChild>
4176
<MiniSelectTrigger
@@ -48,10 +83,19 @@ export function ChatModeSelector() {
4883
)}
4984
size="sm"
5085
>
51-
<SelectValue>{getModeDisplayName(selectedMode)}</SelectValue>
86+
{isCreatingFolder ? (
87+
<div className="flex items-center gap-1">
88+
<Loader2 size={12} className="animate-spin" />
89+
<span>Creating...</span>
90+
</div>
91+
) : (
92+
<SelectValue>{getModeDisplayName(selectedMode)}</SelectValue>
93+
)}
5294
</MiniSelectTrigger>
5395
</TooltipTrigger>
54-
<TooltipContent>Open mode menu</TooltipContent>
96+
<TooltipContent>
97+
{isCreatingFolder ? "Creating backend folder..." : "Open mode menu"}
98+
</TooltipContent>
5599
</Tooltip>
56100
<SelectContent align="start" onCloseAutoFocus={(e) => e.preventDefault()}>
57101
<SelectItem value="build">
@@ -70,6 +114,14 @@ export function ChatModeSelector() {
70114
</span>
71115
</div>
72116
</SelectItem>
117+
<SelectItem value="backend">
118+
<div className="flex flex-col items-start">
119+
<span className="font-medium">Backend</span>
120+
<span className="text-xs text-muted-foreground">
121+
Backend development with Roo-Code
122+
</span>
123+
</div>
124+
</SelectItem>
73125
</SelectContent>
74126
</Select>
75127
);

src/components/ChatPanel.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import { useState, useRef, useEffect, useCallback } from "react";
22
import { useAtom, useAtomValue } from "jotai";
33
import { chatMessagesAtom, chatStreamCountAtom } from "../atoms/chatAtoms";
44
import { IpcClient } from "@/ipc/ipc_client";
5+
import { useSettings } from "@/hooks/useSettings";
56

67
import { ChatHeader } from "./chat/ChatHeader";
78
import { MessagesList } from "./chat/MessagesList";
89
import { ChatInput } from "./chat/ChatInput";
910
import { VersionPane } from "./chat/VersionPane";
1011
import { ChatError } from "./chat/ChatError";
1112

13+
// Backend components
14+
import { BackendChatPanel as BackendChatPanelComponent } from "./backend-chat/BackendChatPanel";
15+
1216
interface ChatPanelProps {
1317
chatId?: number;
1418
isPreviewOpen: boolean;
@@ -20,6 +24,9 @@ export function ChatPanel({
2024
isPreviewOpen,
2125
onTogglePreview,
2226
}: ChatPanelProps) {
27+
const { settings } = useSettings();
28+
const isBackendMode = settings?.selectedChatMode === "backend";
29+
2330
const [messages, setMessages] = useAtom(chatMessagesAtom);
2431
const [isVersionPaneOpen, setIsVersionPaneOpen] = useState(false);
2532
const [error, setError] = useState<string | null>(null);
@@ -114,6 +121,18 @@ export function ChatPanel({
114121
}
115122
}, [messages, isUserScrolling]);
116123

124+
// If in backend mode, render backend components
125+
if (isBackendMode) {
126+
return (
127+
<BackendChatPanelComponent
128+
chatId={chatId}
129+
isPreviewOpen={isPreviewOpen}
130+
onTogglePreview={onTogglePreview}
131+
/>
132+
);
133+
}
134+
135+
// Default frontend mode
117136
return (
118137
<div className="flex flex-col h-full">
119138
<ChatHeader

src/components/CreateAppDialog.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ interface CreateAppDialogProps {
2626
open: boolean;
2727
onOpenChange: (open: boolean) => void;
2828
template: Template | undefined;
29+
selectedBackendFramework?: string | null;
2930
}
3031

3132
export function CreateAppDialog({
3233
open,
3334
onOpenChange,
3435
template,
36+
selectedBackendFramework,
3537
}: CreateAppDialogProps) {
3638
const setSelectedAppId = useSetAtom(selectedAppIdAtom);
3739
const [appName, setAppName] = useState("");
@@ -52,7 +54,11 @@ export function CreateAppDialog({
5254

5355
setIsSubmitting(true);
5456
try {
55-
const result = await createApp({ name: appName.trim() });
57+
const result = await createApp({
58+
name: appName.trim(),
59+
selectedTemplateId: template?.id,
60+
selectedBackendFramework
61+
});
5662
if (template && NEON_TEMPLATE_IDS.has(template.id)) {
5763
await neonTemplateHook({
5864
appId: result.app.id,

src/components/ErrorBoundary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ ${debugInfo.logs.slice(-3_500) || "No logs available"}
5959
const encodedTitle = encodeURIComponent(
6060
"[bug] Error in Dyad application",
6161
);
62-
const githubIssueUrl = `https://github.com/dyad-sh/dyad/issues/new?title=${encodedTitle}&labels=bug,filed-from-app,client-error&body=${encodedBody}`;
62+
const githubIssueUrl = `https://github.com/SFARPak/dyad/issues/new?title=${encodedTitle}&labels=bug,filed-from-app,client-error&body=${encodedBody}`;
6363

6464
// Open the pre-filled GitHub issue page
6565
await IpcClient.getInstance().openExternalUrl(githubIssueUrl);
6666
} catch (err) {
6767
console.error("Failed to prepare bug report:", err);
6868
// Fallback to opening the regular GitHub issue page
6969
IpcClient.getInstance().openExternalUrl(
70-
"https://github.com/dyad-sh/dyad/issues/new",
70+
"https://github.com/SFARPak/dyad/issues/new",
7171
);
7272
} finally {
7373
setIsLoading(false);

src/components/GitHubConnector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function ConnectedGitHubConnector({
204204
onClick={(e) => {
205205
e.preventDefault();
206206
IpcClient.getInstance().openExternalUrl(
207-
"https://www.dyad.sh/docs/integrations/github#troubleshooting",
207+
"https://www.alifullstack.com/docs/integrations/github#troubleshooting",
208208
);
209209
}}
210210
className="cursor-pointer text-blue-600 hover:underline dark:text-blue-400"

src/components/HelpDialog.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ ${debugInfo.logs.slice(-3_500) || "No logs available"}
110110
// Create the GitHub issue URL with the pre-filled body
111111
const encodedBody = encodeURIComponent(issueBody);
112112
const encodedTitle = encodeURIComponent("[bug] <WRITE TITLE HERE>");
113-
const githubIssueUrl = `https://github.com/dyad-sh/dyad/issues/new?title=${encodedTitle}&labels=bug,filed-from-app&body=${encodedBody}`;
113+
const githubIssueUrl = `https://github.com/SFARPak/dyad/issues/new?title=${encodedTitle}&labels=bug,filed-from-app&body=${encodedBody}`;
114114

115115
// Open the pre-filled GitHub issue page
116116
IpcClient.getInstance().openExternalUrl(githubIssueUrl);
117117
} catch (error) {
118118
console.error("Failed to prepare bug report:", error);
119119
// Fallback to opening the regular GitHub issue page
120120
IpcClient.getInstance().openExternalUrl(
121-
"https://github.com/dyad-sh/dyad/issues/new",
121+
"https://github.com/SFARPak/dyad/issues/new",
122122
);
123123
} finally {
124124
setIsLoading(false);
@@ -164,7 +164,7 @@ ${debugInfo.logs.slice(-3_500) || "No logs available"}
164164

165165
// Get signed URL
166166
const response = await fetch(
167-
"https://upload-logs.dyad.sh/generate-upload-url",
167+
"https://upload-logs.alifullstack.com/generate-upload-url",
168168
{
169169
method: "POST",
170170
headers: {
@@ -230,7 +230,7 @@ Session ID: ${sessionId}
230230

231231
const encodedBody = encodeURIComponent(issueBody);
232232
const encodedTitle = encodeURIComponent("[session report] <add title>");
233-
const githubIssueUrl = `https://github.com/dyad-sh/dyad/issues/new?title=${encodedTitle}&labels=support&body=${encodedBody}`;
233+
const githubIssueUrl = `https://github.com/SFARPak/dyad/issues/new?title=${encodedTitle}&labels=support&body=${encodedBody}`;
234234

235235
IpcClient.getInstance().openExternalUrl(githubIssueUrl);
236236
handleClose();
@@ -403,7 +403,7 @@ Session ID: ${sessionId}
403403
variant="outline"
404404
onClick={() => {
405405
IpcClient.getInstance().openExternalUrl(
406-
"https://www.dyad.sh/docs",
406+
"https://www.alifullstack.com/docs",
407407
);
408408
}}
409409
className="w-full py-6 bg-(--background-lightest)"

src/components/NeonConnector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function NeonConnector() {
6969
await IpcClient.getInstance().fakeHandleNeonConnect();
7070
} else {
7171
await IpcClient.getInstance().openExternalUrl(
72-
"https://oauth.dyad.sh/api/integrations/neon/login",
72+
"https://oauth.alifullstack.com/api/integrations/neon/login",
7373
);
7474
}
7575
}}

0 commit comments

Comments
 (0)