بلاک‌ها · پنل مدیریت

صفحهٔ پیدا نشد با تصویرِ خطیِ تابلوی آویزانِ ۴۰۴ (هماهنگ با حالتِ تیره) و راه بازگشت.

۱. نصب کامپوننت‌ها

این بلاک از ۳ آیتم دیگ استفاده می‌کند: buttoncontrol-sizelink

پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/link.json
pnpm dlx digdesign@latest add https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/link.json
yarn dlx digdesign@latest add https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/link.json
bunx --bun digdesign@latest add https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/link.json

۲. کد صفحه

کد را در app/<route>/page.tsx بگذارید و متن‌ها، داده و هندلرها را با محصول خودتان عوض کنید.

not-found.tsx
"use client"

import NextLink from "next/link"

import { Button } from "@/components/ui/button"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { Link } from "@/components/ui/link"

/**
 * تصویرِ خطی تابلوی آویزان؛ فقط رنگِ متن و پس‌زمینهٔ تم، پس در حالتِ تیره هم درست است.
 */
function HangingSign({ className }: { className?: string }) {
  return (
    <svg viewBox="0 0 300 250" role="img" aria-label="تابلوی آویزانِ ۴۰۴" className={className}>
      {/* میخ و دو بند */}
      <path d="M150 30 96 109M150 30l62 79" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" />
      <circle cx="150" cy="26" r="6" fill="var(--background)" stroke="currentColor" strokeWidth="2" />
      <path d="M150 20v-8" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
      <g>

        {/* عمقِ تابلو: لایهٔ پشتی با فاصله، مثلِ برش‌های خطی نمونه */}
        <path d="M58 114h200v122H58z" transform="translate(8 7)" fill="var(--background)" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
        <path d="M258 114l8 7v122l-8-7M58 236l8 7h200" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" />
        {/* بدنهٔ پنجره */}
        <rect x="50" y="108" width="208" height="126" fill="var(--background)" stroke="currentColor" strokeWidth="2" />
        <path d="M50 128h208" stroke="currentColor" strokeWidth="2" />
        {/* سربرگ: منو و دو دایره، و حلقه‌های بند */}
        <path d="M60 114h10M60 118h10M60 122h10" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" />
        <circle cx="236" cy="118" r="2.6" fill="none" stroke="currentColor" strokeWidth="1.6" />
        <circle cx="246" cy="118" r="2.6" fill="none" stroke="currentColor" strokeWidth="1.6" />
        <circle cx="96" cy="112" r="3.2" fill="var(--background)" stroke="currentColor" strokeWidth="1.75" />
        <circle cx="212" cy="112" r="3.2" fill="var(--background)" stroke="currentColor" strokeWidth="1.75" />
        <rect x="56" y="134" width="196" height="94" fill="currentColor" />
        <text x="154" y="198" textAnchor="middle" fontSize="54" fontWeight="800" fill="var(--background)">۴۰۴</text>
      </g>
    </svg>
  )
}

/** صفحهٔ ۴۰۴؛ در Next.js همین را در app/not-found.tsx بگذارید. */
export default function NotFoundBlock() {
  return (
    <ControlSizeProvider size="xl" asChild>
    <main className="flex min-h-svh flex-col items-center justify-center gap-8 p-6 text-center">
      <HangingSign className="w-64 max-w-full text-foreground sm:w-80" />
      <div className="flex max-w-md flex-col items-center gap-3">
        <h1 className="text-3xl leading-snug font-bold">اِ… انگار گم شدیم!</h1>
        <p className="leading-7 text-muted-foreground">
          این صفحه رو پیدا نکردیم. شاید آدرس یه کم اشتباه تایپ شده، یا صفحه جاش عوض شده.
        </p>
      </div>
      <div className="flex flex-wrap justify-center gap-3">
        <Button asChild>
          <NextLink href="/">برگردیم خونه</NextLink>
        </Button>
        <Button asChild variant="outline">
          <NextLink href="/help">مرکز راهنما</NextLink>
        </Button>
      </div>
      <p className="text-sm text-muted-foreground">
        فکر می‌کنی تقصیر ماست؟ <Link href="/support">بهمون بگو</Link>.
      </p>
    </main>
    </ControlSizeProvider>
  )
}