Skip to content

Commit fb40ac0

Browse files
committed
Remove tailwind colors from upload page
1 parent c1e33c0 commit fb40ac0

File tree

1 file changed

+51
-44
lines changed

1 file changed

+51
-44
lines changed

app/classrooms/[classroomId]/upload/uploadComponent.tsx

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ import {
1010
uploadFile,
1111
} from "@shared/lib/ragflow/dataset-client";
1212
import { Input } from "@shared/components/ui/input";
13+
import { Button } from "@shared/components/ui/button";
14+
import {
15+
Card,
16+
CardContent,
17+
CardHeader,
18+
CardTitle,
19+
} from "@shared/components/ui/card";
1320
import { Skeleton } from "@shared/components/ui/skeleton";
1421
import { ScrollArea } from "@shared/components/ui/scroll-area";
1522
import { toast } from "sonner";
@@ -105,10 +112,6 @@ export default function UploadComponent({
105112

106113
setLoading(false);
107114

108-
// if (!response || typeof response !== "object") {
109-
// setErrorMessage("Invalid response from server.");
110-
// return;
111-
// }
112115
if (
113116
response.isAdmin &&
114117
response.parseCallSuccess &&
@@ -128,43 +131,47 @@ export default function UploadComponent({
128131
}
129132

130133
return (
131-
<div className="flex min-h-screen flex-col items-center justify-center bg-gray-50 p-6 text-black">
132-
<div className="w-full max-w-md rounded-lg bg-white p-6 shadow-md">
133-
<h1 className="mb-4 text-xl font-bold">File Upload</h1>
134-
{datasetClient == undefined || uploadedFiles == null ? (
135-
<div className="flex items-center space-x-4">
136-
<Skeleton className="h-12 w-12 rounded-full" />
137-
<div className="space-y-2">
138-
<Skeleton className="h-4 w-[250px]" />
139-
<Skeleton className="h-4 w-[200px]" />
140-
</div>
141-
</div>
142-
) : (
143-
<>
144-
<form onSubmit={handleSubmit}>
145-
<div className="mb-4">
146-
<Input
147-
type="file"
148-
onChange={handleFileChange}
149-
ref={inputFile}
150-
className="w-full text-sm text-gray-500 file:mr-4 file:rounded-md file:border-0 file:bg-blue-50 file:px-4 file:text-sm file:font-semibold file:text-blue-700 hover:file:bg-blue-100"
151-
/>
134+
<div className="flex min-h-screen flex-col items-center justify-center p-6">
135+
<Card className="w-full max-w-md">
136+
<CardHeader>
137+
<CardTitle>File Upload</CardTitle>
138+
</CardHeader>
139+
<CardContent>
140+
{datasetClient == undefined || uploadedFiles == null ? (
141+
<div className="flex items-center space-x-4">
142+
<Skeleton className="h-12 w-12 rounded-full" />
143+
<div className="space-y-2">
144+
<Skeleton className="h-4 w-[250px]" />
145+
<Skeleton className="h-4 w-[200px]" />
152146
</div>
153-
154-
<button
155-
type="submit"
156-
disabled={!file || loading}
157-
className="w-full rounded-md bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-600 disabled:cursor-not-allowed disabled:bg-gray-300"
158-
>
159-
{loading ? "Uploading..." : "Upload"}
160-
</button>
161-
</form>
162-
163-
{/* Move to component with files passed in as props so that newly fetch data doesn't trigger a rerender (and thus another fetch) infinitely so*/}
164-
<FileList uploadedFiles={uploadedFiles} />
165-
</>
166-
)}
167-
</div>
147+
</div>
148+
) : (
149+
<>
150+
<form onSubmit={handleSubmit} className="space-y-4">
151+
<div>
152+
<Input
153+
type="file"
154+
onChange={handleFileChange}
155+
ref={inputFile}
156+
className="w-full"
157+
/>
158+
</div>
159+
160+
<Button
161+
type="submit"
162+
disabled={!file || loading}
163+
className="w-full"
164+
>
165+
{loading ? "Uploading..." : "Upload"}
166+
</Button>
167+
</form>
168+
169+
{/* Move to component with files passed in as props so that newly fetch data doesn't trigger a rerender (and thus another fetch) infinitely so*/}
170+
<FileList uploadedFiles={uploadedFiles} />
171+
</>
172+
)}
173+
</CardContent>
174+
</Card>
168175
</div>
169176
);
170177
}
@@ -173,21 +180,21 @@ function FileList({ uploadedFiles }: { uploadedFiles: UploadedFile[] }) {
173180
const pathname = usePathname();
174181
return (
175182
uploadedFiles.length > 0 && (
176-
<ScrollArea className="mt-5 max-h-[50vh] rounded-md border px-3">
183+
<ScrollArea className="mt-5 max-h-[50vh]">
177184
<div className="mt-6">
178185
<h2 className="text-lg font-semibold">Uploaded Files</h2>
179186
<ul className="my-2 space-y-2">
180187
{uploadedFiles.map((file) => (
181-
<li key={file.id} className="rounded-md bg-gray-100 p-3">
188+
<li key={file.id} className="rounded-md border p-3">
182189
<Link
183190
href={`${pathname}/preview?documentId=${file.id}&datasetId=${file.datasetId}`}
184191
rel="noopener noreferrer"
185192
target="_blank"
186-
className="font-medium"
193+
className="font-medium hover:underline"
187194
>
188195
{file.name}
189196
</Link>
190-
<p className="text-sm text-gray-500">
197+
<p className="text-sm text-muted-foreground">
191198
{(file.size / 1024).toFixed(2)} KB - {file.type} -{" "}
192199
<strong>{file.status}</strong>
193200
</p>

0 commit comments

Comments
 (0)