Skip to content

Commit 608637a

Browse files
authored
Merge pull request #20 from filecoin-project/UXIT-3449/implement-file-picker
[UXIT-3449] Implement Native File Picker
2 parents b31848d + 763e1c0 commit 608637a

File tree

16 files changed

+156
-562
lines changed

16 files changed

+156
-562
lines changed

package-lock.json

Lines changed: 55 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"pretty-bytes": "^7.1.0",
2222
"react": "^19.2.0",
2323
"react-dom": "^19.2.0",
24-
"react-dropzone": "^14.3.8",
2524
"tailwind-merge": "^3.3.1",
2625
"tailwindcss": "^4.1.14"
2726
},

src/components/file-picker/upload-instructions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function UploadInstructions({ maxSize, ...rest }: UploadInstructionsProps
2121

2222
<div className="space-y-1 text-center">
2323
<p>
24-
<span className="font-medium text-[#10B4FF]">Click to upload</span> or drag and drop
24+
<span className="font-medium text-brand-500">Click to upload</span> or drag and drop
2525
</p>
2626
<p className="text-sm">(Up to {prettyBytes(maxSize)})</p>
2727
</div>

src/components/layout/content.css

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
.upload-section {
2-
margin-top: 2rem;
3-
display: flex;
4-
flex-direction: column;
5-
gap: 1.5rem;
6-
}
7-
81
.upload-progress-section {
92
margin-top: 2rem;
103
}

src/components/layout/content.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@ import { useFilecoinUpload } from '../../hooks/use-filecoin-upload.ts'
33
import DragNDrop from '../upload/drag-n-drop.tsx'
44
import UploadProgress from '../upload/upload-progress.tsx'
55
import './content.css'
6-
import PageTitle from '../ui/page-title.tsx'
6+
import { PageTitle } from '../ui/page-title.tsx'
77

88
export default function Content() {
99
const [uploadedFile, setUploadedFile] = useState<{ file: File; cid: string } | null>(null)
1010
const [isExpanded, setIsExpanded] = useState(true)
1111
const { uploadState, uploadFile, resetUpload } = useFilecoinUpload()
1212

13-
const handleUpload = (filesToUpload: File[]) => {
14-
if (filesToUpload.length === 0) {
15-
alert('Please select files to upload')
16-
return
17-
}
18-
19-
// For demo purposes, upload the first file
20-
const file = filesToUpload[0]
13+
const handleUpload = (file: File) => {
2114
// Set uploadedFile immediately to switch to progress view
2215
setUploadedFile({ file, cid: '' })
2316

@@ -42,7 +35,7 @@ export default function Content() {
4235
}
4336

4437
return (
45-
<div className="content">
38+
<div className="space-y-10">
4639
<PageTitle />
4740

4841
{uploadedFile ? (
@@ -84,7 +77,8 @@ export default function Content() {
8477
)}
8578
</div>
8679
) : (
87-
<div className="upload-section">
80+
<div className="space-y-6">
81+
<h2 className="text-xl font-medium text-white">Upload a file</h2>
8882
<DragNDrop isUploading={uploadState.isUploading} onUpload={handleUpload} />
8983
</div>
9084
)}

src/components/ui/badge-number.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ function BadgeNumber({ number }: BadgeNumberProps) {
66
if (number <= 0) {
77
console.error('BadgeNumber: number must be positive, received:', number)
88
}
9+
910
return (
10-
<span className="text-brand-50 bg-brand-200 border-brand-100 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border">
11+
<span className="text-brand-500 bg-brand-950 border-brand-900 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border">
1112
{number}
1213
</span>
1314
)

src/components/ui/button.css

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/components/ui/button.tsx

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)