Update code
@@ -39,3 +39,5 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
/app/generated/prisma
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
CalendarDays,
|
||||
Copy,
|
||||
Download,
|
||||
Eye,
|
||||
FileText,
|
||||
Plus,
|
||||
} from 'lucide-react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import Prism from 'prismjs';
|
||||
import 'prismjs/components/prism-bash';
|
||||
import 'prismjs/components/prism-javascript';
|
||||
import 'prismjs/components/prism-json';
|
||||
import 'prismjs/components/prism-python';
|
||||
import 'prismjs/components/prism-typescript';
|
||||
import 'prismjs/themes/prism-tomorrow.css';
|
||||
|
||||
import 'prismjs/plugins/line-numbers/prism-line-numbers.css';
|
||||
import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
|
||||
|
||||
/** ---------- Loader animé (spinner + skeletons) ---------- */
|
||||
function LoadingPaste() {
|
||||
return (
|
||||
<div className="relative w-screen h-screen bg-[#0e0f13] text-white flex overflow-hidden">
|
||||
{/* Zone code (skeleton lignes) */}
|
||||
<div className="flex-1 h-full font-mono text-sm">
|
||||
<div className="h-full overflow-auto pt-6 pb-6 px-6">
|
||||
<div className="mb-4 flex items-center gap-2">
|
||||
<div
|
||||
className="h-5 w-5 rounded-full border-2 border-white/30 border-t-transparent animate-spin"
|
||||
aria-hidden
|
||||
/>
|
||||
<span className="text-white/70 text-sm">Chargement du paste…</span>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
{Array.from({ length: 28 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className={`h-3 rounded bg-white/10 animate-pulse ${i % 3 === 0 ? 'w-5/6' : i % 3 === 1 ? 'w-11/12' : 'w-3/4'}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Sidebar (skeleton cartes + boutons) */}
|
||||
<div
|
||||
className="
|
||||
absolute top-4 right-4 w-[300px] rounded-2xl p-5 text-sm
|
||||
backdrop-blur-xl shadow-2xl
|
||||
bg-[linear-gradient(to_bottom_right,#1a2035,#101522)]
|
||||
ring-1 ring-white/10 mr-4
|
||||
"
|
||||
>
|
||||
<div className="mb-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="h-6 w-24 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-7 w-20 rounded-full bg-green-600/60 animate-pulse" />
|
||||
</div>
|
||||
<div className="h-4 w-40 bg-white/10 rounded mt-2 animate-pulse" />
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3 text-neutral-300">
|
||||
<div className="flex items-center gap-2 rounded-lg px-3 py-2 bg-[#151b2e] ring-1 ring-white/15">
|
||||
<div className="h-4 w-4 rounded bg-white/10 animate-pulse" />
|
||||
<div className="flex-1 space-y-1">
|
||||
<div className="h-3 w-10 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-3 w-12 bg-white/20 rounded animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 rounded-lg px-3 py-2 bg-[#151b2e] ring-1 ring-white/15">
|
||||
<div className="h-4 w-4 rounded bg-white/10 animate-pulse" />
|
||||
<div className="flex-1 space-y-1">
|
||||
<div className="h-3 w-12 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-3 w-16 bg-white/20 rounded animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-px bg-white/10 my-4" />
|
||||
|
||||
<div className="grid grid-cols-4 gap-2">
|
||||
{Array.from({ length: 4 }).map((_, i) => (
|
||||
<div key={i} className="h-9 rounded-lg bg-[#151b2e] ring-1 ring-white/10 animate-pulse" />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-3 h-3 w-16 mx-auto bg-green-400/50 rounded animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
/** -------------------------------------------------------- */
|
||||
|
||||
export default function PastePage({ params }: { params: { id: string } }) {
|
||||
const [paste, setPaste] = useState<any | null>(null);
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [language, setLanguage] = useState<string>('language-javascript');
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const codeRef = useRef<HTMLPreElement | null>(null);
|
||||
const router = useRouter();
|
||||
|
||||
const fetchPaste = async (pwd?: string) => {
|
||||
setLoading(true);
|
||||
const res = await fetch(`/api/paste/${params.id}`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ password: pwd || '' }),
|
||||
});
|
||||
|
||||
if (res.status === 403) {
|
||||
setError('Invalid password.');
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
if (res.status === 404) {
|
||||
setError('Paste not found or expired.');
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
setPaste(data);
|
||||
|
||||
if (data.content.includes('function') || data.content.includes('const')) {
|
||||
setLanguage('language-javascript');
|
||||
} else if (data.content.includes('import') || data.content.includes('export')) {
|
||||
setLanguage('language-typescript');
|
||||
} else if (data.content.includes('{') && data.content.includes('}')) {
|
||||
setLanguage('language-json');
|
||||
} else {
|
||||
setLanguage('language-bash');
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchPaste();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (paste?.content) {
|
||||
Prism.highlightAll();
|
||||
}
|
||||
}, [paste]);
|
||||
|
||||
// 👉 Remplace l'ancien message "Loading..." par le loader animé
|
||||
if (loading) return <LoadingPaste />;
|
||||
|
||||
if (error || (paste?.protected && !paste?.content)) {
|
||||
return (
|
||||
<div className="h-screen w-screen bg-[#0e0f13] flex items-center justify-center text-white">
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
fetchPaste((e.currentTarget as any).password.value);
|
||||
}}
|
||||
className="
|
||||
w-full max-w-sm rounded-2xl p-6 space-y-4
|
||||
backdrop-blur-xl shadow-2xl
|
||||
bg-[linear-gradient(to_bottom_right,rgba(20,24,38,0.9),rgba(14,16,24,0.9))]
|
||||
ring-1 ring-white/10
|
||||
"
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
<span className="text-red-400">🔒 Protected Paste</span>
|
||||
</h2>
|
||||
{error && <p className="text-red-500 text-sm">{error}</p>}
|
||||
|
||||
<input
|
||||
name="password"
|
||||
type="password"
|
||||
placeholder="Enter password"
|
||||
className="
|
||||
w-full rounded-xl bg-[#0f1320]/60 text-white placeholder:text-neutral-500
|
||||
px-3 py-2 outline-none
|
||||
ring-1 ring-white/10 focus:ring-2 focus:ring-blue-500/50
|
||||
"
|
||||
/>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="
|
||||
w-full inline-flex items-center justify-center gap-2 rounded-xl py-2 text-sm font-medium
|
||||
bg-gradient-to-b from-[#1b2135] to-[#141a2a] text-white ring-1 ring-white/10
|
||||
hover:from-[#232a41] hover:to-[#161d2f]
|
||||
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60
|
||||
"
|
||||
>
|
||||
View Paste
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative w-screen h-screen bg-[#0e0f13] text-white flex overflow-hidden">
|
||||
<div className="flex-1 h-full font-mono text-sm">
|
||||
<pre
|
||||
ref={codeRef}
|
||||
className="h-full overflow-auto pt-6 pb-6 px-6 line-numbers"
|
||||
>
|
||||
<code className={`${language} whitespace-pre-wrap break-words`}>
|
||||
{paste.content}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="
|
||||
absolute top-4 right-4 w-[300px] rounded-2xl p-5 text-sm
|
||||
backdrop-blur-xl shadow-2xl
|
||||
bg-[linear-gradient(to_bottom_right,#1a2035,#101522)]
|
||||
ring-1 ring-white/10 mr-4
|
||||
"
|
||||
>
|
||||
<div className="mb-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-lg font-bold tracking-tight">
|
||||
Alt<span className="text-blue-400">Bin</span>
|
||||
</h2>
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="
|
||||
cursor-pointer inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-semibold
|
||||
bg-green-600 text-white shadow-sm
|
||||
hover:bg-green-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-400/60
|
||||
"
|
||||
>
|
||||
<Plus size={14} />
|
||||
CREATE
|
||||
</button>
|
||||
</div>
|
||||
{paste.title && (
|
||||
<h1
|
||||
className="text-sm font-semibold text-blue-300 truncate mt-1"
|
||||
title={paste.title}
|
||||
>
|
||||
{paste.title}
|
||||
</h1>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3 text-neutral-300">
|
||||
<div className="flex items-center gap-2 rounded-lg px-3 py-2 bg-[#151b2e] ring-1 ring-white/15">
|
||||
<Eye size={16} />
|
||||
<div className="leading-tight">
|
||||
<div className="text-xs text-neutral-400">Views</div>
|
||||
<div className="text-sm font-medium text-white">{paste.views}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 rounded-lg px-3 py-2 bg-[#151b2e] ring-1 ring-white/15">
|
||||
<CalendarDays size={16} />
|
||||
<div className="leading-tight">
|
||||
<div className="text-xs text-neutral-400">Created</div>
|
||||
<div className="text-sm font-medium text-white">
|
||||
{new Date(paste.createdAt).toLocaleDateString()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-px bg-white/10 my-4" />
|
||||
|
||||
<div className="grid grid-cols-4 gap-2">
|
||||
<button
|
||||
onClick={async () => {
|
||||
await navigator.clipboard.writeText(paste.content);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 1200);
|
||||
}}
|
||||
className="cursor-pointer inline-flex items-center justify-center rounded-lg p-2 bg-[#151b2e] ring-1 ring-white/10 hover:bg-[#1e253d] hover:ring-blue-400/30"
|
||||
title="Copy"
|
||||
>
|
||||
<Copy size={18} />
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => window.open(`/api/${params.id}?raw=1`, '_blank')}
|
||||
className="cursor-pointer inline-flex items-center justify-center rounded-lg p-2 bg-[#151b2e] ring-1 ring-white/10 hover:bg-[#1e253d] hover:ring-blue-400/30"
|
||||
title="Raw"
|
||||
>
|
||||
<FileText size={18} />
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => {
|
||||
const blob = new Blob([paste.content], { type: 'text/plain' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `${params.id}.txt`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}}
|
||||
className="cursor-pointer inline-flex items-center justify-center rounded-lg p-2 bg-[#151b2e] ring-1 ring-white/10 hover:bg-[#1e253d] hover:ring-blue-400/30"
|
||||
title="Download"
|
||||
>
|
||||
<Download size={18} />
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="cursor-pointer inline-flex items-center justify-center rounded-lg p-2 bg-[#151b2e] ring-1 ring-white/10 hover:bg-[#1e253d] hover:ring-blue-400/30"
|
||||
title="New paste"
|
||||
>
|
||||
<Plus size={18} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`mt-3 text-center text-xs transition-opacity ${
|
||||
copied ? 'opacity-100 text-green-400' : 'opacity-0'
|
||||
}`}
|
||||
>
|
||||
Copied!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
"use client";
|
||||
|
||||
import { Player } from "@lordicon/react";
|
||||
import { motion } from "framer-motion";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { forwardRef, useEffect, useRef, useState } from "react";
|
||||
|
||||
// URLs d’icônes Lordicon
|
||||
const icons = {
|
||||
simplicity: "https://cdn.lordicon.com/tsrgicte.json", // simplicité
|
||||
shield: "https://cdn.lordicon.com/sjoccsdj.json", // sécurité
|
||||
community: "https://cdn.lordicon.com/ubpgwkmy.json", // communauté / open source
|
||||
github: "https://cdn.lordicon.com/jjxzcivr.json", // GitHub
|
||||
discord: "https://cdn.lordicon.com/zvnxzuwv.json", // Discord
|
||||
};
|
||||
|
||||
// Wrapper pour Lordicon
|
||||
const LordIcon = forwardRef(function LordIcon(
|
||||
{ url, size = 30, colorize = "#3b82f6" }: { url: string; size?: number; colorize?: string },
|
||||
ref: any
|
||||
) {
|
||||
const [iconData, setIconData] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(url).then((res) => res.json()).then(setIconData);
|
||||
}, [url]);
|
||||
|
||||
if (!iconData) return null;
|
||||
return <Player ref={ref} icon={iconData} size={size} colorize={colorize} />;
|
||||
});
|
||||
|
||||
// Carte Feature
|
||||
function FeatureCard({
|
||||
title,
|
||||
desc,
|
||||
icon,
|
||||
}: {
|
||||
title: string;
|
||||
desc: string;
|
||||
icon: string;
|
||||
}) {
|
||||
const iconRef = useRef<any>(null);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
whileHover={{ scale: 1.03 }}
|
||||
className="rounded-2xl bg-[#11131c] border border-white/10 p-6 shadow-lg hover:border-blue-500/40 transition-colors"
|
||||
onMouseEnter={() => iconRef.current?.playFromBeginning()}
|
||||
onMouseLeave={() => iconRef.current?.goToFirstFrame()}
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<div className="p-2 rounded-xl bg-blue-500/20 text-blue-400">
|
||||
<LordIcon ref={iconRef} url={icon} size={32} />
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold">{title}</h3>
|
||||
</div>
|
||||
<p className="text-neutral-400 text-sm leading-relaxed">{desc}</p>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
// Bouton Contact
|
||||
function ContactButton({
|
||||
href,
|
||||
icon,
|
||||
text,
|
||||
gradient,
|
||||
shadow,
|
||||
color = "#fff",
|
||||
}: {
|
||||
href: string;
|
||||
icon: string;
|
||||
text: string;
|
||||
gradient: string;
|
||||
shadow: string;
|
||||
color?: string;
|
||||
}) {
|
||||
const iconRef = useRef<any>(null);
|
||||
|
||||
return (
|
||||
<motion.a
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={`cursor-pointer inline-flex items-center gap-2 px-6 py-3 rounded-xl text-base font-medium text-white ${gradient} ${shadow} transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-blue-400/60`}
|
||||
onMouseEnter={() => iconRef.current?.playFromBeginning()}
|
||||
onMouseLeave={() => iconRef.current?.goToFirstFrame()}
|
||||
>
|
||||
<LordIcon ref={iconRef} url={icon} size={32} colorize={color} />
|
||||
<span>{text}</span>
|
||||
</motion.a>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AboutPage() {
|
||||
const router = useRouter();
|
||||
|
||||
const features = [
|
||||
{
|
||||
title: "Simplicity",
|
||||
desc: "Create a paste in seconds, distraction-free.",
|
||||
icon: icons.simplicity,
|
||||
},
|
||||
{
|
||||
title: "Security",
|
||||
desc: "Protect your posts with a password or limited number of views.",
|
||||
icon: icons.shield,
|
||||
},
|
||||
{
|
||||
title: "Open Source",
|
||||
desc: "Contribute to the project and improve the platform.",
|
||||
icon: icons.community,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="p-8 relative min-h-screen bg-[#0e0f13] text-white">
|
||||
{/* Navbar */}
|
||||
<div className="flex justify-between items-center mb-12 max-w-6xl mx-auto">
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
onClick={() => router.back()}
|
||||
className="cursor-pointer inline-flex items-center gap-2 px-5 py-2 rounded-xl text-sm font-medium
|
||||
text-white bg-gradient-to-r from-blue-600 to-blue-500 shadow-lg shadow-blue-500/30
|
||||
hover:shadow-blue-500/50 transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-blue-400/60"
|
||||
>
|
||||
<ArrowLeft size={18} className="text-blue-200" />
|
||||
Back
|
||||
</motion.button>
|
||||
|
||||
<h1 className="text-lg font-bold text-neutral-300">AltBin</h1>
|
||||
</div>
|
||||
|
||||
{/* Features */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-6 max-w-6xl mx-auto">
|
||||
{features.map((f, i) => (
|
||||
<FeatureCard key={i} title={f.title} desc={f.desc} icon={f.icon} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Contact */}
|
||||
<div className="mt-20 max-w-2xl mx-auto text-center">
|
||||
<h2 className="text-xl md:text-2xl font-bold mb-4">Contact</h2>
|
||||
<p className="text-neutral-400 mb-8">
|
||||
Any <span className="text-blue-400">questions</span> or{" "}
|
||||
<span className="text-blue-400">suggestions</span>?
|
||||
Join the community or check out the source code
|
||||
</p>
|
||||
|
||||
<div className="flex justify-center gap-4 flex-wrap">
|
||||
<ContactButton
|
||||
href="https://discord.gg/ton-serveur"
|
||||
icon={icons.discord}
|
||||
text="Join Discord"
|
||||
gradient="bg-gradient-to-r from-indigo-600 to-indigo-500"
|
||||
shadow="shadow-lg shadow-indigo-500/30 hover:shadow-indigo-500/50"
|
||||
/>
|
||||
<ContactButton
|
||||
href="https://github.com/UltraLionfr/altbin.dev"
|
||||
icon={icons.github}
|
||||
text="GitHub"
|
||||
gradient="bg-gradient-to-r from-gray-800 to-gray-700"
|
||||
shadow="shadow-lg shadow-black/30 hover:shadow-blue-500/40"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import NextAuth, { NextAuthOptions } from 'next-auth';
|
||||
import DiscordProvider from 'next-auth/providers/discord';
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
providers: [
|
||||
DiscordProvider({
|
||||
clientId: process.env.DISCORD_CLIENT_ID!,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
async session({ session, token }) {
|
||||
if (session.user && token.sub) {
|
||||
session.user.id = token.sub;
|
||||
} else {
|
||||
session.user.id = '';
|
||||
}
|
||||
return session;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
@@ -0,0 +1,30 @@
|
||||
import { prisma } from '@/lib/prisma';
|
||||
|
||||
interface Props {
|
||||
params: { id: string };
|
||||
}
|
||||
|
||||
export default async function PastePage({ params }: Props) {
|
||||
const paste = await prisma.paste.findUnique({
|
||||
where: { id: params.id },
|
||||
select: { title: true, content: true, createdAt: true, views: true },
|
||||
});
|
||||
|
||||
if (!paste) return <div>Paste not found</div>;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[#0e0f13] text-white p-6">
|
||||
<h1 className="text-3xl font-bold text-blue-400 mb-4">
|
||||
{paste.title || 'Untitled'}
|
||||
</h1>
|
||||
|
||||
<pre className="bg-[#11131c] p-6 rounded-xl whitespace-pre-wrap overflow-auto text-sm border border-white/10 shadow-lg">
|
||||
{paste.content}
|
||||
</pre>
|
||||
|
||||
<p className="mt-4 text-xs text-neutral-400">
|
||||
Views: {paste.views} · Created at: {new Date(paste.createdAt).toLocaleString()}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
export async function POST(
|
||||
request: NextRequest,
|
||||
context: { params: { id: string } }
|
||||
) {
|
||||
const { params } = context;
|
||||
const pasteId = params.id;
|
||||
|
||||
const { password = '' } = await request.json();
|
||||
|
||||
if (!pasteId) {
|
||||
return NextResponse.json({ error: 'Invalid ID' }, { status: 400 });
|
||||
}
|
||||
|
||||
const paste = await prisma.paste.findUnique({ where: { id: pasteId } });
|
||||
if (!paste) {
|
||||
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
||||
}
|
||||
|
||||
if (paste.maxViews !== null && paste.views >= paste.maxViews) {
|
||||
await prisma.paste.delete({ where: { id: paste.id } });
|
||||
return NextResponse.json({ error: 'Max views exceeded' }, { status: 404 });
|
||||
}
|
||||
|
||||
if (paste.password) {
|
||||
const valid = await bcrypt.compare(password, paste.password);
|
||||
if (!valid) {
|
||||
return NextResponse.json({ error: 'Invalid password' }, { status: 403 });
|
||||
}
|
||||
}
|
||||
|
||||
const updated = await prisma.paste.update({
|
||||
where: { id: paste.id },
|
||||
data: { views: { increment: 1 } },
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
content: true,
|
||||
createdAt: true,
|
||||
views: true,
|
||||
maxViews: true,
|
||||
password: true,
|
||||
},
|
||||
});
|
||||
|
||||
const payload = {
|
||||
id: updated.id,
|
||||
title: updated.title,
|
||||
content: updated.content,
|
||||
createdAt: updated.createdAt,
|
||||
views: updated.views,
|
||||
protected: !!updated.password,
|
||||
};
|
||||
|
||||
if (updated.maxViews !== null && updated.views >= updated.maxViews) {
|
||||
prisma.paste.delete({ where: { id: updated.id } }).catch(() => {});
|
||||
}
|
||||
|
||||
return NextResponse.json(payload, {
|
||||
headers: { 'Cache-Control': 'no-store' },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { authOptions } from '../auth/[...nextauth]/route';
|
||||
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz0123456789', 7);
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const body = await req.json();
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
let hashedPassword = null;
|
||||
if (body.password) {
|
||||
hashedPassword = await bcrypt.hash(body.password, 10);
|
||||
}
|
||||
|
||||
const paste = await prisma.paste.create({
|
||||
data: {
|
||||
id: nanoid(),
|
||||
title: body.title || null,
|
||||
content: body.content,
|
||||
password: hashedPassword,
|
||||
maxViews: body.maxViews ? parseInt(body.maxViews, 10) : null,
|
||||
createdBy: session?.user?.id ?? null,
|
||||
size: Buffer.byteLength(body.content, 'utf8'),
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(paste);
|
||||
}
|
||||
|
||||
export async function DELETE(req: Request) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.id) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { searchParams } = new URL(req.url);
|
||||
const id = searchParams.get("id");
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json({ error: "Missing id" }, { status: 400 });
|
||||
}
|
||||
|
||||
try {
|
||||
const paste = await prisma.paste.findUnique({ where: { id } });
|
||||
|
||||
if (!paste || paste.createdBy !== session.user.id) {
|
||||
return NextResponse.json({ error: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
await prisma.paste.delete({ where: { id } });
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ error: "Server error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { getDashboardStats } from '@/lib/stats';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { authOptions } from '../auth/[...nextauth]/route';
|
||||
|
||||
export async function GET() {
|
||||
const session = await getServerSession(authOptions);
|
||||
const stats = await getDashboardStats(session?.user?.id);
|
||||
return NextResponse.json(stats);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { authOptions } from '@/app/api/auth/[...nextauth]/route';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.id) {
|
||||
return NextResponse.json([], { status: 401 });
|
||||
}
|
||||
|
||||
const { searchParams } = new URL(req.url);
|
||||
|
||||
const page = parseInt(searchParams.get('page') || '1', 10);
|
||||
const perPage = parseInt(searchParams.get('perPage') || '10', 10);
|
||||
const skip = (page - 1) * perPage;
|
||||
|
||||
const search = searchParams.get('q') || '';
|
||||
|
||||
const filter = {
|
||||
createdBy: session.user.id,
|
||||
...(search
|
||||
? {
|
||||
title: {
|
||||
contains: search,
|
||||
mode: 'insensitive',
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
const [pastes, total] = await Promise.all([
|
||||
prisma.paste.findMany({
|
||||
where: filter,
|
||||
orderBy: { createdAt: 'desc' },
|
||||
skip,
|
||||
take: perPage,
|
||||
}),
|
||||
prisma.paste.count({
|
||||
where: filter,
|
||||
}),
|
||||
]);
|
||||
|
||||
return NextResponse.json({ pastes, total });
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'AltBin - Dashboard',
|
||||
};
|
||||
|
||||
export default function DashboardLayout({ children }: { children: React.ReactNode }) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
"use client";
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
|
||||
import Header from "@/components/dashboard/Header";
|
||||
import LoadingDashboard from "@/components/dashboard/LoadingDashboard";
|
||||
import Pagination from "@/components/dashboard/Pagination";
|
||||
import PasteCard from "@/components/dashboard/PasteCard";
|
||||
import SearchBar from "@/components/dashboard/SearchBar";
|
||||
import Sidebar from "@/components/dashboard/Sidebar";
|
||||
import StatCard from "@/components/dashboard/StatCard";
|
||||
import ConfirmDeleteModal from "@/components/modals/ConfirmDeleteModal";
|
||||
|
||||
import { formatBytes } from "@/lib/format-bytes";
|
||||
|
||||
const PER_PAGE = 6;
|
||||
|
||||
const dashboardIcons = {
|
||||
clipboard: "https://cdn.lordicon.com/gvtjlyjf.json",
|
||||
views: "https://cdn.lordicon.com/dicvhxpz.json",
|
||||
calendar: "https://cdn.lordicon.com/uphbloed.json",
|
||||
code: "https://cdn.lordicon.com/xqdfobxg.json",
|
||||
storage: "https://cdn.lordicon.com/kikjlzqr.json",
|
||||
chart: "https://cdn.lordicon.com/abwrkdvl.json",
|
||||
flame: "https://cdn.lordicon.com/thtrcqvk.json",
|
||||
file: "https://cdn.lordicon.com/fikcyfpp.json",
|
||||
paste: "https://cdn.lordicon.com/hmpomorl.json",
|
||||
};
|
||||
|
||||
export default function DashboardPage() {
|
||||
const { data: session, status } = useSession();
|
||||
const router = useRouter();
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [stats, setStats] = useState<any>(null);
|
||||
const [pastes, setPastes] = useState<any[]>([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPastes, setTotalPastes] = useState(0);
|
||||
const [deleteId, setDeleteId] = useState<string | null>(null);
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
const res = await fetch(`/api/paste?id=${id}`, { method: "DELETE" });
|
||||
if (res.ok) {
|
||||
setPastes((prev) => prev.filter((p) => p.id !== id));
|
||||
setTotalPastes((prev) => prev - 1);
|
||||
toast.success("Paste deleted successfully 🚀");
|
||||
} else {
|
||||
toast.error("Failed to delete paste ❌");
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (status === "unauthenticated") router.push("/");
|
||||
}, [status, router]);
|
||||
|
||||
useEffect(() => {
|
||||
if (status === "authenticated") {
|
||||
const fetchStats = async () => {
|
||||
const res = await fetch("/api/stats");
|
||||
if (res.ok) setStats(await res.json());
|
||||
};
|
||||
|
||||
const fetchPastes = async () => {
|
||||
const res = await fetch(
|
||||
`/api/user-pastes?page=${page}&perPage=${PER_PAGE}&q=${encodeURIComponent(searchTerm)}`
|
||||
);
|
||||
if (!res.ok) return setPastes([]);
|
||||
try {
|
||||
const data = await res.json();
|
||||
setPastes(data.pastes ?? []);
|
||||
setTotalPastes(data.total ?? 0);
|
||||
} catch {
|
||||
setPastes([]);
|
||||
setTotalPastes(0);
|
||||
}
|
||||
};
|
||||
|
||||
fetchStats();
|
||||
fetchPastes();
|
||||
}
|
||||
}, [status, page, searchTerm]);
|
||||
|
||||
if (status === "loading" || !stats) return <LoadingDashboard />;
|
||||
|
||||
const totalPages = Math.ceil(totalPastes / PER_PAGE);
|
||||
|
||||
return (
|
||||
<div className="flex h-screen bg-[#0d1117]">
|
||||
<Sidebar />
|
||||
|
||||
<main className="flex-1 p-8 overflow-y-auto">
|
||||
<Header user={session?.user?.name} />
|
||||
|
||||
{/* Stats */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-10">
|
||||
{[
|
||||
{ label: "Total Pastes", value: stats.totalPastes, icon: dashboardIcons.clipboard },
|
||||
{ label: "Total Views", value: stats.totalViews, icon: dashboardIcons.views },
|
||||
{ label: "Last 30 Days", value: stats.recentPastes, icon: dashboardIcons.calendar },
|
||||
{ label: "API Usage", value: stats.apiUsage, icon: dashboardIcons.code },
|
||||
{ label: "Storage Used", value: formatBytes(stats.storageUsed), icon: dashboardIcons.storage },
|
||||
{ label: "Avg Views", value: stats.avgViews, icon: dashboardIcons.chart },
|
||||
{ label: "Most Viewed", value: stats.mostViewed, icon: dashboardIcons.flame },
|
||||
{ label: "Avg Paste Size", value: formatBytes(stats.avgSize), icon: dashboardIcons.file },
|
||||
].map((stat, i) => (
|
||||
<StatCard key={i} label={stat.label} value={stat.value} icon={stat.icon} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<SearchBar value={searchTerm} onChange={(v) => { setSearchTerm(v); setPage(1); }} />
|
||||
|
||||
{/* Pastes */}
|
||||
<h2 className="text-lg font-semibold text-white mb-4">Your Pastes</h2>
|
||||
{pastes.length === 0 ? (
|
||||
<div className="text-sm text-neutral-400">No pastes found.</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{pastes.map((paste) => (
|
||||
<PasteCard
|
||||
key={paste.id}
|
||||
paste={paste}
|
||||
onDelete={setDeleteId}
|
||||
pasteIconUrl={dashboardIcons.paste}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Pagination totalPages={totalPages} currentPage={page} onPageChange={setPage} />
|
||||
|
||||
<ConfirmDeleteModal
|
||||
open={!!deleteId}
|
||||
onOpenChange={(open) => !open && setDeleteId(null)}
|
||||
onConfirm={() => { if (deleteId) { handleDelete(deleteId); setDeleteId(null); } }}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,42 +1,22 @@
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
@import "tailwindcss";
|
||||
|
||||
.hljs,
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
}
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--foreground);
|
||||
background: var(--background);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html {
|
||||
color-scheme: dark;
|
||||
/* ➡️ Hors du @layer */
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
white-space: pre-wrap !important;
|
||||
word-break: break-word !important;
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.neon-border {
|
||||
box-shadow:
|
||||
0 0 0 1.5px oklch(0.65 0.2 250 / 0.5),
|
||||
0 0 10px oklch(0.65 0.2 250 / 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,51 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import AuthProvider from '@/components/SessionProvider';
|
||||
import ToasterProvider from '@/components/ui/ToasterProvider';
|
||||
import { ReactNode } from 'react';
|
||||
import './globals.css';
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
import type { Metadata, Viewport } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: "AltBin - Modern text and code sharing",
|
||||
description:
|
||||
"AltBin is a fast and modern pastebin for sharing text and code snippets with ease. Secure, minimal, and developer-friendly.",
|
||||
metadataBase: new URL("https://altbin.dev"),
|
||||
openGraph: {
|
||||
title: "AltBin - Modern text and code sharing",
|
||||
description:
|
||||
"Easily share text and code snippets with AltBin. A sleek and secure pastebin for developers.",
|
||||
url: "https://altbin.dev",
|
||||
siteName: "AltBin",
|
||||
images: ["/og-image.png"],
|
||||
locale: "en_US",
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title: "AltBin - Modern text and code sharing",
|
||||
description:
|
||||
"Share and manage text/code snippets effortlessly with AltBin. Secure and developer-friendly.",
|
||||
images: ["/og-image.png"],
|
||||
creator: "@AltBinApp",
|
||||
},
|
||||
icons: {
|
||||
icon: "/favicon.png",
|
||||
shortcut: "/favicon.png",
|
||||
},
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
export const viewport: Viewport = {
|
||||
themeColor: "#0f172a",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`${geistSans.variable} ${geistMono.variable}`}>
|
||||
<body className="bg-[#0a0a0f] text-neutral-100 font-mono">
|
||||
<AuthProvider>
|
||||
<ToasterProvider />
|
||||
{children}
|
||||
</AuthProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
'use client';
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function NotFoundPage() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<div
|
||||
className="min-h-screen flex items-center justify-center px-4"
|
||||
style={{
|
||||
background:
|
||||
'radial-gradient(circle at 20% 30%, #0a0a0f, transparent 60%), radial-gradient(circle at 80% 70%, rgba(147,197,253,0.1), transparent 60%), #0a0a0f',
|
||||
}}
|
||||
>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
transition={{ duration: 0.5, ease: 'easeOut' }}
|
||||
className="text-center bg-[#11131c]/90 backdrop-blur-xl rounded-3xl px-12 py-16 shadow-2xl border border-white/10 max-w-xl"
|
||||
>
|
||||
<h1 className="text-7xl font-extrabold tracking-tight mb-6">
|
||||
<span className="text-blue-400">404</span>
|
||||
</h1>
|
||||
|
||||
<h2 className="text-3xl font-semibold mb-4 text-neutral-100">
|
||||
Page Not Found
|
||||
</h2>
|
||||
|
||||
<p className="text-base text-neutral-400 mb-10 leading-relaxed">
|
||||
The paste you're looking for might have been deleted, expired, or the
|
||||
URL is incorrect.
|
||||
</p>
|
||||
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
onClick={() => router.push('/')}
|
||||
className="cursor-pointer group inline-flex items-center gap-2 px-6 py-3 rounded-xl text-base font-medium
|
||||
text-white bg-gradient-to-r from-blue-600 to-blue-500 shadow-lg shadow-blue-500/30
|
||||
hover:shadow-blue-500/50 transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-blue-400/60"
|
||||
>
|
||||
<Plus
|
||||
size={20}
|
||||
className="text-blue-200 group-hover:rotate-90 transition-transform duration-300"
|
||||
/>
|
||||
<span>Create New Paste</span>
|
||||
</motion.button>
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
.page {
|
||||
--gray-rgb: 0, 0, 0;
|
||||
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
|
||||
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);
|
||||
|
||||
--button-primary-hover: #383838;
|
||||
--button-secondary-hover: #f2f2f2;
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: 20px 1fr 20px;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
min-height: 100svh;
|
||||
padding: 80px;
|
||||
gap: 64px;
|
||||
font-family: var(--font-geist-sans);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.page {
|
||||
--gray-rgb: 255, 255, 255;
|
||||
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
|
||||
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);
|
||||
|
||||
--button-primary-hover: #ccc;
|
||||
--button-secondary-hover: #1a1a1a;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 32px;
|
||||
grid-row-start: 2;
|
||||
}
|
||||
|
||||
.main ol {
|
||||
font-family: var(--font-geist-mono);
|
||||
padding-left: 0;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
letter-spacing: -0.01em;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
.main li:not(:last-of-type) {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.main code {
|
||||
font-family: inherit;
|
||||
background: var(--gray-alpha-100);
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ctas {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.ctas a {
|
||||
appearance: none;
|
||||
border-radius: 128px;
|
||||
height: 48px;
|
||||
padding: 0 20px;
|
||||
border: 1px solid transparent;
|
||||
transition:
|
||||
background 0.2s,
|
||||
color 0.2s,
|
||||
border-color 0.2s;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
a.primary {
|
||||
background: var(--foreground);
|
||||
color: var(--background);
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
a.secondary {
|
||||
border-color: var(--gray-alpha-200);
|
||||
min-width: 158px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
grid-row-start: 3;
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.footer img {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Enable hover only on non-touch devices */
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
a.primary:hover {
|
||||
background: var(--button-primary-hover);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
a.secondary:hover {
|
||||
background: var(--button-secondary-hover);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 32px;
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.main {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main ol {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ctas {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ctas a {
|
||||
font-size: 14px;
|
||||
height: 40px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
a.secondary {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.footer {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.logo {
|
||||
filter: invert();
|
||||
}
|
||||
}
|
||||
@@ -1,95 +1,11 @@
|
||||
import Image from "next/image";
|
||||
import styles from "./page.module.css";
|
||||
'use client';
|
||||
|
||||
export default function Home() {
|
||||
import PasteForm from '@/components/PasteForm';
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<main className={styles.main}>
|
||||
<Image
|
||||
className={styles.logo}
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={180}
|
||||
height={38}
|
||||
priority
|
||||
/>
|
||||
<ol>
|
||||
<li>
|
||||
Get started by editing <code>app/page.tsx</code>.
|
||||
</li>
|
||||
<li>Save and see your changes instantly.</li>
|
||||
</ol>
|
||||
|
||||
<div className={styles.ctas}>
|
||||
<a
|
||||
className={styles.primary}
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className={styles.logo}
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
Deploy now
|
||||
</a>
|
||||
<a
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={styles.secondary}
|
||||
>
|
||||
Read our docs
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
<footer className={styles.footer}>
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/file.svg"
|
||||
alt="File icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Learn
|
||||
</a>
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/window.svg"
|
||||
alt="Window icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Examples
|
||||
</a>
|
||||
<a
|
||||
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/globe.svg"
|
||||
alt="Globe icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Go to nextjs.org →
|
||||
</a>
|
||||
</footer>
|
||||
<div className="relative min-h-screen">
|
||||
<PasteForm />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export async function fetchPastes() {
|
||||
const res = await fetch('/api/paste');
|
||||
return await res.json();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
"use client";
|
||||
|
||||
import AuthSection from "@/components/paste-form/AuthSection";
|
||||
import Editor from "@/components/paste-form/Editor";
|
||||
import SidebarPanel from "@/components/paste-form/SidebarPanel";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
export default function PasteForm() {
|
||||
const router = useRouter();
|
||||
const { data: session } = useSession();
|
||||
|
||||
const [title, setTitle] = useState("");
|
||||
const [content, setContent] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [maxViews, setMaxViews] = useState("");
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [advanced, setAdvanced] = useState(true);
|
||||
|
||||
const handleSave = useCallback(async () => {
|
||||
if (!content.trim()) return;
|
||||
setIsSaving(true);
|
||||
|
||||
const res = await fetch("/api/paste", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
title: title.trim() || null,
|
||||
content,
|
||||
password: password || null,
|
||||
maxViews: maxViews ? parseInt(maxViews, 10) : null,
|
||||
createdBy: session?.user?.id || null,
|
||||
}),
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
router.push(`/${data.id}`);
|
||||
}
|
||||
|
||||
setIsSaving(false);
|
||||
}, [title, content, password, maxViews, session, router]);
|
||||
|
||||
// Raccourci clavier Ctrl+S
|
||||
useEffect(() => {
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s") {
|
||||
e.preventDefault();
|
||||
if (!isSaving && content.trim()) handleSave();
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
return () => window.removeEventListener("keydown", onKeyDown);
|
||||
}, [handleSave, isSaving, content]);
|
||||
|
||||
return (
|
||||
<div className="w-screen h-screen bg-[#0e0f13] text-white relative">
|
||||
<Editor content={content} setContent={setContent} />
|
||||
<SidebarPanel
|
||||
title={title}
|
||||
setTitle={setTitle}
|
||||
maxViews={maxViews}
|
||||
setMaxViews={setMaxViews}
|
||||
password={password}
|
||||
setPassword={setPassword}
|
||||
content={content}
|
||||
isSaving={isSaving}
|
||||
handleSave={handleSave}
|
||||
advanced={advanced}
|
||||
setAdvanced={setAdvanced}
|
||||
/>
|
||||
<AuthSection />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
'use client';
|
||||
|
||||
import { SessionProvider } from 'next-auth/react';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
export default function AuthProvider({ children }: { children: ReactNode }) {
|
||||
return <SessionProvider>{children}</SessionProvider>;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useRef } from "react";
|
||||
import LordIcon from "./LordIcon";
|
||||
|
||||
export default function Header({ user }: { user?: string | null }) {
|
||||
const plusIconRef = useRef<any>(null);
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<div className="flex justify-between items-center mb-8">
|
||||
<h1 className="text-2xl font-bold text-white">
|
||||
Welcome back, <span className="text-blue-400">{user || "User"}</span>
|
||||
</h1>
|
||||
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
onClick={() => router.push("/")}
|
||||
className="cursor-pointer flex items-center gap-2 px-6 py-3 rounded-xl text-base font-medium
|
||||
text-white bg-gradient-to-r from-blue-600 to-blue-500 shadow-lg shadow-blue-500/30
|
||||
hover:shadow-blue-500/50 transition-all duration-300"
|
||||
onMouseEnter={() => plusIconRef.current?.playFromBeginning()}
|
||||
onMouseLeave={() => plusIconRef.current?.goToFirstFrame()}
|
||||
>
|
||||
<div className="w-6 h-6 flex items-center justify-center">
|
||||
<LordIcon
|
||||
ref={plusIconRef}
|
||||
url="https://cdn.lordicon.com/vjgknpfx.json"
|
||||
size={28}
|
||||
colorize="#ffffff"
|
||||
/>
|
||||
</div>
|
||||
Create New Paste
|
||||
</motion.button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
|
||||
export default function LoadingDashboard() {
|
||||
const StatSkeleton = () => (
|
||||
<div className="rounded-2xl bg-[#11131c] p-5 border border-white/10">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 rounded-xl bg-white/10 animate-pulse" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<div className="h-3 w-24 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-4 w-16 bg-white/10 rounded animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const PasteSkeleton = () => (
|
||||
<div className="rounded-xl border border-white/10 bg-[#11131c] p-5 shadow-sm">
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<div className="w-7 h-7 rounded-lg bg-white/10 animate-pulse" />
|
||||
<div className="h-4 w-40 bg-white/10 rounded animate-pulse" />
|
||||
</div>
|
||||
<div className="space-y-2 mb-3">
|
||||
<div className="h-3 w-full bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-3 w-5/6 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-3 w-2/3 bg-white/10 rounded animate-pulse" />
|
||||
</div>
|
||||
<div className="flex justify-between items-center mt-auto">
|
||||
<div className="h-3 w-28 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-5 w-16 bg-white/10 rounded-full animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex h-screen bg-[#0d1117]">
|
||||
{/* Sidebar skeleton */}
|
||||
<aside className="hidden md:flex flex-col w-64 bg-[#11131c] border-r border-white/10 p-6">
|
||||
<div className="h-6 w-40 bg-white/10 rounded mb-8 animate-pulse" />
|
||||
<div className="space-y-4">
|
||||
<div className="h-4 w-28 bg-white/10 rounded animate-pulse" />
|
||||
<div className="h-4 w-24 bg-white/10 rounded animate-pulse" />
|
||||
</div>
|
||||
<div className="mt-auto h-9 w-28 bg-white/10 rounded animate-pulse" />
|
||||
</aside>
|
||||
|
||||
<main className="flex-1 p-8 overflow-y-auto">
|
||||
{/* Header skeleton + spinner */}
|
||||
<div className="flex justify-between items-center mb-8">
|
||||
<div className="h-7 w-80 bg-white/10 rounded animate-pulse" />
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="h-5 w-5 rounded-full border-2 border-white/30 border-t-transparent animate-spin" />
|
||||
<span className="text-white/70 text-sm">Loading dashboard...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stat cards skeleton */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-10">
|
||||
{Array.from({ length: 8 }).map((_, i) => (
|
||||
<StatSkeleton key={i} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Search skeleton */}
|
||||
<div className="relative w-full md:w-1/3 mb-8">
|
||||
<div className="h-10 w-full rounded-xl bg-white/10 animate-pulse" />
|
||||
</div>
|
||||
|
||||
{/* Pastes skeleton grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<PasteSkeleton key={i} />
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { Player } from "@lordicon/react";
|
||||
import { forwardRef, useEffect, useState } from "react";
|
||||
|
||||
const LordIcon = forwardRef(function LordIcon(
|
||||
{ url, size = 28, colorize = "#3b82f6" }: { url: string; size?: number; colorize?: string },
|
||||
ref: any
|
||||
) {
|
||||
const [iconData, setIconData] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(url).then((res) => res.json()).then(setIconData);
|
||||
}, [url]);
|
||||
|
||||
if (!iconData) return null;
|
||||
return <Player ref={ref} icon={iconData} size={size} colorize={colorize} />;
|
||||
});
|
||||
|
||||
export default LordIcon;
|
||||
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
export default function Pagination({
|
||||
totalPages,
|
||||
currentPage,
|
||||
onPageChange,
|
||||
}: {
|
||||
totalPages: number;
|
||||
currentPage: number;
|
||||
onPageChange: (page: number) => void;
|
||||
}) {
|
||||
if (totalPages <= 1) return null;
|
||||
|
||||
return (
|
||||
<div className="flex justify-center mt-10 gap-2">
|
||||
{Array.from({ length: totalPages }, (_, i) => (
|
||||
<button
|
||||
key={i}
|
||||
onClick={() => onPageChange(i + 1)}
|
||||
className={`px-4 py-2 rounded-full text-sm transition-colors cursor-pointer ${
|
||||
currentPage === i + 1
|
||||
? "bg-blue-600 text-white shadow-md"
|
||||
: "bg-neutral-800 text-white hover:bg-neutral-700"
|
||||
}`}
|
||||
>
|
||||
{i + 1}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { useRef } from "react";
|
||||
import LordIcon from "./LordIcon";
|
||||
|
||||
export default function PasteCard({
|
||||
paste,
|
||||
onDelete,
|
||||
pasteIconUrl,
|
||||
}: {
|
||||
paste: any;
|
||||
onDelete: (id: string) => void;
|
||||
pasteIconUrl: string;
|
||||
}) {
|
||||
const pasteIconRef = useRef<any>(null);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
className="rounded-xl border border-white/10 bg-[#11131c] p-5 flex flex-col shadow-sm hover:shadow-lg hover:border-blue-500/30 transition-all"
|
||||
variants={{ hidden: { opacity: 0, scale: 0.95 }, visible: { opacity: 1, scale: 1 } }}
|
||||
onMouseEnter={() => pasteIconRef.current?.playFromBeginning()}
|
||||
onMouseLeave={() => pasteIconRef.current?.goToFirstFrame()}
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<div className="p-2 rounded-lg bg-blue-500/20 text-blue-400">
|
||||
<LordIcon ref={pasteIconRef} url={pasteIconUrl} size={28} colorize="#3b82f6" />
|
||||
</div>
|
||||
<div className="font-mono text-white text-sm truncate">
|
||||
{paste.title || 'Untitled'}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-xs text-neutral-400 font-mono mb-3 line-clamp-3">
|
||||
{paste.content || 'No content'}
|
||||
</div>
|
||||
<div className="flex justify-between items-center mt-auto text-xs text-neutral-500">
|
||||
<span>{new Date(paste.createdAt).toLocaleString()}</span>
|
||||
<span className="px-2 py-0.5 rounded-full bg-blue-500/20 text-blue-400">
|
||||
{paste.views} views
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 mt-4">
|
||||
<a
|
||||
href={`/${paste.id}`}
|
||||
className="cursor-pointer px-3 py-1.5 rounded-lg bg-blue-600 text-white text-sm hover:bg-blue-500 transition-colors"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
View
|
||||
</a>
|
||||
<button
|
||||
onClick={() => onDelete(paste.id)}
|
||||
className="cursor-pointer px-3 py-1.5 rounded-lg bg-red-600 text-white text-sm hover:bg-red-500 transition-colors"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { Search } from "lucide-react";
|
||||
|
||||
export default function SearchBar({ value, onChange }: { value: string; onChange: (v: string) => void }) {
|
||||
return (
|
||||
<div className="relative w-full md:w-1/3 mb-8">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-neutral-500" size={18} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search by title..."
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
className="cursor-text w-full pl-10 pr-4 py-2 rounded-xl bg-[#0f1320]/70 text-white
|
||||
placeholder:text-neutral-500 outline-none ring-1 ring-white/10
|
||||
focus:ring-2 focus:ring-blue-500/50 transition-all"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import LogoutButton from "@/components/ui/LogoutButton";
|
||||
import { FileText } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
export default function Sidebar() {
|
||||
const pathname = usePathname();
|
||||
|
||||
const navItems = [
|
||||
{ label: "My Pastes", href: "/dashboard", icon: FileText },
|
||||
];
|
||||
|
||||
return (
|
||||
<aside className="hidden md:flex flex-col w-64 bg-[#11131c] border-r border-white/10 p-6">
|
||||
{/* Header */}
|
||||
<div className="mb-10">
|
||||
<h2 className="text-xl font-bold text-white">AltBin</h2>
|
||||
<p className="text-xs text-neutral-500">Dashboard</p>
|
||||
</div>
|
||||
|
||||
{/* Navigation */}
|
||||
<nav className="flex flex-col gap-2">
|
||||
{navItems.map(({ label, href, icon: Icon }) => {
|
||||
const active = pathname === href;
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors
|
||||
${
|
||||
active
|
||||
? "bg-blue-500/20 text-blue-400 border border-blue-500/30"
|
||||
: "text-neutral-400 hover:text-white hover:bg-white/5"
|
||||
}`}
|
||||
>
|
||||
<Icon size={18} />
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="mt-auto pt-6 border-t border-white/5">
|
||||
<LogoutButton />
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { useRef } from "react";
|
||||
import LordIcon from "./LordIcon";
|
||||
|
||||
export default function StatCard({
|
||||
label,
|
||||
value,
|
||||
icon,
|
||||
}: {
|
||||
label: string;
|
||||
value: any;
|
||||
icon: string;
|
||||
}) {
|
||||
const iconRef = useRef<any>(null);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
className="rounded-2xl bg-[#11131c] p-5 border border-white/10 hover:border-blue-500/40 transition-colors shadow-md"
|
||||
whileHover={{ scale: 1.03 }}
|
||||
onMouseEnter={() => iconRef.current?.playFromBeginning()}
|
||||
onMouseLeave={() => iconRef.current?.goToFirstFrame()}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="p-3 rounded-xl bg-blue-500/20 text-blue-400">
|
||||
<LordIcon ref={iconRef} url={icon} size={28} colorize="#3b82f6" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm text-neutral-400">{label}</div>
|
||||
<div className="text-xl font-bold text-white">{value}</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
"use client";
|
||||
|
||||
import * as Dialog from "@radix-ui/react-dialog";
|
||||
import { motion } from "framer-motion";
|
||||
import { X } from "lucide-react";
|
||||
|
||||
interface ConfirmDeleteModalProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onConfirm: () => void;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export default function ConfirmDeleteModal({
|
||||
open,
|
||||
onOpenChange,
|
||||
onConfirm,
|
||||
title = "Delete paste?",
|
||||
description = "This action cannot be undone. Are you sure you want to delete this paste?",
|
||||
}: ConfirmDeleteModalProps) {
|
||||
return (
|
||||
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
||||
<Dialog.Portal>
|
||||
{/* Overlay noir semi-transparent */}
|
||||
<Dialog.Overlay className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40" />
|
||||
|
||||
{/* Contenu centré */}
|
||||
<Dialog.Content asChild>
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.95 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.95 }}
|
||||
className="bg-[#11131c] rounded-2xl p-6 shadow-xl w-[90%] max-w-md border border-white/10"
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<Dialog.Title className="text-lg font-semibold text-white">
|
||||
{title}
|
||||
</Dialog.Title>
|
||||
<Dialog.Close className="text-neutral-400 hover:text-white">
|
||||
<X size={18} />
|
||||
</Dialog.Close>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<Dialog.Description className="text-sm text-neutral-400 mb-6">
|
||||
{description}
|
||||
</Dialog.Description>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex justify-end gap-3">
|
||||
<Dialog.Close asChild>
|
||||
<button className="cursor-pointer px-4 py-2 rounded-lg bg-neutral-700 text-white text-sm hover:bg-neutral-600 transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
</Dialog.Close>
|
||||
<button
|
||||
onClick={() => {
|
||||
onConfirm();
|
||||
onOpenChange(false);
|
||||
}}
|
||||
className="cursor-pointer px-4 py-2 rounded-lg bg-red-600 text-white text-sm hover:bg-red-500 transition-colors"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog.Root>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
"use client";
|
||||
|
||||
import { Info, Shield } from "lucide-react";
|
||||
import { signIn, signOut, useSession } from "next-auth/react";
|
||||
|
||||
export default function AuthSection() {
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
if (status === "loading") return null;
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-6 right-6 z-50 flex flex-col items-end gap-3 text-sm">
|
||||
{!session?.user ? (
|
||||
<div className="flex items-center gap-3">
|
||||
{/* Bouton About */}
|
||||
<a
|
||||
href="/about"
|
||||
className="cursor-pointer flex items-center gap-2 bg-[#0d1117] hover:bg-[#1c2230] border border-white/10 text-neutral-300 px-4 py-2 rounded-lg shadow-md transition-all"
|
||||
>
|
||||
<Info size={16} />
|
||||
<span>About</span>
|
||||
</a>
|
||||
|
||||
{/* Bouton Login */}
|
||||
<button
|
||||
onClick={() => signIn("discord")}
|
||||
className="cursor-pointer flex items-center gap-2 bg-[#0d1117] hover:bg-[#1c2230] border border-blue-500 text-blue-400 px-4 py-2 rounded-lg shadow-md transition-all"
|
||||
>
|
||||
<Shield className="animate-pulse" size={18} />
|
||||
<span>Login</span>
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-[#0d1117] border border-white/10 rounded-xl p-4 shadow-lg space-y-2 min-w-[220px]">
|
||||
<div className="flex items-center gap-2 text-green-400 font-medium">
|
||||
<Shield size={18} />
|
||||
<span>Connected as</span>
|
||||
<span className="truncate font-semibold text-white">
|
||||
{session.user.name || "User"}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between gap-2 mt-2">
|
||||
<a
|
||||
href="/dashboard"
|
||||
className="flex-1 text-center bg-blue-600 hover:bg-blue-500 text-white px-4 py-2 rounded-lg transition-colors"
|
||||
>
|
||||
Dashboard
|
||||
</a>
|
||||
<button
|
||||
onClick={() => signOut()}
|
||||
className="cursor-pointer flex-1 text-center bg-red-600 hover:bg-red-500 text-white px-4 py-2 rounded-lg transition-colors"
|
||||
>
|
||||
Logout
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
"use client";
|
||||
|
||||
import { ChevronRight } from "lucide-react";
|
||||
import { useRef } from "react";
|
||||
|
||||
interface EditorProps {
|
||||
content: string;
|
||||
setContent: (v: string) => void;
|
||||
}
|
||||
|
||||
export default function Editor({ content, setContent }: EditorProps) {
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
const lineNumbersRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const handleScroll = () => {
|
||||
if (lineNumbersRef.current && textareaRef.current) {
|
||||
lineNumbersRef.current.scrollTop = textareaRef.current.scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex w-full h-full overflow-hidden font-mono text-sm text-white">
|
||||
{/* Numéros de lignes */}
|
||||
<div
|
||||
ref={lineNumbersRef}
|
||||
className="flex flex-col items-end pr-4 pl-3 pt-6 text-neutral-600 select-none shrink-0 overflow-hidden"
|
||||
>
|
||||
{content.split("\n").map((_, i) => (
|
||||
<div key={i} className="flex items-center gap-2 leading-6 tabular-nums">
|
||||
{i === 0 && <ChevronRight size={14} className="text-blue-400 opacity-0" />}
|
||||
<span>{i + 1}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Zone d’édition */}
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
onScroll={handleScroll}
|
||||
placeholder={`Insert or paste your content here...\n\n// Supported content types:\n// – Source code (any language)\n// – Config files\n// – Text documents\n// – Logs and debug output\n\nShortcut: Ctrl+S (or Cmd+S) to save your paste`}
|
||||
className="w-full flex-1 bg-transparent text-white resize-none outline-none py-6 pr-4 pl-0 caret-blue-400 placeholder:text-sm placeholder:text-gray-500 leading-6 whitespace-pre overflow-auto"
|
||||
aria-label="Paste editor"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { Lock } from "lucide-react";
|
||||
|
||||
export default function SaveButton({
|
||||
handleSave,
|
||||
isSaving,
|
||||
content,
|
||||
}: {
|
||||
handleSave: () => void;
|
||||
isSaving: boolean;
|
||||
content: string;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
onClick={handleSave}
|
||||
disabled={!content.trim() || isSaving}
|
||||
className={`mt-6 w-full flex items-center justify-center gap-2 rounded-xl py-2 text-sm font-medium
|
||||
${!content.trim() || isSaving
|
||||
? "bg-[#151826] text-neutral-500 ring-1 ring-white/10 cursor-not-allowed"
|
||||
: "bg-gradient-to-b from-[#1b2135] to-[#141a2a] text-white ring-1 ring-white/10 hover:from-[#232a41] hover:to-[#161d2f]"}
|
||||
`}
|
||||
>
|
||||
<Lock size={16} />
|
||||
<span>Save Paste</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
"use client";
|
||||
|
||||
import SaveButton from "@/components/paste-form/SaveButton";
|
||||
import { ChevronDown, ChevronRight, Eye, Lock, Plus, Settings } from "lucide-react";
|
||||
|
||||
interface SidebarPanelProps {
|
||||
title: string;
|
||||
setTitle: (v: string) => void;
|
||||
maxViews: string;
|
||||
setMaxViews: (v: string) => void;
|
||||
password: string;
|
||||
setPassword: (v: string) => void;
|
||||
content: string;
|
||||
isSaving: boolean;
|
||||
handleSave: () => void;
|
||||
advanced: boolean;
|
||||
setAdvanced: (v: boolean) => void;
|
||||
}
|
||||
|
||||
export default function SidebarPanel({
|
||||
title,
|
||||
setTitle,
|
||||
maxViews,
|
||||
setMaxViews,
|
||||
password,
|
||||
setPassword,
|
||||
content,
|
||||
isSaving,
|
||||
handleSave,
|
||||
advanced,
|
||||
setAdvanced,
|
||||
}: SidebarPanelProps) {
|
||||
return (
|
||||
<aside className="absolute top-4 right-4 w-[300px] rounded-2xl p-5 text-sm z-10 backdrop-blur-xl shadow-2xl bg-[linear-gradient(to_bottom_right,rgba(20,24,38,0.9),rgba(14,16,24,0.9))] ring-1 ring-white/10 mr-4">
|
||||
<h2 className="text-lg font-bold text-center">
|
||||
Alt<span className="text-blue-400">Bin</span>
|
||||
</h2>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="mt-4 flex items-center justify-center gap-2">
|
||||
<button
|
||||
onClick={handleSave}
|
||||
disabled={!content.trim() || isSaving}
|
||||
className="inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-semibold bg-green-600 text-white shadow-sm hover:bg-green-500 disabled:opacity-50"
|
||||
>
|
||||
<Plus size={14} /> CREATE
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setAdvanced(!advanced)}
|
||||
className="inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-medium bg-[#0f1320]/70 text-neutral-200 ring-1 ring-white/15 hover:bg-[#151a2a] hover:ring-white/25"
|
||||
>
|
||||
<Settings size={14} />
|
||||
<span>Advanced</span>
|
||||
{advanced ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Options avancées */}
|
||||
{advanced && (
|
||||
<div className="space-y-6 mt-4">
|
||||
{/* Title */}
|
||||
<div>
|
||||
<label className="block text-[11px] font-semibold text-neutral-400 mb-2">Title</label>
|
||||
<input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="Optional title"
|
||||
className="w-full rounded-xl bg-[#0f1320]/60 px-4 py-2 text-white ring-1 ring-white/10"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Max Views */}
|
||||
<div>
|
||||
<label className="flex items-center gap-2 text-[11px] font-semibold text-neutral-400 mb-2">
|
||||
<Eye size={14} /> Max Views
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={maxViews}
|
||||
onChange={(e) => setMaxViews(e.target.value)}
|
||||
placeholder="∞"
|
||||
className="w-full rounded-xl bg-[#0f1320]/60 px-4 py-2 text-white ring-1 ring-white/10"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Password */}
|
||||
<div>
|
||||
<label className="flex items-center gap-2 text-[11px] font-semibold text-neutral-400 mb-2">
|
||||
<Lock size={14} /> Password
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder="Optional password"
|
||||
className="w-full rounded-xl bg-[#0f1320]/60 px-4 py-2 text-white ring-1 ring-white/10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Save principal */}
|
||||
<SaveButton
|
||||
handleSave={handleSave}
|
||||
isSaving={isSaving}
|
||||
content={content}
|
||||
/>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { LogOut } from "lucide-react";
|
||||
import { signOut } from "next-auth/react";
|
||||
|
||||
export default function LogOutButton() {
|
||||
return (
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
onClick={() => signOut()}
|
||||
className="cursor-pointer group inline-flex items-center gap-2 px-6 py-3 rounded-xl text-base font-medium
|
||||
text-white bg-gradient-to-r from-red-600 to-red-500 shadow-lg shadow-red-500/30
|
||||
hover:shadow-red-500/50 transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-red-400/60"
|
||||
>
|
||||
<LogOut
|
||||
size={20}
|
||||
className="text-red-200 group-hover:-rotate-90 transition-transform duration-300"
|
||||
/>
|
||||
<span>LogOut</span>
|
||||
</motion.button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
export default function ToasterProvider() {
|
||||
return (
|
||||
<Toaster
|
||||
position="top-right"
|
||||
toastOptions={{
|
||||
style: {
|
||||
background: "#11131c",
|
||||
color: "#fff",
|
||||
border: "1px solid #2a2f3a",
|
||||
},
|
||||
success: {
|
||||
iconTheme: {
|
||||
primary: "#22c55e", // green
|
||||
secondary: "#11131c",
|
||||
},
|
||||
},
|
||||
error: {
|
||||
iconTheme: {
|
||||
primary: "#ef4444", // red
|
||||
secondary: "#11131c",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export function formatBytes(bytes: number, decimals = 1): string {
|
||||
if (bytes === 0) return "0 Bytes";
|
||||
const k = 1024;
|
||||
const units = ["Bytes", "KB", "MB", "GB"];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${units[i]}`;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined;
|
||||
};
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ?? new PrismaClient();
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
||||
@@ -0,0 +1,50 @@
|
||||
import { prisma } from '@/lib/prisma';
|
||||
|
||||
export async function getDashboardStats(userId?: string) {
|
||||
const filter = userId ? { where: { createdBy: userId } } : {};
|
||||
|
||||
const [totalPastes, totalViews, recentPastes, apiUsage, storageUsed, avgViews, mostViewed, avgSize] = await Promise.all([
|
||||
prisma.paste.count(filter),
|
||||
prisma.paste.aggregate({ _sum: { views: true }, ...filter }),
|
||||
prisma.paste.count({
|
||||
where: {
|
||||
createdAt: { gte: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) },
|
||||
...(userId ? { createdBy: userId } : {}),
|
||||
},
|
||||
}),
|
||||
prisma.paste.count({ where: { createdBy: { not: null } } }),
|
||||
prisma.paste.aggregate({ _sum: { size: true }, ...filter }),
|
||||
prisma.paste.aggregate({ _avg: { views: true }, ...filter }),
|
||||
prisma.paste.findFirst({
|
||||
orderBy: { views: 'desc' },
|
||||
select: { views: true },
|
||||
...(userId ? { where: { createdBy: userId } } : {}),
|
||||
}),
|
||||
prisma.paste.aggregate({ _avg: { size: true }, ...filter }),
|
||||
]);
|
||||
|
||||
return {
|
||||
totalPastes,
|
||||
totalViews: totalViews._sum.views || 0,
|
||||
recentPastes,
|
||||
apiUsage,
|
||||
storageUsed: storageUsed._sum.size || 0,
|
||||
avgViews: Number(avgViews._avg.views?.toFixed(1)) || 0,
|
||||
mostViewed: mostViewed?.views || 0,
|
||||
avgSize: avgSize._avg.size || 0,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getUserPastes(userId: string) {
|
||||
return await prisma.paste.findMany({
|
||||
where: { createdBy: userId },
|
||||
orderBy: { createdAt: 'desc' },
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
views: true,
|
||||
title: true,
|
||||
content: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -9,17 +9,40 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lordicon/react": "^1.11.0",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"@prisma/client": "^6.14.0",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@tailwindcss/postcss": "^4.1.11",
|
||||
"bcryptjs": "^3.0.2",
|
||||
"date-fns": "^4.1.0",
|
||||
"framer-motion": "^12.23.12",
|
||||
"highlight.js": "^11.11.1",
|
||||
"lottie-web": "^5.13.0",
|
||||
"lucide-react": "^0.539.0",
|
||||
"nanoid": "^5.1.5",
|
||||
"next": "15.4.6",
|
||||
"next-auth": "^4.24.11",
|
||||
"next-themes": "^0.4.6",
|
||||
"postcss": "^8.5.6",
|
||||
"prism-react-renderer": "^2.4.1",
|
||||
"prisma": "^6.14.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"next": "15.4.6"
|
||||
"react-hot-toast": "^2.6.0",
|
||||
"react-icons": "^5.5.0",
|
||||
"shiki": "^3.9.2",
|
||||
"tailwindcss": "^4.1.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@eslint/eslintrc": "^3",
|
||||
"@types/node": "^20",
|
||||
"@types/prismjs": "^1.26.5",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.4.6",
|
||||
"@eslint/eslintrc": "^3"
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
};
|
||||
export default config;
|
||||
@@ -0,0 +1,12 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Paste" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"title" TEXT,
|
||||
"content" TEXT NOT NULL,
|
||||
"password" TEXT,
|
||||
"maxViews" INTEGER,
|
||||
"views" INTEGER NOT NULL DEFAULT 0,
|
||||
"size" INTEGER,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"createdBy" TEXT
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "sqlite"
|
||||
@@ -0,0 +1,28 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:./altbin.db"
|
||||
}
|
||||
|
||||
model Paste {
|
||||
id String @id @default(cuid())
|
||||
title String?
|
||||
content String
|
||||
password String?
|
||||
maxViews Int?
|
||||
views Int @default(0)
|
||||
size Int?
|
||||
createdAt DateTime @default(now())
|
||||
createdBy String?
|
||||
|
||||
dummyId String?
|
||||
dummy Dummy? @relation(fields: [dummyId], references: [id])
|
||||
}
|
||||
|
||||
model Dummy {
|
||||
id String @id @default(cuid())
|
||||
pastes Paste[]
|
||||
}
|
||||
|
After Width: | Height: | Size: 26 KiB |
@@ -1 +0,0 @@
|
||||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 391 B |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
Before Width: | Height: | Size: 128 B |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
Before Width: | Height: | Size: 385 B |
@@ -0,0 +1,16 @@
|
||||
import "next-auth";
|
||||
|
||||
declare module "next-auth" {
|
||||
interface Session {
|
||||
user: {
|
||||
id: string;
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
image?: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface User {
|
||||
id: string;
|
||||
}
|
||||
}
|
||||