From 0ccf2204d9cc6cdbc3ff6f319cef5856a59e7829 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 25 Jul 2025 13:09:39 -0500 Subject: [PATCH] Add Git History dialog --- src/components/Shakespeare/ChatPane.tsx | 2 + src/components/ai/GitHistoryDialog.test.tsx | 66 ++++++ src/components/ai/GitHistoryDialog.tsx | 201 +++++++++++++++++++ src/components/onboarding/AISettingsStep.tsx | 5 +- 4 files changed, 271 insertions(+), 3 deletions(-) create mode 100644 src/components/ai/GitHistoryDialog.test.tsx create mode 100644 src/components/ai/GitHistoryDialog.tsx diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index 5b0b20bd..9d4a037a 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -11,6 +11,7 @@ import { copyDirectory, copyFile } from '@/lib/copyFiles'; import { generateSecretKey, getPublicKey, nip19 } from 'nostr-tools'; import { bytesToHex } from 'nostr-tools/utils'; import { MessageItem } from '@/components/ai/MessageItem'; +import { GitHistoryDialog } from '@/components/ai/GitHistoryDialog'; import { TextEditorViewTool } from '@/lib/tools/TextEditorViewTool'; import { TextEditorWriteTool } from '@/lib/tools/TextEditorWriteTool'; import { TextEditorStrReplaceTool } from '@/lib/tools/TextEditorStrReplaceTool'; @@ -326,6 +327,7 @@ When creating new components or pages, follow the existing patterns in the codeb

Chat to build your project

+ + + + + + + Git History + + + View the commit history for this project + + + +
+ {isLoading ? ( +
+
+
+ Loading git history... +
+
+ ) : error ? ( +
+
+

Error loading git history

+

{error}

+ +
+
+ ) : !commits || commits.length === 0 ? ( +
+
+ +

No commits found

+

+ This project doesn't have any git commits yet +

+
+
+ ) : ( + +
+ {commits.map((commit, index) => ( +
+
+
+
+
+ +
+
+

+ {commit.commit.message} +

+ + + {commit.oid.substring(0, 7)} + +
+ +
+
+ + {commit.commit.author.name} +
+ +
+ + + {formatRelativeTime(commit.commit.author.timestamp)} + +
+
+
+
+ + {index < commits.length - 1 && ( +
+
+
+ )} +
+ ))} +
+ + )} +
+ + + ); +} \ No newline at end of file diff --git a/src/components/onboarding/AISettingsStep.tsx b/src/components/onboarding/AISettingsStep.tsx index c0438db3..e4e3521d 100644 --- a/src/components/onboarding/AISettingsStep.tsx +++ b/src/components/onboarding/AISettingsStep.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; -import { ArrowLeft, ArrowRight, Settings, CheckCircle, Bot } from 'lucide-react'; +import { ArrowLeft, ArrowRight, Settings, Bot } from 'lucide-react'; import { useAISettings } from '@/hooks/useAISettings'; interface AISettingsStepProps { @@ -13,9 +13,8 @@ interface AISettingsStepProps { } export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepProps) { - const { settings, updateSettings, isConfigured } = useAISettings(); + const { settings, updateSettings } = useAISettings(); const [localSettings, setLocalSettings] = useState(settings); - const [isTesting, setIsTesting] = useState(false); const handleSave = () => { updateSettings(localSettings);