Skip to content

Commit 36f71de

Browse files
committed
fix comments
1 parent 0019c69 commit 36f71de

File tree

6 files changed

+28
-61
lines changed

6 files changed

+28
-61
lines changed

app/src/components/chat/ChatMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ const ChatMessage = ({ type, content, steps, queryData, analysisInfo, confirmati
227227
</thead>
228228
<tbody>
229229
{queryData.map((row, index) => (
230-
<tr key={index} className="border-b border-border/50 hover:bg-muted/30">
230+
<tr key={index} className="border-b border-border hover:bg-muted">
231231
{Object.values(row).map((value: any, cellIndex) => (
232232
<td key={cellIndex} className="px-3 py-2 text-foreground whitespace-nowrap">
233233
{String(value)}

app/src/components/modals/DatabaseModal.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,26 @@ const DatabaseModal = ({ open, onOpenChange }: DatabaseModalProps) => {
107107
});
108108

109109
if (!response.ok) {
110+
// Try to parse error message from server for all error responses
111+
try {
112+
const errorData = await response.json();
113+
if (errorData.error) {
114+
throw new Error(errorData.error);
115+
}
116+
} catch (jsonError) {
117+
// If JSON parsing fails, fall back to status-based messages
118+
}
119+
120+
// Fallback error messages by status code
110121
const errorMessages: Record<number, string> = {
122+
400: 'Invalid database connection URL.',
111123
401: 'Not authenticated. Please sign in to connect databases.',
112124
403: 'Access denied. You do not have permission to connect databases.',
125+
409: 'Conflict with existing database connection.',
126+
422: 'Invalid database connection parameters.',
113127
500: 'Server error. Please try again later.',
114128
};
115129

116-
// For 400, try to get server error message first
117-
if (response.status === 400) {
118-
const errorData = await response.json().catch(() => ({}));
119-
throw new Error(errorData.error || 'Invalid database connection URL.');
120-
}
121-
122130
throw new Error(errorMessages[response.status] || `Failed to connect to database (${response.status})`);
123131
}
124132

app/src/components/ui/theme-toggle.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ type Theme = "light" | "dark";
1212
const ThemeToggle = () => {
1313
const [theme, setTheme] = useState<Theme>(() => {
1414
try {
15-
const savedTheme = localStorage.getItem("theme") as Theme;
16-
return savedTheme || "dark";
15+
const savedTheme = localStorage.getItem("theme");
16+
// Normalize: only accept "light" or "dark", default to "dark"
17+
return (savedTheme === "light" || savedTheme === "dark") ? savedTheme : "dark";
1718
} catch {
1819
return "dark";
1920
}

app/src/index.css

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -228,55 +228,7 @@ Based on shadcn/ui Clean Slate theme with OKLch color space for perceptual unifo
228228
}
229229
}
230230

231-
@theme inline {
232-
--color-background: var(--background);
233-
--color-foreground: var(--foreground);
234-
--color-card: var(--card);
235-
--color-card-foreground: var(--card-foreground);
236-
--color-popover: var(--popover);
237-
--color-popover-foreground: var(--popover-foreground);
238-
--color-primary: var(--primary);
239-
--color-primary-foreground: var(--primary-foreground);
240-
--color-secondary: var(--secondary);
241-
--color-secondary-foreground: var(--secondary-foreground);
242-
--color-muted: var(--muted);
243-
--color-muted-foreground: var(--muted-foreground);
244-
--color-accent: var(--accent);
245-
--color-accent-foreground: var(--accent-foreground);
246-
--color-destructive: var(--destructive);
247-
--color-destructive-foreground: var(--destructive-foreground);
248-
--color-border: var(--border);
249-
--color-input: var(--input);
250-
--color-ring: var(--ring);
251-
--color-chart-1: var(--chart-1);
252-
--color-chart-2: var(--chart-2);
253-
--color-chart-3: var(--chart-3);
254-
--color-chart-4: var(--chart-4);
255-
--color-chart-5: var(--chart-5);
256-
--color-sidebar: var(--sidebar);
257-
--color-sidebar-foreground: var(--sidebar-foreground);
258-
--color-sidebar-primary: var(--sidebar-primary);
259-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
260-
--color-sidebar-accent: var(--sidebar-accent);
261-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
262-
--color-sidebar-border: var(--sidebar-border);
263-
--color-sidebar-ring: var(--sidebar-ring);
264-
--font-sans: var(--font-sans);
265-
--font-mono: var(--font-mono);
266-
--font-serif: var(--font-serif);
267-
--radius-sm: calc(var(--radius) - 4px);
268-
--radius-md: calc(var(--radius) - 2px);
269-
--radius-lg: var(--radius);
270-
--radius-xl: calc(var(--radius) + 4px);
271-
--shadow-2xs: var(--shadow-2xs);
272-
--shadow-xs: var(--shadow-xs);
273-
--shadow-sm: var(--shadow-sm);
274-
--shadow: var(--shadow);
275-
--shadow-md: var(--shadow-md);
276-
--shadow-lg: var(--shadow-lg);
277-
--shadow-xl: var(--shadow-xl);
278-
--shadow-2xl: var(--shadow-2xl);
279-
}
231+
/* Removed @theme inline block - incompatible with Tailwind v3 */
280232

281233
@layer base {
282234
* {

app/src/main.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import "./index.css";
44

55
// Initialize theme on page load
66
try {
7-
const savedTheme = localStorage.getItem("theme") || "dark";
8-
document.documentElement.setAttribute("data-theme", savedTheme);
7+
const savedTheme = localStorage.getItem("theme");
8+
// Normalize: only accept "light" or "dark", default to "dark"
9+
const theme = (savedTheme === "light" || savedTheme === "dark") ? savedTheme : "dark";
10+
document.documentElement.setAttribute("data-theme", theme);
11+
// Update localStorage if we normalized the value
12+
if (savedTheme !== theme) {
13+
localStorage.setItem("theme", theme);
14+
}
915
} catch {
1016
document.documentElement.setAttribute("data-theme", "dark");
1117
}

app/tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Config } from "tailwindcss";
22

33
export default {
4-
darkMode: ["class"],
4+
darkMode: ["selector", "[data-theme='dark']"],
55
content: [
66
"./index.html",
77
"./src/**/*.{ts,tsx,js,jsx}",

0 commit comments

Comments
 (0)