update ui

This commit is contained in:
subodh committed 2026-03-08 21:11:43 +05:30
1 parent 0e35933ee3
commit 29280d6490
5 files changed
+207 -454

No files matched your search

+3 -1
View File
@@ -9,7 +9,7 @@ A minimal self-hosted file sharing tool. Upload a file, get a public link. Files
## How it works
1. Enter the upload password to authenticate
2. Drop a file or click to browse (50 MB max)
2. Drop a file or click to browse (250 MB max)
3. Copy the public link and share it
The frontend proxies `/api/*` to the backend at `localhost:8000`, so both run separately during development.
@@ -23,6 +23,8 @@ The frontend proxies `/api/*` to the backend at `localhost:8000`, so both run se
- [uv](https://docs.astral.sh/uv/) (Python package manager)
- A [Cloudflare R2](https://developers.cloudflare.com/r2/) bucket with public access enabled
> **Upload limit:** 250 MB per file. Files are streamed directly through the backend to R2 without being loaded into memory.
---
## Environment setup
+10 -12
View File
@@ -1,13 +1,13 @@
import mimetypes
import secrets
from fastapi import FastAPI, File, Form, HTTPException, UploadFile
from fastapi import FastAPI, File, Form, HTTPException, Request, UploadFile
from fastapi.middleware.cors import CORSMiddleware
from app.config.settings import settings
from app.services.r2 import upload_file
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50 MB
MAX_FILE_SIZE = 250 * 1024 * 1024 # 250 MB
app = FastAPI(title="File Host API")
@@ -44,23 +44,21 @@ async def auth(password: str = Form(...)):
@app.post("/upload")
async def upload(
request: Request,
file: UploadFile = File(...),
password: str = Form(...),
):
"""Validate password, enforce size limit, and upload the file to R2."""
"""Validate password, enforce size limit, and stream the file to R2."""
if password != settings.UPLOAD_PASSWORD:
raise HTTPException(status_code=401, detail="Invalid password.")
content = await file.read()
if not content:
raise HTTPException(status_code=400, detail="Uploaded file is empty.")
if len(content) > MAX_FILE_SIZE:
mb = len(content) / 1024 / 1024
# Reject oversized requests early, before reading the body.
# Content-Length covers the whole multipart body; form overhead is negligible.
content_length = request.headers.get("content-length")
if content_length and int(content_length) > MAX_FILE_SIZE:
raise HTTPException(
status_code=413,
detail=f"File is too large ({mb:.1f} MB). Maximum allowed size is 50 MB.",
detail="File too large. Maximum allowed size is 250 MB.",
)
content_type = (
@@ -70,7 +68,7 @@ async def upload(
try:
url = await upload_file(
file_bytes=content,
file_obj=file.file,
object_name=object_name,
content_type=content_type,
)
+11 -10
View File
@@ -1,5 +1,6 @@
import asyncio
from functools import lru_cache
from typing import BinaryIO
import boto3
from botocore.client import Config
@@ -21,25 +22,25 @@ def _get_r2_client():
)
def _put_object(object_name: str, file_bytes: bytes, content_type: str) -> str:
"""Blocking S3 put"""
def _upload_fileobj(file_obj: BinaryIO, object_name: str, content_type: str) -> str:
"""Stream file to R2. boto3 automatically uses multipart for large files."""
key = f"files/{object_name}"
_get_r2_client().put_object(
Bucket=settings.R2_BUCKET,
Key=key,
Body=file_bytes,
ContentType=content_type,
_get_r2_client().upload_fileobj(
file_obj,
settings.R2_BUCKET,
key,
ExtraArgs={"ContentType": content_type},
)
return f"{settings.PUBLIC_URL}/files/{object_name}"
async def upload_file(file_bytes: bytes, object_name: str, content_type: str) -> str:
"""Upload a file to R2 storage"""
async def upload_file(file_obj: BinaryIO, object_name: str, content_type: str) -> str:
"""Upload a file to R2 storage."""
try:
url = await asyncio.to_thread(
_put_object, object_name, file_bytes, content_type
_upload_fileobj, file_obj, object_name, content_type
)
except (BotoCoreError, ClientError) as exc:
raise RuntimeError(f"R2 upload failed: {exc}") from exc
+7 -61
View File
@@ -3,8 +3,8 @@
@tailwind utilities;
:root {
--background: #06070f;
--foreground: #f8fafc;
--background: #313338;
--foreground: #f2f3f5;
}
* {
@@ -19,8 +19,8 @@ body {
}
::selection {
background: rgba(139, 92, 246, 0.35);
color: #f8fafc;
background: rgba(88, 101, 242, 0.3);
color: #f2f3f5;
}
::-webkit-scrollbar {
@@ -28,68 +28,14 @@ body {
}
::-webkit-scrollbar-track {
background: #0d0f1a;
background: #2b2d31;
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.14);
}
@keyframes shimmer {
0% {
background-position: -200% center;
}
100% {
background-position: 200% center;
}
}
@keyframes pulse-soft {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}
@keyframes float-orb {
0%,
100% {
transform: translateY(0px) scale(1);
}
50% {
transform: translateY(-20px) scale(1.04);
}
}
.progress-bar {
background: linear-gradient(
90deg,
#7c3aed,
#3b82f6,
#06b6d4,
#3b82f6,
#7c3aed
);
background-size: 300% auto;
animation: shimmer 2.5s linear infinite;
}
.orb-1 {
animation: float-orb 12s ease-in-out infinite;
}
.orb-2 {
animation: float-orb 16s ease-in-out infinite reverse;
}
.orb-3 {
animation: float-orb 10s ease-in-out infinite 4s;
background: rgba(255, 255, 255, 0.18);
}
+176 -370
View File
@@ -3,13 +3,11 @@
import {
AlertCircle,
CheckCircle2,
CloudUpload,
Copy,
ExternalLink,
Lock,
LockOpen,
RefreshCw,
UploadCloud,
RotateCcw,
Upload,
} from "lucide-react";
import { ChangeEvent, DragEvent, useCallback, useRef, useState } from "react";
@@ -134,7 +132,7 @@ export default function Home() {
[uploadFile],
);
// ── Copy URL ──────────────────────────────────────────────────────────────
// ── Copy ──────────────────────────────────────────────────────────────────
const handleCopy = async () => {
await navigator.clipboard.writeText(resultUrl);
@@ -151,119 +149,38 @@ export default function Home() {
// ── Render ────────────────────────────────────────────────────────────────
return (
<main className="min-h-screen flex items-center justify-center p-6 relative overflow-hidden bg-[#06070f]">
{/* ── Ambient background orbs ──────────────────────────────────── */}
<div className="pointer-events-none fixed inset-0 overflow-hidden">
<div
className="orb-1 absolute -top-56 -left-56 w-[600px] h-[600px] rounded-full"
style={{
background:
"radial-gradient(circle, rgba(109,40,217,0.18) 0%, transparent 70%)",
filter: "blur(40px)",
}}
/>
<div
className="orb-2 absolute -bottom-56 -right-56 w-[600px] h-[600px] rounded-full"
style={{
background:
"radial-gradient(circle, rgba(37,99,235,0.18) 0%, transparent 70%)",
filter: "blur(40px)",
}}
/>
<div
className="orb-3 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[400px] h-[400px] rounded-full"
style={{
background:
"radial-gradient(circle, rgba(79,70,229,0.1) 0%, transparent 70%)",
filter: "blur(60px)",
}}
/>
</div>
<main
className="min-h-screen bg-[#313338] flex flex-col items-center justify-center px-4 py-12"
style={{
paddingTop: "max(3rem, env(safe-area-inset-top))",
paddingBottom: "max(3rem, env(safe-area-inset-bottom))",
}}
>
<div className="w-full max-w-sm">
{/* ── Header ─────────────────────────────────────────────────────── */}
<div className="flex flex-col items-center text-center mb-8 gap-3">
<div className="w-12 h-12 rounded-[14px] bg-[#2b2d31] border border-white/[0.06] flex items-center justify-center">
<Upload className="w-5 h-5 text-[#f2f3f5]" strokeWidth={1.75} />
</div>
<div>
<h1 className="text-[22px] font-semibold text-[#f2f3f5] tracking-tight leading-snug">
File Host
</h1>
<p className="text-[13px] text-[#b5bac1] mt-0.5">
250 MB max · expires in 24 h
</p>
</div>
</div>
{/* ── Subtle dot grid ──────────────────────────────────────────── */}
<div
className="pointer-events-none fixed inset-0"
style={{
backgroundImage:
"radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px)",
backgroundSize: "28px 28px",
maskImage:
"radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%)",
WebkitMaskImage:
"radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%)",
}}
/>
{/* ── Card ─────────────────────────────────────────────────────── */}
<div className="w-full max-w-md relative z-10">
<div
className="rounded-2xl overflow-hidden"
style={{
background: "rgba(255,255,255,0.032)",
backdropFilter: "blur(28px)",
WebkitBackdropFilter: "blur(28px)",
border: "1px solid rgba(255,255,255,0.07)",
boxShadow:
"0 0 0 1px rgba(255,255,255,0.03) inset, 0 32px 64px -16px rgba(0,0,0,0.7), 0 8px 32px rgba(109,40,217,0.08)",
}}
>
{/* Gradient top-bar accent */}
<div
className="h-[2px] w-full"
style={{
background: "linear-gradient(90deg, #7c3aed, #3b82f6, #06b6d4)",
}}
/>
<div className="p-8 flex flex-col gap-6">
{/* ── Header ─────────────────────────────────────────────── */}
<div className="flex flex-col items-center gap-3 pt-1">
<div
className="w-16 h-16 rounded-2xl flex items-center justify-center"
style={{
background:
"linear-gradient(135deg, rgba(124,58,237,0.22), rgba(59,130,246,0.22))",
border: "1px solid rgba(124,58,237,0.28)",
boxShadow: "0 8px 24px rgba(124,58,237,0.18)",
}}
>
<CloudUpload
className="w-8 h-8 text-violet-300"
strokeWidth={1.5}
/>
</div>
<div className="text-center">
<h1
className="text-[1.6rem] font-bold tracking-tight leading-tight"
style={{
background:
"linear-gradient(135deg, #c4b5fd 0%, #93c5fd 100%)",
WebkitBackgroundClip: "text",
WebkitTextFillColor: "transparent",
backgroundClip: "text",
}}
>
File Host
</h1>
<p className="text-xs text-slate-600 mt-1 tracking-wide">
50 MB max &nbsp;·&nbsp; expires in 24 h
</p>
</div>
</div>
{/* Divider */}
<div
className="h-px"
style={{
background:
"linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent)",
}}
/>
{/* ── Auth ───────────────────────────────────────────────── */}
{/* ── Card ───────────────────────────────────────────────────────── */}
<div className="bg-[#2b2d31] rounded-2xl border border-white/[0.06] overflow-hidden">
{/* Auth row */}
<div className="px-5 pt-5 pb-5 border-b border-white/[0.06]">
{isLocked ? (
<div className="flex gap-2">
<div className="flex flex-col gap-3">
<label className="text-[13px] font-medium text-[#f2f3f5]">
Password
</label>
<input
type="password"
value={password}
@@ -272,236 +189,73 @@ export default function Home() {
setPasswordError(false);
}}
onKeyDown={(e) => e.key === "Enter" && handleUnlock()}
placeholder="Enter password…"
className="flex-1 rounded-xl px-4 py-2.5 text-sm text-white placeholder-slate-600 outline-none transition-all duration-200"
style={{
background: "rgba(255,255,255,0.04)",
border: passwordError
? "1px solid rgba(239,68,68,0.6)"
: "1px solid rgba(255,255,255,0.08)",
boxShadow: passwordError
? "0 0 0 3px rgba(239,68,68,0.1)"
: undefined,
}}
onFocus={(e) => {
if (!passwordError)
(e.target as HTMLInputElement).style.border =
"1px solid rgba(124,58,237,0.5)";
(e.target as HTMLInputElement).style.boxShadow =
"0 0 0 3px rgba(124,58,237,0.12)";
}}
onBlur={(e) => {
if (!passwordError) {
(e.target as HTMLInputElement).style.border =
"1px solid rgba(255,255,255,0.08)";
(e.target as HTMLInputElement).style.boxShadow = "none";
}
}}
placeholder="Enter password"
className={[
"w-full h-11 px-3.5 rounded-xl text-[15px] text-[#f2f3f5]",
"bg-[#1e1f22] placeholder:text-[#4e5058] outline-none",
"border transition-all duration-150",
passwordError
? "border-[#ed4245] ring-2 ring-[#ed4245]/15"
: "border-transparent focus:border-[#5865f2]/50 focus:ring-2 focus:ring-[#5865f2]/15",
].join(" ")}
/>
{passwordError && (
<p className="text-[12px] text-[#ed4245] -mt-1">
Incorrect password.
</p>
)}
<button
onClick={handleUnlock}
className="flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-semibold text-white shrink-0 transition-all duration-150 hover:brightness-110 active:scale-[0.96]"
style={{
background: "linear-gradient(135deg, #7c3aed, #2563eb)",
boxShadow: "0 4px 18px rgba(124,58,237,0.35)",
}}
className="w-full h-11 rounded-xl bg-[#5865f2] text-white text-[15px] font-medium tracking-tight transition-opacity active:opacity-75 select-none"
>
<Lock className="w-3.5 h-3.5" />
Unlock
</button>
</div>
) : (
<div
className="flex items-center gap-2.5 px-4 py-2.5 rounded-xl text-sm"
style={{
background: "rgba(52,211,153,0.08)",
border: "1px solid rgba(52,211,153,0.18)",
}}
>
<LockOpen className="w-4 h-4 text-emerald-400" />
<span className="font-medium text-emerald-400">
Authenticated
<div className="flex items-center gap-2.5 py-0.5">
<div className="w-2 h-2 rounded-full bg-[#23a55a] shrink-0" />
<span className="text-[14px] font-medium text-[#f2f3f5]">
Unlocked
</span>
</div>
)}
</div>
{/* ── Upload zone ────────────────────────────────────────── */}
<div
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
onClick={() => isInteractable && fileInputRef.current?.click()}
className="relative rounded-xl border-2 border-dashed flex flex-col items-center justify-center gap-4 p-10 text-center transition-all duration-200"
style={{
minHeight: "190px",
borderColor: isUploading
? "rgba(124,58,237,0.45)"
: isLocked
? "rgba(255,255,255,0.05)"
: isDragging
? "rgba(124,58,237,0.65)"
: "rgba(255,255,255,0.09)",
background: isDragging
? "rgba(124,58,237,0.07)"
: isUploading
? "rgba(124,58,237,0.04)"
: "rgba(255,255,255,0.015)",
cursor: isUploading
? "default"
: isLocked
? "not-allowed"
: isDragging
? "copy"
: "pointer",
opacity: isLocked ? 0.45 : 1,
}}
>
<input
ref={fileInputRef}
type="file"
className="hidden"
onChange={handleFileChange}
/>
{isUploading ? (
/* Uploading state */
<>
<div
className="w-14 h-14 rounded-2xl flex items-center justify-center"
style={{
background:
"linear-gradient(135deg, rgba(124,58,237,0.2), rgba(59,130,246,0.2))",
border: "1px solid rgba(124,58,237,0.3)",
}}
>
<UploadCloud
className="w-7 h-7 text-violet-300"
style={{
animation: "pulse-soft 1.8s ease-in-out infinite",
}}
strokeWidth={1.5}
{/* Upload / progress / result */}
<div className="px-5 py-5 flex flex-col gap-4">
{isUploading ? (
/* ── Uploading ─────────────────────────────────────────────── */
<div className="flex flex-col gap-3 py-1">
<div className="flex items-center gap-3">
<div className="w-9 h-9 rounded-[10px] bg-[#1e1f22] flex items-center justify-center shrink-0">
<Upload
className="w-4 h-4 text-[#b5bac1]"
strokeWidth={1.75}
/>
</div>
<div className="w-full flex flex-col gap-2.5">
<p className="text-sm text-slate-300 font-medium truncate max-w-[220px] mx-auto">
{pendingFileName}
</p>
<div
className="relative w-full rounded-full overflow-hidden"
style={{
height: "5px",
background: "rgba(255,255,255,0.06)",
}}
>
<div
className="absolute inset-y-0 left-0 rounded-full progress-bar transition-[width] duration-300 ease-out"
style={{ width: `${progress}%` }}
/>
</div>
<p className="text-xs text-slate-500 tabular-nums">
{progress}%
</p>
</div>
</>
) : isDragging ? (
/* Drag-over state */
<>
<div
className="w-14 h-14 rounded-2xl flex items-center justify-center"
style={{
background:
"linear-gradient(135deg, rgba(124,58,237,0.3), rgba(59,130,246,0.3))",
border: "1px solid rgba(124,58,237,0.5)",
boxShadow: "0 0 24px rgba(124,58,237,0.2)",
}}
>
<UploadCloud
className="w-7 h-7 text-violet-200"
strokeWidth={1.5}
/>
</div>
<p className="text-sm font-semibold text-violet-300">
Drop to upload
<p className="text-[14px] text-[#f2f3f5] font-medium truncate flex-1 min-w-0">
{pendingFileName}
</p>
</>
) : (
/* Idle state */
<>
<span className="text-[13px] text-[#b5bac1] tabular-nums shrink-0 ml-2">
{progress}%
</span>
</div>
<div className="h-[3px] w-full rounded-full bg-[#1e1f22] overflow-hidden">
<div
className="w-14 h-14 rounded-2xl flex items-center justify-center transition-all duration-200"
style={
isLocked
? {
background: "rgba(255,255,255,0.04)",
border: "1px solid rgba(255,255,255,0.06)",
}
: {
background:
"linear-gradient(135deg, rgba(124,58,237,0.14), rgba(59,130,246,0.14))",
border: "1px solid rgba(124,58,237,0.22)",
}
}
>
<UploadCloud
className={
isLocked
? "w-7 h-7 text-slate-700"
: "w-7 h-7 text-slate-400"
}
strokeWidth={1.5}
/>
</div>
<div className="flex flex-col gap-1.5">
<p
className={`text-sm font-medium ${isLocked ? "text-slate-700" : "text-slate-300"}`}
>
{isLocked
? "Enter password to unlock"
: "Drop a file here or click to browse"}
</p>
{!isLocked && (
<p className="text-xs text-slate-600">
Any file type · up to 50 MB
</p>
)}
</div>
</>
)}
</div>
{/* ── Error ──────────────────────────────────────────────── */}
{errorMessage && (
<div
className="rounded-xl flex items-start gap-3 px-4 py-3.5"
style={{
background: "rgba(239,68,68,0.07)",
border: "1px solid rgba(239,68,68,0.2)",
}}
>
<AlertCircle className="w-4 h-4 text-red-400 mt-0.5 shrink-0" />
<p className="text-sm text-red-400 break-all leading-relaxed">
{errorMessage}
</p>
className="h-full rounded-full bg-[#5865f2] transition-all duration-300 ease-out"
style={{ width: `${progress}%` }}
/>
</div>
</div>
)}
{/* ── Success ────────────────────────────────────────────── */}
{status === "done" && resultUrl && (
<div
className="rounded-xl flex flex-col gap-4 p-4"
style={{
background: "rgba(52,211,153,0.06)",
border: "1px solid rgba(52,211,153,0.15)",
}}
>
<div className="flex items-center gap-2.5">
<div
className="w-5 h-5 rounded-full flex items-center justify-center shrink-0"
style={{ background: "rgba(52,211,153,0.15)" }}
>
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400" />
</div>
<span className="text-sm font-semibold text-emerald-400">
) : status === "done" && resultUrl ? (
/* ── Done ─────────────────────────────────────────────────── */
<div className="flex flex-col gap-3">
<div className="flex items-center gap-2">
<CheckCircle2
className="w-4 h-4 text-[#23a55a] shrink-0"
strokeWidth={2}
/>
<span className="text-[14px] font-medium text-[#f2f3f5]">
Upload complete
</span>
</div>
@@ -510,56 +264,32 @@ export default function Home() {
readOnly
value={resultUrl}
onClick={(e) => (e.target as HTMLInputElement).select()}
className="w-full rounded-xl px-3.5 py-2.5 text-sm text-slate-300 outline-none cursor-text font-mono transition-all duration-200"
style={{
background: "rgba(255,255,255,0.04)",
border: "1px solid rgba(255,255,255,0.08)",
}}
onFocus={(e) => {
(e.target as HTMLInputElement).style.border =
"1px solid rgba(255,255,255,0.14)";
}}
onBlur={(e) => {
(e.target as HTMLInputElement).style.border =
"1px solid rgba(255,255,255,0.08)";
}}
className="w-full h-10 px-3 rounded-xl bg-[#1e1f22] border border-transparent focus:border-white/[0.12] text-[12px] text-[#f2f3f5] font-mono outline-none cursor-text transition-colors"
/>
<div className="flex gap-2">
<button
onClick={handleCopy}
className="flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl text-sm font-medium transition-all duration-200 active:scale-[0.97]"
style={
className={[
"flex-1 h-11 rounded-xl text-[14px] font-medium",
"flex items-center justify-center gap-1.5",
"transition-all active:opacity-70 select-none",
copied
? {
background: "rgba(52,211,153,0.12)",
border: "1px solid rgba(52,211,153,0.25)",
color: "#6ee7b7",
}
: {
background: "rgba(255,255,255,0.05)",
border: "1px solid rgba(255,255,255,0.09)",
color: "#cbd5e1",
}
}
? "bg-[#23a55a]/10 text-[#23a55a]"
: "bg-[#1e1f22] text-[#f2f3f5]",
].join(" ")}
>
<Copy className="w-3.5 h-3.5" />
{copied ? "Copied!" : "Copy URL"}
<Copy className="w-3.5 h-3.5" strokeWidth={2} />
{copied ? "Copied" : "Copy"}
</button>
<a
href={resultUrl}
target="_blank"
rel="noopener noreferrer"
className="flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl text-sm font-medium transition-all duration-200 hover:brightness-110 active:scale-[0.97]"
style={{
background:
"linear-gradient(135deg, rgba(124,58,237,0.18), rgba(59,130,246,0.18))",
border: "1px solid rgba(124,58,237,0.25)",
color: "#c4b5fd",
}}
className="flex-1 h-11 rounded-xl bg-[#5865f2] text-white text-[14px] font-medium flex items-center justify-center gap-1.5 transition-opacity active:opacity-80 select-none"
>
<ExternalLink className="w-3.5 h-3.5" />
<ExternalLink className="w-3.5 h-3.5" strokeWidth={2} />
Open
</a>
</div>
@@ -570,18 +300,94 @@ export default function Home() {
setErrorMessage("");
setStatus("unlocked");
}}
className="flex items-center justify-center gap-1.5 text-xs text-slate-600 hover:text-slate-400 transition-colors duration-150"
className="flex items-center justify-center gap-1.5 text-[13px] text-[#80848e] transition-colors active:text-[#f2f3f5] select-none"
>
<RefreshCw className="w-3 h-3" />
Upload another file
<RotateCcw className="w-3 h-3" strokeWidth={2} />
Upload another
</button>
</div>
) : (
/* ── Drop zone ─────────────────────────────────────────────── */
<div
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
onClick={() => isInteractable && fileInputRef.current?.click()}
className={[
"rounded-xl border-2 border-dashed",
"flex flex-col items-center justify-center gap-2.5",
"py-10 px-4 text-center",
"transition-all duration-150 select-none",
isLocked
? "border-white/[0.06] cursor-not-allowed opacity-40"
: isDragging
? "border-[#5865f2]/40 bg-[#5865f2]/[0.04] cursor-copy"
: "border-white/[0.08] cursor-pointer hover:border-white/[0.14] hover:bg-white/[0.02] active:bg-white/[0.03]",
].join(" ")}
>
<input
ref={fileInputRef}
type="file"
className="hidden"
onChange={handleFileChange}
/>
<div
className={[
"w-10 h-10 rounded-[12px] flex items-center justify-center transition-colors",
isDragging ? "bg-[#5865f2]/10" : "bg-[#1e1f22]",
].join(" ")}
>
<Upload
className={[
"w-4.5 h-4.5 transition-colors",
isDragging ? "text-[#5865f2]" : "text-[#80848e]",
].join(" ")}
strokeWidth={1.75}
/>
</div>
<div>
<p
className={[
"text-[14px] font-medium transition-colors",
isDragging
? "text-[#5865f2]"
: isLocked
? "text-[#80848e]"
: "text-[#f2f3f5]",
].join(" ")}
>
{isLocked
? "Enter password to unlock"
: isDragging
? "Drop to upload"
: "Drop file or tap to browse"}
</p>
{!isLocked && (
<p className="text-[12px] text-[#80848e] mt-1">
Any file type · up to 250 MB
</p>
)}
</div>
</div>
)}
{/* ── Error ────────────────────────────────────────────────── */}
{errorMessage && (
<div className="flex items-start gap-2.5 px-3.5 py-3 rounded-xl bg-[#ed4245]/[0.08] border border-[#ed4245]/[0.15]">
<AlertCircle
className="w-4 h-4 text-[#ed4245] shrink-0 mt-px"
strokeWidth={2}
/>
<p className="text-[13px] text-[#ed4245] break-all leading-relaxed">
{errorMessage}
</p>
</div>
)}
</div>
</div>
{/* Footer */}
<p className="text-center text-[11px] text-slate-700 mt-5 tracking-wide">
{/* ── Footer ─────────────────────────────────────────────────────── */}
<p className="text-center text-[12px] text-[#80848e] mt-6">
Files are automatically deleted after 24 hours
</p>
</div>