Fix pnpm build

This commit is contained in:
UltraLionFr
2025-08-20 16:41:27 +02:00
parent 3de3e6f35a
commit 9730e21999
16 changed files with 134 additions and 83 deletions
+2 -1
View File
@@ -1,12 +1,13 @@
"use client";
import type { Player } from "@lordicon/react";
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 plusIconRef = useRef<Player | null>(null);
const router = useRouter();
return (
+7 -4
View File
@@ -1,19 +1,22 @@
"use client";
import { Player } from "@lordicon/react";
import { forwardRef, useEffect, useState } from "react";
import { forwardRef, useEffect, useState, type ForwardedRef } from "react";
const LordIcon = forwardRef(function LordIcon(
{ url, size = 28, colorize = "#3b82f6" }: { url: string; size?: number; colorize?: string },
ref: any
ref: ForwardedRef<Player>
) {
const [iconData, setIconData] = useState<any>(null);
const [iconData, setIconData] = useState<Record<string, unknown> | null>(null);
useEffect(() => {
fetch(url).then((res) => res.json()).then(setIconData);
fetch(url)
.then((res) => res.json())
.then((data: Record<string, unknown>) => setIconData(data));
}, [url]);
if (!iconData) return null;
return <Player ref={ref} icon={iconData} size={size} colorize={colorize} />;
});
+13 -4
View File
@@ -1,19 +1,28 @@
"use client";
import type { Player } from "@lordicon/react";
import { motion } from "framer-motion";
import { useRef } from "react";
import LordIcon from "./LordIcon";
interface Paste {
id: string;
title: string | null;
content: string | null;
createdAt: string | Date;
views: number;
}
export default function PasteCard({
paste,
onDelete,
pasteIconUrl,
}: {
paste: any;
paste: Paste;
onDelete: (id: string) => void;
pasteIconUrl: string;
}) {
const pasteIconRef = useRef<any>(null);
const pasteIconRef = useRef<Player | null>(null);
return (
<motion.div
@@ -27,11 +36,11 @@ export default function PasteCard({
<LordIcon ref={pasteIconRef} url={pasteIconUrl} size={28} colorize="#3b82f6" />
</div>
<div className="font-mono text-white text-sm truncate">
{paste.title || 'Untitled'}
{paste.title || "Untitled"}
</div>
</div>
<div className="text-xs text-neutral-400 font-mono mb-3 line-clamp-3">
{paste.content || 'No content'}
{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>
+4 -3
View File
@@ -1,5 +1,6 @@
"use client";
import type { Player } from "@lordicon/react";
import { motion } from "framer-motion";
import { useRef } from "react";
import LordIcon from "./LordIcon";
@@ -10,10 +11,10 @@ export default function StatCard({
icon,
}: {
label: string;
value: any;
value: string | number | null;
icon: string;
}) {
const iconRef = useRef<any>(null);
const iconRef = useRef<Player | null>(null);
return (
<motion.div
@@ -28,7 +29,7 @@ export default function StatCard({
</div>
<div>
<div className="text-sm text-neutral-400">{label}</div>
<div className="text-xl font-bold text-white">{value}</div>
<div className="text-xl font-bold text-white">{value ?? "—"}</div>
</div>
</div>
</motion.div>
+5 -4
View File
@@ -2,6 +2,7 @@
import { Info, Shield } from "lucide-react";
import { signIn, signOut, useSession } from "next-auth/react";
import Link from "next/link";
export default function AuthSection() {
const { data: session, status } = useSession();
@@ -13,13 +14,13 @@ export default function AuthSection() {
{!session?.user ? (
<div className="flex items-center gap-3">
{/* Bouton About */}
<a
<Link
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>
</Link>
{/* Bouton Login */}
<button
@@ -41,12 +42,12 @@ export default function AuthSection() {
</div>
<div className="flex justify-between gap-2 mt-2">
<a
<Link
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>
</Link>
<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"
+8 -3
View File
@@ -11,11 +11,13 @@ import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
import 'prismjs/themes/prism-tomorrow.css';
import { useEffect, useRef } from 'react';
import { Paste } from '@/types/paste';
export default function CodeViewer({
paste,
language,
}: {
paste: any;
paste: Paste;
language: string;
}) {
const codeRef = useRef<HTMLPreElement | null>(null);
@@ -28,11 +30,14 @@ export default function CodeViewer({
return (
<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">
<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>
);
}
}
+5 -2
View File
@@ -8,9 +8,12 @@ export default function PasswordForm({
return (
<div className="h-screen w-screen bg-[#0e0f13] flex items-center justify-center text-white">
<form
onSubmit={(e) => {
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const pwd = (e.currentTarget as any).password.value;
const form = e.currentTarget as HTMLFormElement & {
password: { value: string };
};
const pwd = form.password.value;
onSubmit(pwd);
}}
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"
+2 -1
View File
@@ -1,10 +1,11 @@
'use client';
import type { Paste } from "@/types/paste";
import { CalendarDays, Copy, Download, Eye, FileText, Plus } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function PasteSidebar({ paste, id }: { paste: any; id: string }) {
export default function PasteSidebar({ paste, id }: { paste: Paste; id: string }) {
const [copied, setCopied] = useState(false);
const router = useRouter();