Update code
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user