update ui

This commit is contained in:
subodh committed 2026-03-13 11:47:40 +05:30
1 parent 7674f12c5e
commit d3a5df6387
9 files changed
+1437 -1278

No files matched your search

+806 -914
View File
File diff suppressed because it is too large. Load diff
+6 -4
View File
@@ -9,7 +9,12 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"lucide-react": "^0.474.0", "@emotion/cache": "^11.14.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^7.3.9",
"@mui/material": "^7.3.9",
"@mui/material-nextjs": "^7.3.9",
"next": "^16.1.6", "next": "^16.1.6",
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4" "react-dom": "^19.2.4"
@@ -18,9 +23,6 @@
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
"autoprefixer": "^10.0.1",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5" "typescript": "^5"
} }
} }
-9
View File
@@ -1,9 +0,0 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
export default config;
+13 -23
View File
@@ -1,19 +1,21 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root { :root {
--background: #282828; color-scheme: dark;
--foreground: #ebdbb2;
} }
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
html,
body { body {
background: var(--background); height: 100%;
color: var(--foreground); margin: 0;
padding: 0;
}
body {
background: #282828;
color: #ebdbb2;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
@@ -23,19 +25,7 @@ body {
color: #ebdbb2; color: #ebdbb2;
} }
::-webkit-scrollbar { a {
width: 6px; color: inherit;
} text-decoration: none;
::-webkit-scrollbar-track {
background: #1d2021;
}
::-webkit-scrollbar-thumb {
background: #504945;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #665c54;
} }
+11 -3
View File
@@ -1,8 +1,14 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { Geist } from "next/font/google"; import { Roboto } from "next/font/google";
import "./globals.css"; import "./globals.css";
const geist = Geist({ subsets: ["latin"] }); import Providers from "./providers";
const roboto = Roboto({
subsets: ["latin"],
weight: ["300", "400", "500", "700"],
variable: "--font-roboto",
});
export const metadata: Metadata = { export const metadata: Metadata = {
title: "File Host", title: "File Host",
@@ -16,7 +22,9 @@ export default function RootLayout({
}) { }) {
return ( return (
<html lang="en"> <html lang="en">
<body className={geist.className}>{children}</body> <body className={roboto.variable}>
<Providers>{children}</Providers>
</body>
</html> </html>
); );
} }
+372 -304
View File
@@ -1,15 +1,26 @@
"use client"; "use client";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import CloudUploadIcon from "@mui/icons-material/CloudUpload";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
import LockIcon from "@mui/icons-material/Lock";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
import ReplayIcon from "@mui/icons-material/Replay";
import { import {
AlertCircle, Alert,
CheckCircle2, Box,
Copy, Button,
ExternalLink, Card,
Lock, Chip,
RotateCcw, Divider,
Upload, LinearProgress,
} from "lucide-react"; Stack,
import { ChangeEvent, DragEvent, useCallback, useRef, useState } from "react"; TextField,
Typography,
} from "@mui/material";
import type { ChangeEvent, DragEvent } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
type Status = "idle" | "authenticated" | "uploading" | "done"; type Status = "idle" | "authenticated" | "uploading" | "done";
@@ -23,12 +34,16 @@ export default function Home() {
const [errorMessage, setErrorMessage] = useState(""); const [errorMessage, setErrorMessage] = useState("");
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
const [pendingFileName, setPendingFileName] = useState(""); const [pendingFileName, setPendingFileName] = useState("");
const [uploadedFile, setUploadedFile] = useState<{
name: string;
type: string;
size: number;
previewUrl?: string;
} | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null); const fileInputRef = useRef<HTMLInputElement>(null);
const preUploadStatus = useRef<"idle" | "authenticated">("idle"); const preUploadStatus = useRef<"idle" | "authenticated">("idle");
// ── Auth ──────────────────────────────────────────────────────────────────
const handleUnlock = async () => { const handleUnlock = async () => {
if (!password.trim()) return; if (!password.trim()) return;
const body = new URLSearchParams({ password }); const body = new URLSearchParams({ password });
@@ -41,8 +56,6 @@ export default function Home() {
} }
}; };
// ── Upload ────────────────────────────────────────────────────────────────
const uploadFile = useCallback( const uploadFile = useCallback(
(file: File) => { (file: File) => {
preUploadStatus.current = preUploadStatus.current =
@@ -53,6 +66,16 @@ export default function Home() {
setErrorMessage(""); setErrorMessage("");
setPendingFileName(file.name); setPendingFileName(file.name);
const isPreviewable =
file.type.startsWith("image/") || file.type.startsWith("video/");
const previewUrl = isPreviewable ? URL.createObjectURL(file) : undefined;
setUploadedFile({
name: file.name,
type: file.type || "application/octet-stream",
size: file.size,
previewUrl,
});
const formData = new FormData(); const formData = new FormData();
formData.append("file", file); formData.append("file", file);
if (status === "authenticated") { if (status === "authenticated") {
@@ -63,9 +86,6 @@ export default function Home() {
xhr.upload.onprogress = (e) => { xhr.upload.onprogress = (e) => {
if (e.lengthComputable) { if (e.lengthComputable) {
// Cap at 99 — the final 100 is set only once the server responds,
// because the file is still being streamed to R2 after the browser
// finishes sending bytes.
setProgress(Math.min(99, Math.round((e.loaded / e.total) * 100))); setProgress(Math.min(99, Math.round((e.loaded / e.total) * 100)));
} }
}; };
@@ -103,9 +123,6 @@ export default function Home() {
setStatus(preUploadStatus.current); setStatus(preUploadStatus.current);
}; };
// Explicitly set responseType to "text" so Firefox does not attempt to
// parse the JSON response body as XML (which would log a benign but
// confusing "XML Parsing Error" in the console).
xhr.responseType = "text"; xhr.responseType = "text";
xhr.open("POST", "/api/upload"); xhr.open("POST", "/api/upload");
xhr.send(formData); xhr.send(formData);
@@ -113,8 +130,6 @@ export default function Home() {
[status, password], [status, password],
); );
// ── Drag and drop ─────────────────────────────────────────────────────────
const handleDragOver = useCallback( const handleDragOver = useCallback(
(e: DragEvent<HTMLDivElement>) => { (e: DragEvent<HTMLDivElement>) => {
e.preventDefault(); e.preventDefault();
@@ -149,28 +164,21 @@ export default function Home() {
[uploadFile], [uploadFile],
); );
// ── Copy ──────────────────────────────────────────────────────────────────
const handleCopy = async () => { const handleCopy = async () => {
await navigator.clipboard.writeText(resultUrl); await navigator.clipboard.writeText(resultUrl);
setCopied(true); setCopied(true);
setTimeout(() => setCopied(false), 2000); setTimeout(() => setCopied(false), 2000);
}; };
// ── Helpers ───────────────────────────────────────────────────────────────
const isAuthenticated = status === "authenticated"; const isAuthenticated = status === "authenticated";
const isUploading = status === "uploading"; const isUploading = status === "uploading";
const isInteractable = status !== "uploading"; const isInteractable = status !== "uploading";
// Show the auth badge when authenticated, or when uploading/done from an
// authenticated session (preUploadStatus tells us what we came from).
const showAuthBadge = const showAuthBadge =
status === "authenticated" || status === "authenticated" ||
((status === "uploading" || status === "done") && ((status === "uploading" || status === "done") &&
preUploadStatus.current === "authenticated"); preUploadStatus.current === "authenticated");
// Show the auth row at all when there is something to render inside it.
const showAuthRow = status === "idle" || showAuthBadge; const showAuthRow = status === "idle" || showAuthBadge;
const limitLabel = const limitLabel =
@@ -178,337 +186,397 @@ export default function Home() {
? "250 MB" ? "250 MB"
: "50 MB"; : "50 MB";
// ── Render ──────────────────────────────────────────────────────────────── const formatBytes = (bytes: number) => {
if (!Number.isFinite(bytes)) return "—";
if (bytes === 0) return "0 B";
const k = 1024;
const sizes = ["B", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
const value = bytes / Math.pow(k, i);
return `${value.toFixed(value >= 10 ? 0 : 1)} ${sizes[i]}`;
};
useEffect(() => {
return () => {
if (uploadedFile?.previewUrl) {
URL.revokeObjectURL(uploadedFile.previewUrl);
}
};
}, [uploadedFile]);
return ( return (
<main <Box
className="min-h-screen flex flex-col items-center justify-center px-4 py-12" component="main"
style={{ sx={{
background: "#282828", minHeight: "100vh",
paddingTop: "max(3rem, env(safe-area-inset-top))", display: "flex",
paddingBottom: "max(3rem, env(safe-area-inset-bottom))", alignItems: "center",
justifyContent: "center",
px: { xs: 2, md: 4 },
py: { xs: 3, md: 6 },
backgroundColor: "background.default",
fontFamily:
"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
}} }}
> >
<div className="w-full max-w-sm"> <Box sx={{ width: "100%", maxWidth: 980 }}>
{/* ── Header ─────────────────────────────────────────────────────── */} <Stack spacing={2.5}>
<div className="flex flex-col items-center text-center mb-8 gap-3"> <Stack
<div direction={{ xs: "column", sm: "row" }}
className="w-12 h-12 rounded-[14px] flex items-center justify-center" alignItems={{ xs: "flex-start", sm: "center" }}
style={{ justifyContent="space-between"
background: "#3c3836", spacing={2}
border: "1px solid #504945", sx={{
px: { xs: 1.5, sm: 2 },
py: { xs: 1, sm: 1.5 },
border: "1px solid",
borderColor: "divider",
borderRadius: 0,
backgroundColor: "background.paper",
}} }}
> >
<Upload <Stack direction="row" spacing={1.5} alignItems="center">
className="w-5 h-5" <Box
style={{ color: "#d79921" }} sx={{
strokeWidth={1.75} width: 10,
height: 10,
borderRadius: "50%",
backgroundColor: "success.main",
boxShadow: "0 0 10px rgba(34, 197, 94, 0.6)",
}}
/> />
</div> <Typography variant="body2" sx={{ letterSpacing: "0.08em" }}>
<div>
<h1
className="text-[22px] font-semibold tracking-tight leading-snug"
style={{ color: "#ebdbb2" }}
>
filehost filehost
</h1> </Typography>
<p className="text-[13px] mt-0.5" style={{ color: "#a89984" }}> </Stack>
<Typography variant="caption" color="text.secondary">
{limitLabel} max · expires in 24 h {limitLabel} max · expires in 24 h
</p> </Typography>
</div> </Stack>
</div>
{/* ── Card ───────────────────────────────────────────────────────── */} <Box
<div sx={{
className="rounded-2xl overflow-hidden" display: "grid",
style={{ background: "#32302f", border: "1px solid #504945" }} gridTemplateColumns: { xs: "1fr", md: "1.3fr 0.9fr" },
> gap: 2,
{/* Auth row */}
{showAuthRow && (
<div
className="px-5 pt-5 pb-5"
style={{ borderBottom: "1px solid #504945" }}
>
{showAuthBadge ? (
<div className="flex items-center gap-2.5 py-0.5">
<div
className="w-2 h-2 rounded-full shrink-0"
style={{ background: "#b8bb26" }}
/>
<span
className="text-[14px] font-medium"
style={{ color: "#b8bb26" }}
>
Authenticated · 250 MB limit
</span>
</div>
) : (
/* status === "idle" — show the optional unlock form */
<div className="flex flex-col gap-3">
<label
className="text-[13px] font-medium"
style={{ color: "#a89984" }}
>
Password{" "}
<span style={{ color: "#665c54" }} className="font-normal">
— optional, unlocks 250 MB
</span>
</label>
<input
type="password"
value={password}
onChange={(e) => {
setPassword(e.target.value);
setPasswordError(false);
}} }}
onKeyDown={(e) => e.key === "Enter" && handleUnlock()}
placeholder="Enter password"
className={[
"w-full h-11 px-3.5 rounded-xl text-[15px] outline-none",
"border transition-all duration-150",
passwordError ? "ring-2" : "",
].join(" ")}
style={{
background: "#1d2021",
color: "#ebdbb2",
caretColor: "#d79921",
borderColor: passwordError ? "#fb4934" : "#504945",
boxShadow: passwordError
? "0 0 0 2px rgba(251,73,52,0.2)"
: undefined,
}}
onFocus={(e) => {
if (!passwordError)
(e.target as HTMLInputElement).style.borderColor =
"#d79921";
}}
onBlur={(e) => {
if (!passwordError)
(e.target as HTMLInputElement).style.borderColor =
"#504945";
}}
/>
{passwordError && (
<p
className="text-[12px] -mt-1"
style={{ color: "#fb4934" }}
> >
Incorrect password. <Card>
</p> <Box
)} sx={{
<button px: 2.5,
onClick={handleUnlock} py: 1.25,
className="w-full h-11 rounded-xl text-[15px] font-semibold tracking-tight transition-opacity active:opacity-75 select-none flex items-center justify-center gap-2" borderBottom: "1px solid",
style={{ background: "#d79921", color: "#1d2021" }} borderColor: "divider",
backgroundColor: "background.default",
}}
> >
<Lock className="w-3.5 h-3.5" strokeWidth={2.5} /> <Typography
Unlock 250 MB variant="caption"
</button> sx={{ letterSpacing: "0.2em", color: "text.secondary" }}
</div> >
)} UPLOAD_BUFFER
</div> </Typography>
)} </Box>
<Box sx={{ px: { xs: 2, md: 3 }, py: { xs: 2.5, md: 3 } }}>
{/* Upload / progress / result */}
<div className="px-5 py-5 flex flex-col gap-4">
{isUploading ? ( {isUploading ? (
/* ── Uploading ─────────────────────────────────────────────── */ <Stack spacing={2}>
<div className="flex flex-col gap-3 py-1"> <Stack direction="row" spacing={2} alignItems="center">
<div className="flex items-center gap-3"> <Box
<div sx={{
className="w-9 h-9 rounded-[10px] flex items-center justify-center shrink-0" width: 36,
style={{ background: "#3c3836" }} height: 36,
borderRadius: 2,
display: "grid",
placeItems: "center",
backgroundColor: "action.selected",
}}
> >
<Upload <CloudUploadIcon fontSize="small" />
className="w-4 h-4" </Box>
style={{ color: "#a89984" }} <Box sx={{ flex: 1, minWidth: 0 }}>
strokeWidth={1.75} <Typography
/> variant="body2"
</div> sx={{ fontWeight: 600 }}
<p noWrap
className="text-[14px] font-medium truncate flex-1 min-w-0"
style={{ color: "#ebdbb2" }}
> >
{pendingFileName} {pendingFileName}
</p> </Typography>
<span </Box>
className="text-[13px] tabular-nums shrink-0 ml-2" <Typography variant="caption" color="text.secondary">
style={{ color: "#a89984" }}
>
{progress}% {progress}%
</span> </Typography>
</div> </Stack>
<div <LinearProgress variant="determinate" value={progress} />
className="h-[3px] w-full rounded-full overflow-hidden" </Stack>
style={{ background: "#3c3836" }}
>
<div
className="h-full rounded-full transition-all duration-300 ease-out"
style={{ width: `${progress}%`, background: "#d79921" }}
/>
</div>
</div>
) : status === "done" && resultUrl ? ( ) : status === "done" && resultUrl ? (
/* ── Done ─────────────────────────────────────────────────── */ <Stack spacing={2}>
<div className="flex flex-col gap-3"> <Stack direction="row" spacing={1} alignItems="center">
<div className="flex items-center gap-2"> <CheckCircleIcon color="success" fontSize="small" />
<CheckCircle2 <Typography variant="body2" sx={{ fontWeight: 600 }}>
className="w-4 h-4 shrink-0" Transfer complete
style={{ color: "#b8bb26" }} </Typography>
strokeWidth={2} </Stack>
/> <Button
<span size="small"
className="text-[14px] font-medium" color="inherit"
style={{ color: "#ebdbb2" }} startIcon={<ReplayIcon />}
>
Upload complete
</span>
</div>
<input
readOnly
value={resultUrl}
onClick={(e) => (e.target as HTMLInputElement).select()}
className="w-full h-10 px-3 rounded-xl text-[12px] font-mono outline-none cursor-text transition-colors"
style={{
background: "#1d2021",
border: "1px solid #504945",
color: "#d5c4a1",
}}
/>
<div className="flex gap-2">
<button
onClick={handleCopy}
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"
style={
copied
? {
background: "rgba(184,187,38,0.12)",
color: "#b8bb26",
border: "1px solid rgba(184,187,38,0.25)",
}
: {
background: "#3c3836",
color: "#ebdbb2",
border: "1px solid #504945",
}
}
>
<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 h-11 rounded-xl text-[14px] font-semibold flex items-center justify-center gap-1.5 transition-opacity active:opacity-80 select-none"
style={{ background: "#d79921", color: "#1d2021" }}
>
<ExternalLink className="w-3.5 h-3.5" strokeWidth={2} />
Open
</a>
</div>
<button
onClick={() => { onClick={() => {
setResultUrl(""); setResultUrl("");
setErrorMessage(""); setErrorMessage("");
setUploadedFile(null);
setStatus(isAuthenticated ? "authenticated" : "idle"); setStatus(isAuthenticated ? "authenticated" : "idle");
}} }}
className="flex items-center justify-center gap-1.5 text-[13px] transition-colors active:opacity-80 select-none"
style={{ color: "#a89984" }}
> >
<RotateCcw className="w-3 h-3" strokeWidth={2} />
Upload another Upload another
</button> </Button>
</div> </Stack>
) : ( ) : (
/* ── Drop zone ─────────────────────────────────────────────── */ <Box
<div
onDragOver={handleDragOver} onDragOver={handleDragOver}
onDragLeave={handleDragLeave} onDragLeave={handleDragLeave}
onDrop={handleDrop} onDrop={handleDrop}
onClick={() => isInteractable && fileInputRef.current?.click()} onClick={() =>
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" isInteractable && fileInputRef.current?.click()
style={{ }
borderColor: isDragging ? "#83a598" : "#504945", sx={{
background: isDragging border: "2px dashed",
? "rgba(131,165,152,0.06)" borderColor: isDragging ? "info.main" : "divider",
: "transparent", borderRadius: 0,
px: { xs: 2.5, md: 4 },
py: { xs: 4, md: 6 },
textAlign: "center",
cursor: isUploading ? "default" : "pointer", cursor: isUploading ? "default" : "pointer",
backgroundColor: isDragging
? "rgba(56, 189, 248, 0.08)"
: "transparent",
transition: "all 0.15s ease",
}} }}
> >
<input <input
ref={fileInputRef} ref={fileInputRef}
type="file" type="file"
className="hidden" hidden
onChange={handleFileChange} onChange={handleFileChange}
/> />
<div <Stack spacing={1.5} alignItems="center">
className="w-10 h-10 rounded-[12px] flex items-center justify-center transition-colors" <Box
style={{ sx={{
background: isDragging width: 44,
? "rgba(131,165,152,0.12)" height: 44,
: "#3c3836", borderRadius: 3,
display: "grid",
placeItems: "center",
backgroundColor: isDragging
? "rgba(56, 189, 248, 0.12)"
: "action.selected",
}} }}
> >
<Upload <CloudUploadIcon
className="w-4.5 h-4.5 transition-colors" fontSize="small"
style={{ color: isDragging ? "#83a598" : "#7c6f64" }} color={isDragging ? "info" : "inherit"}
strokeWidth={1.75}
/> />
</div> </Box>
<div> <Typography variant="body2" sx={{ fontWeight: 600 }}>
<p
className="text-[14px] font-medium transition-colors"
style={{ color: isDragging ? "#83a598" : "#ebdbb2" }}
>
{isDragging {isDragging
? "Drop to upload" ? "Drop to upload"
: "Drop file or tap to browse"} : "Drop file or tap to browse"}
</p> </Typography>
<p className="text-[12px] mt-1" style={{ color: "#7c6f64" }}> <Typography variant="caption" color="text.secondary">
Any file type · up to {limitLabel} Any file type · up to {limitLabel}
</p> </Typography>
</div> </Stack>
</div> </Box>
)} )}
</Box>
</Card>
{/* ── Error ────────────────────────────────────────────────── */} <Card>
{errorMessage && ( <Box
<div sx={{
className="flex items-start gap-2.5 px-3.5 py-3 rounded-xl" px: 2.5,
style={{ py: 1.25,
background: "rgba(251,73,52,0.08)", borderBottom: "1px solid",
border: "1px solid rgba(251,73,52,0.2)", borderColor: "divider",
backgroundColor: "background.default",
}} }}
> >
<AlertCircle <Typography
className="w-4 h-4 shrink-0 mt-px" variant="caption"
style={{ color: "#fb4934" }} sx={{ letterSpacing: "0.2em", color: "text.secondary" }}
strokeWidth={2} >
SESSION
</Typography>
</Box>
<Box sx={{ px: { xs: 2, md: 3 }, py: { xs: 2.5, md: 3 } }}>
{showAuthRow && (
<Stack spacing={2} sx={{ mb: 2.5 }}>
{showAuthBadge ? (
<Stack direction="row" spacing={1} alignItems="center">
<Chip
label="Authenticated · 250 MB limit"
color="success"
variant="outlined"
sx={{
color: "success.main",
borderColor: "rgba(34, 197, 94, 0.5)",
}}
/> />
<p </Stack>
className="text-[13px] break-all leading-relaxed" ) : (
style={{ color: "#fb4934" }} <Stack spacing={2}>
<Typography variant="body2" color="text.secondary">
Password{" "}
<Typography
component="span"
variant="body2"
color="text.disabled"
>
— optional, unlocks 250 MB
</Typography>
</Typography>
<TextField
type="password"
placeholder="Enter password"
value={password}
error={passwordError}
helperText={
passwordError ? "Incorrect password." : " "
}
onChange={(e) => {
setPassword(e.target.value);
setPasswordError(false);
}}
onKeyDown={(e) => e.key === "Enter" && handleUnlock()}
fullWidth
/>
<Button
variant="contained"
color="primary"
startIcon={<LockIcon />}
onClick={handleUnlock}
>
Unlock 250 MB
</Button>
</Stack>
)}
</Stack>
)}
{uploadedFile?.previewUrl && (
<Box
sx={{
borderRadius: 3,
overflow: "hidden",
border: "1px solid",
borderColor: "divider",
backgroundColor: "background.default",
mb: 2,
}}
>
{uploadedFile.type.startsWith("image/") ? (
<Box
component="img"
src={uploadedFile.previewUrl}
alt={uploadedFile.name}
sx={{ display: "block", width: "100%", height: "auto" }}
/>
) : (
<Box
component="video"
src={uploadedFile.previewUrl}
controls
sx={{ display: "block", width: "100%" }}
/>
)}
</Box>
)}
{uploadedFile && (
<Stack
spacing={0.5}
sx={{
px: 2,
py: 1.5,
borderRadius: 2,
border: "1px solid",
borderColor: "divider",
backgroundColor: "background.default",
mb: 2,
}}
>
<Typography variant="body2" sx={{ fontWeight: 600 }} noWrap>
{uploadedFile.name}
</Typography>
<Stack
direction="row"
spacing={2}
sx={{ color: "text.secondary" }}
>
<Typography variant="caption">
{formatBytes(uploadedFile.size)}
</Typography>
<Typography variant="caption">
{uploadedFile.type}
</Typography>
</Stack>
</Stack>
)}
{resultUrl && (
<Stack spacing={2}>
<TextField
value={resultUrl}
fullWidth
onClick={(e) => (e.target as HTMLInputElement).select()}
InputProps={{ readOnly: true }}
/>
<Stack direction={{ xs: "column", sm: "row" }} spacing={1}>
<Button
variant="outlined"
startIcon={<ContentCopyIcon />}
onClick={handleCopy}
color={copied ? "success" : "inherit"}
fullWidth
>
{copied ? "Copied" : "Copy"}
</Button>
<Button
variant="contained"
endIcon={<OpenInNewIcon />}
href={resultUrl}
target="_blank"
rel="noopener noreferrer"
fullWidth
>
Open
</Button>
</Stack>
</Stack>
)}
{errorMessage && (
<Alert
severity="error"
icon={<ErrorOutlineIcon />}
sx={{ mt: 2 }}
> >
{errorMessage} {errorMessage}
</p> </Alert>
</div>
)} )}
</div> </Box>
</div> </Card>
</Box>
{/* ── Footer ─────────────────────────────────────────────────────── */} <Typography
<p variant="caption"
className="text-center text-[12px] mt-6" color="text.secondary"
style={{ color: "#665c54" }} sx={{ textAlign: "center" }}
> >
Files are automatically deleted after 24 hours Files are automatically deleted after 24 hours
</p> </Typography>
</div> </Stack>
</main> </Box>
</Box>
); );
} }
+23
View File
@@ -0,0 +1,23 @@
"use client";
import { AppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
import CssBaseline from "@mui/material/CssBaseline";
import { ThemeProvider } from "@mui/material/styles";
import type { ReactNode } from "react";
import theme from "./theme";
type Props = {
children: ReactNode;
};
export default function Providers({ children }: Props) {
return (
<AppRouterCacheProvider options={{ enableCssLayer: true }}>
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
</AppRouterCacheProvider>
);
}
+206
View File
@@ -0,0 +1,206 @@
import { createTheme } from "@mui/material/styles";
const gruvbox = {
background: "#0b0e0b",
surface: "#0f1410",
surfaceAlt: "#121a13",
border: "#1f2a22",
textPrimary: "#d1fae5",
textSecondary: "#86efac",
textMuted: "#4ade80",
primary: "#22c55e",
success: "#22c55e",
info: "#22d3ee",
error: "#f87171",
};
const theme = createTheme({
palette: {
mode: "dark",
background: {
default: gruvbox.background,
paper: gruvbox.surface,
},
primary: {
main: gruvbox.primary,
contrastText: "#0b0f19",
},
success: {
main: gruvbox.success,
},
info: {
main: gruvbox.info,
},
error: {
main: gruvbox.error,
},
text: {
primary: gruvbox.textPrimary,
secondary: gruvbox.textSecondary,
disabled: gruvbox.textMuted,
},
divider: gruvbox.border,
},
typography: {
fontFamily:
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
h1: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
h2: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
h3: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
h4: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
h5: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
h6: {
fontWeight: 600,
letterSpacing: "-0.01em",
},
button: {
textTransform: "none",
fontWeight: 600,
},
},
shape: {
borderRadius: 0,
},
components: {
MuiCssBaseline: {
styleOverrides: {
body: {
backgroundColor: gruvbox.background,
color: gruvbox.textPrimary,
WebkitFontSmoothing: "antialiased",
MozOsxFontSmoothing: "grayscale",
},
"*": {
boxSizing: "border-box",
},
"::selection": {
background: "rgba(34, 197, 94, 0.3)",
color: gruvbox.textPrimary,
},
"::-webkit-scrollbar": {
width: "6px",
},
"::-webkit-scrollbar-track": {
background: "#0a0d0a",
},
"::-webkit-scrollbar-thumb": {
background: gruvbox.border,
borderRadius: "3px",
},
"::-webkit-scrollbar-thumb:hover": {
background: "#2f3b32",
},
},
},
MuiCard: {
styleOverrides: {
root: {
backgroundColor: gruvbox.surface,
border: `1px solid ${gruvbox.border}`,
borderRadius: 0,
boxShadow: "0 0 0 1px rgba(34, 197, 94, 0.08)",
},
},
},
MuiTextField: {
defaultProps: {
size: "small",
},
},
MuiOutlinedInput: {
styleOverrides: {
root: {
backgroundColor: "#0b0e0b",
"& .MuiOutlinedInput-notchedOutline": {
borderColor: gruvbox.border,
},
"&:hover .MuiOutlinedInput-notchedOutline": {
borderColor: gruvbox.primary,
},
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
borderColor: gruvbox.primary,
boxShadow: "0 0 0 2px rgba(34, 197, 94, 0.25)",
},
},
input: {
color: gruvbox.textPrimary,
caretColor: gruvbox.primary,
},
},
},
MuiInputLabel: {
styleOverrides: {
root: {
color: gruvbox.textSecondary,
"&.Mui-focused": {
color: gruvbox.primary,
},
},
},
},
MuiButton: {
styleOverrides: {
root: {
borderRadius: 0,
},
containedPrimary: {
color: "#0b0e0b",
},
},
},
MuiLinearProgress: {
styleOverrides: {
root: {
height: 6,
borderRadius: 999,
backgroundColor: gruvbox.surfaceAlt,
},
bar: {
borderRadius: 999,
backgroundColor: gruvbox.primary,
},
},
},
MuiAlert: {
styleOverrides: {
root: {
borderRadius: 0,
},
standardError: {
backgroundColor: "rgba(248, 113, 113, 0.12)",
border: "1px solid rgba(248, 113, 113, 0.35)",
color: gruvbox.error,
},
icon: {
color: gruvbox.error,
},
},
},
MuiDivider: {
styleOverrides: {
root: {
borderColor: gruvbox.border,
},
},
},
},
});
export type ThemeType = typeof theme;
export default theme;
-21
View File
@@ -1,21 +0,0 @@
import type { Config } from "tailwindcss";
const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
slate: {
950: "#0f172a",
},
},
},
},
plugins: [],
};
export default config;