Fix pnpm build
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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} />;
|
||||
});
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user