Skip to content

Commit e8eb628

Browse files
committed
Refactor UI components and add Vite config types
Refactored form fields in Login to use Label components and improved structure. Updated SettingsView badge variant and removed unused imports in Dashboard. Adjusted ObjectListView delete handler signature. Updated tsconfig.node.json to emit declaration files and added vite.config.d.ts for type declarations. Cast Vite plugin to 'any' in vite.config.ts to resolve type issues.
1 parent dcf2be7 commit e8eb628

File tree

7 files changed

+39
-30
lines changed

7 files changed

+39
-30
lines changed

packages/client/src/components/dashboard/ObjectListView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function ObjectListView({ objectName, user, isCreating, navigate, objectS
115115
.catch(err => alert(err.message));
116116
};
117117

118-
const handleDelete = (row: any, index?: number) => {
118+
const handleDelete = (row: any) => {
119119
if (!confirm('Are you sure you want to delete this record?')) return;
120120
const id = row.id || row._id;
121121

@@ -138,7 +138,7 @@ export function ObjectListView({ objectName, user, isCreating, navigate, objectS
138138
.filter(key => !['_id', '__v', 'createdAt', 'updatedAt'].includes(key))
139139
.map(key => {
140140
const field = objectSchema?.fields?.[key];
141-
const type = getFieldType(key);
141+
const type = getFieldType(key) as 'text' | 'number' | 'boolean' | 'date' | 'select' | 'badge';
142142

143143
return {
144144
id: key,
@@ -282,7 +282,7 @@ export function ObjectListView({ objectName, user, isCreating, navigate, objectS
282282
<button onClick={(e) => { e.stopPropagation(); navigate(`/object/${objectName}/${row.id || row._id}`); }} className="p-1 text-stone-400 hover:text-blue-600 transition-colors" title="View/Edit">
283283
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>
284284
</button>
285-
<button onClick={(e) => { e.stopPropagation(); handleDelete(row, idx); }} className="p-1 text-stone-400 hover:text-red-600 transition-colors" title="Delete">
285+
<button onClick={(e) => { e.stopPropagation(); handleDelete(row); }} className="p-1 text-stone-400 hover:text-red-600 transition-colors" title="Delete">
286286
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>
287287
</button>
288288
</div>

packages/client/src/components/dashboard/SettingsView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function SettingsView({ objectCount }: SettingsViewProps) {
2121
</div>
2222
<div className="flex justify-between py-2">
2323
<span className="text-stone-600">Collections</span>
24-
<Badge variant="secondary">{objectCount}</Badge>
24+
<Badge variant="default">{objectCount}</Badge>
2525
</div>
2626
</div>
2727
</Card>

packages/client/src/pages/Dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useEffect } from 'react';
2-
import { Spinner, Badge, Card } from '@objectql/ui';
2+
import { Spinner } from '@objectql/ui';
33
import { useAuth } from '../context/AuthContext';
44
import { useRouter } from '../hooks/useRouter';
55
import { SidebarItem } from '../components/dashboard/SidebarItem';

packages/client/src/pages/Login.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { Card, Input, Button, Spinner } from '@objectql/ui';
2+
import { Card, Input, Button, Spinner, Label } from '@objectql/ui';
33
import { useAuth } from '../context/AuthContext';
44

55
export default function Login() {
@@ -52,30 +52,36 @@ export default function Login() {
5252
<Card className="backdrop-blur-xl bg-white/70 shadow-2xl border-white/50 ring-1 ring-black/5 p-6">
5353
<form onSubmit={handleSubmit} className="space-y-5">
5454
{!isSignIn && (
55+
<div className="space-y-2">
56+
<Label>Full Name</Label>
57+
<Input
58+
value={name}
59+
onChange={(e) => setName(e.target.value)}
60+
placeholder="Jane Doe"
61+
required
62+
/>
63+
</div>
64+
)}
65+
<div className="space-y-2">
66+
<Label>Email address</Label>
5567
<Input
56-
label="Full Name"
57-
value={name}
58-
onChange={(e) => setName(e.target.value)}
59-
placeholder="Jane Doe"
60-
required
68+
type="email"
69+
value={email}
70+
onChange={(e) => setEmail(e.target.value)}
71+
placeholder="[email protected]"
72+
required
6173
/>
62-
)}
63-
<Input
64-
label="Email address"
65-
type="email"
66-
value={email}
67-
onChange={(e) => setEmail(e.target.value)}
68-
placeholder="[email protected]"
69-
required
70-
/>
71-
<Input
72-
label="Password"
73-
type="password"
74-
value={password}
75-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setPassword(e.target.value)}
76-
placeholder="••••••••"
77-
required
78-
/>
74+
</div>
75+
<div className="space-y-2">
76+
<Label>Password</Label>
77+
<Input
78+
type="password"
79+
value={password}
80+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setPassword(e.target.value)}
81+
placeholder="••••••••"
82+
required
83+
/>
84+
</div>
7985

8086
{error && (
8187
<div className="p-3 text-[13px] text-red-600 bg-red-50/50 border border-red-100 rounded-lg flex items-start gap-2">

packages/client/tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"moduleResolution": "bundler",
88
"allowSyntheticDefaultImports": true,
99
"strict": true,
10-
"noEmit": true
10+
"noEmit": false,
11+
"emitDeclarationOnly": true
1112
},
1213
"include": ["vite.config.ts"]
1314
}

packages/client/vite.config.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare const _default: import("vite").UserConfig;
2+
export default _default;

packages/client/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path'
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
7-
plugins: [react()],
7+
plugins: [react() as any],
88
resolve: {
99
alias: {
1010
'@': path.resolve(__dirname, './src'),

0 commit comments

Comments
 (0)