From 7912933c3456fb64829776fb5d8fa3362c37e950 Mon Sep 17 00:00:00 2001 From: vgcman16 <155417613+vgcman16@users.noreply.github.com> Date: Thu, 5 Jun 2025 21:23:06 -0500 Subject: [PATCH] Fix notes tab handler guard and lint --- .../@settings/tabs/notes/NotesTab.tsx | 27 ++++++--------- app/components/chat/BaseChat.tsx | 6 +--- app/components/chat/CodeBlock.tsx | 1 + .../chatExportAndImport/ImportButtons.tsx | 2 +- app/components/setup/SetupWizard.tsx | 28 +++++++++++++--- app/lib/api/features.ts | 4 +++ app/lib/common/prompt-library.ts | 16 ++------- app/lib/stores/notes.ts | 6 +++- app/lib/stores/workbench.ts | 9 ++--- app/routes/api.chat.ts | 33 ++++++++++--------- app/utils/constants.ts | 1 + 11 files changed, 68 insertions(+), 65 deletions(-) diff --git a/app/components/@settings/tabs/notes/NotesTab.tsx b/app/components/@settings/tabs/notes/NotesTab.tsx index da949f3e..1567371d 100644 --- a/app/components/@settings/tabs/notes/NotesTab.tsx +++ b/app/components/@settings/tabs/notes/NotesTab.tsx @@ -10,7 +10,11 @@ export default function NotesTab() { const handleAdd = () => { const text = noteText.trim(); - if (!text) return; + + if (!text) { + return; + } + addNote(text); setNoteText(''); }; @@ -27,7 +31,7 @@ export default function NotesTab() { 'border border-bolt-elements-borderColor', 'text-bolt-elements-textPrimary', 'focus:outline-none focus:ring-2 focus:ring-purple-500/30', - 'min-h-[80px] resize-vertical' + 'min-h-[80px] resize-vertical', )} placeholder="Add a note for the AI" /> @@ -37,25 +41,14 @@ export default function NotesTab() {
.env.local
:.env.local
:
+ {`VITE_SUPABASE_URL=${supabaseConn.credentials.supabaseUrl}\nVITE_SUPABASE_ANON_KEY=${supabaseConn.credentials.anonKey}`}
{`import { createClient } from '@supabase/supabase-js';\n\nexport const supabase = createClient(import.meta.env.VITE_SUPABASE_URL!, import.meta.env.VITE_SUPABASE_ANON_KEY!);`}@@ -111,12 +125,16 @@ export function SetupWizard() { value={firebase.projectId} onChange={(e) => updateFirebaseConfig({ projectId: e.currentTarget.value })} /> -
.env.local
:.env.local
:
+ {`VITE_FIREBASE_API_KEY=${firebase.apiKey}\nVITE_FIREBASE_AUTH_DOMAIN=${firebase.authDomain}\nVITE_FIREBASE_PROJECT_ID=${firebase.projectId}`}
{`import { initializeApp } from 'firebase/app';\nimport { getAuth } from 'firebase/auth';\nimport { getFirestore } from 'firebase/firestore';\n\nconst firebaseConfig = {\n apiKey: import.meta.env.VITE_FIREBASE_API_KEY!,\n authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN!,\n projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID!,\n};\n\nconst app = initializeApp(firebaseConfig);\nexport const auth = getAuth(app);\nexport const db = getFirestore(app);`}diff --git a/app/lib/api/features.ts b/app/lib/api/features.ts index 0797a2dd..aaaa946a 100644 --- a/app/lib/api/features.ts +++ b/app/lib/api/features.ts @@ -3,18 +3,22 @@ export interface Feature { * Unique identifier for the feature. */ id: string; + /** * Short title of the feature to display in the UI. */ name: string; + /** * Description of what the feature does. */ description: string; + /** * Whether the user has already viewed/acknowledged this feature. */ viewed: boolean; + /** * ISO date string for when the feature was released. */ diff --git a/app/lib/common/prompt-library.ts b/app/lib/common/prompt-library.ts index 68b8803c..a72e811a 100644 --- a/app/lib/common/prompt-library.ts +++ b/app/lib/common/prompt-library.ts @@ -31,24 +31,12 @@ export class PromptLibrary { default: { label: 'Default Prompt', description: 'This is the battle tested default system Prompt', - get: (options) => - getSystemPrompt( - options.cwd, - options.supabase, - options.designScheme, - options.userNotes, - ), + get: (options) => getSystemPrompt(options.cwd, options.supabase, options.designScheme, options.userNotes), }, enhanced: { label: 'Fine Tuned Prompt', description: 'An fine tuned prompt for better results', - get: (options) => - getFineTunedPrompt( - options.cwd, - options.supabase, - options.designScheme, - options.userNotes, - ), + get: (options) => getFineTunedPrompt(options.cwd, options.supabase, options.designScheme, options.userNotes), }, optimized: { label: 'Optimized Prompt (experimental)', diff --git a/app/lib/stores/notes.ts b/app/lib/stores/notes.ts index da2c7e39..a16ab1e3 100644 --- a/app/lib/stores/notes.ts +++ b/app/lib/stores/notes.ts @@ -12,6 +12,7 @@ function loadNotes(): Note[] { if (typeof localStorage === 'undefined') { return []; } + try { const json = localStorage.getItem(NOTES_KEY); return json ? JSON.parse(json) : []; @@ -21,7 +22,10 @@ function loadNotes(): Note[] { } function saveNotes(notes: Note[]) { - if (typeof localStorage === 'undefined') return; + if (typeof localStorage === 'undefined') { + return; + } + try { localStorage.setItem(NOTES_KEY, JSON.stringify(notes)); } catch {} diff --git a/app/lib/stores/workbench.ts b/app/lib/stores/workbench.ts index b033345d..9a3d01f9 100644 --- a/app/lib/stores/workbench.ts +++ b/app/lib/stores/workbench.ts @@ -629,12 +629,9 @@ export class WorkbenchStore { } } - actionStreamSampler = createSampler( - async (data: ActionCallbackData, isStreaming: boolean = false) => { - return await this._runAction(data, isStreaming); - }, - ACTION_STREAM_SAMPLE_INTERVAL, - ); + actionStreamSampler = createSampler(async (data: ActionCallbackData, isStreaming: boolean = false) => { + return await this._runAction(data, isStreaming); + }, ACTION_STREAM_SAMPLE_INTERVAL); #getArtifact(id: string) { const artifacts = this.artifacts.get(); diff --git a/app/routes/api.chat.ts b/app/routes/api.chat.ts index 2e5370fa..4d7af2c6 100644 --- a/app/routes/api.chat.ts +++ b/app/routes/api.chat.ts @@ -38,23 +38,24 @@ function parseCookies(cookieHeader: string): Record