صفحهٔ ۴۰۳
پیشنمایش تمامصفحهدسترسی ندارید، همسبکِ ۴۰۴ و ۵۰۲: تابلوی خطیِ آویزان با قفل، متنِ صمیمی، درخواستِ دسترسی، بازگشت به خانه و ورود با حسابِ دیگر.
۱. نصب کامپوننتها
این بلاک از ۴ آیتم دیگ استفاده میکند: buttoncontrol-sizelinktoast
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 https://docs.digdesign.ir/r/toast.jsonpnpm 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 https://docs.digdesign.ir/r/toast.jsonyarn 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 https://docs.digdesign.ir/r/toast.jsonbunx --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 https://docs.digdesign.ir/r/toast.jsonnpx digdesign@latest add button control-size link toast --framework vuepnpm dlx digdesign@latest add button control-size link toast --framework vueyarn dlx digdesign@latest add button control-size link toast --framework vuebunx --bun digdesign@latest add button control-size link toast --framework vuenpx digdesign@latest add button --framework sveltepnpm dlx digdesign@latest add button --framework svelteyarn dlx digdesign@latest add button --framework sveltebunx --bun digdesign@latest add button --framework sveltenpx digdesign@latest add button control-size link toast --framework angularpnpm dlx digdesign@latest add button control-size link toast --framework angularyarn dlx digdesign@latest add button control-size link toast --framework angularbunx --bun digdesign@latest add button control-size link toast --framework angularnpx digdesign@latest add button control-size link toast --framework androidpnpm dlx digdesign@latest add button control-size link toast --framework androidyarn dlx digdesign@latest add button control-size link toast --framework androidbunx --bun digdesign@latest add button control-size link toast --framework android۲. کد صفحه
کد را در صفحهٔ پروژهتان بگذارید (React: app/<route>/page.tsx) و متنها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریمورک کدِ همین صفحه در فریمورک دیگر را ببینید.
"use client"
import * as React from "react"
import NextLink from "next/link"
import { Button } from "@/components/ui/button"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { Link } from "@/components/ui/link"
import { toast } from "@/components/ui/toast"
/**
* تصویرِ خطی تابلوی آویزان، همخانوادهٔ صفحههای ۴۰۴ و ۵۰۲؛ فقط رنگِ متن و
* پسزمینهٔ تم، پس در حالتِ تیره هم درست است. محتوای وسطِ تابلو را children میدهد.
*/
function HangingSign({ label, className, children }: { label: string; className?: string; children: React.ReactNode }) {
return (
<svg viewBox="-10 0 320 290" role="img" aria-label={label} className={className}>
<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" />
<path d="M150 30 96 108M150 30l58 78" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" />
<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="208" cy="112" r="3.2" fill="var(--background)" stroke="currentColor" strokeWidth="1.75" />
<rect x="56" y="134" width="196" height="94" fill="currentColor" />
{children}
</svg>
)
}
/** صفحهٔ ۴۰۳ (دسترسی ندارید)؛ همسبکِ ۴۰۴ و ۵۰۲، با راهِ درخواستِ دسترسی. */
export default function ForbiddenBlock() {
const [requested, setRequested] = React.useState(false)
return (
<ControlSizeProvider size="xl" asChild>
<main className="flex min-h-svh flex-col items-center justify-center gap-8 p-6 text-center">
<HangingSign label="تابلوی ۴۰۳ با قفل" className="w-64 max-w-full text-foreground sm:w-80">
{/* قفل در وسطِ تابلو */}
<rect x="132" y="170" width="44" height="36" rx="5" fill="var(--background)" />
<path d="M140 170v-9a14 14 0 0 1 28 0v9" fill="none" stroke="var(--background)" strokeWidth="5" strokeLinecap="round" />
<circle cx="154" cy="186" r="4" fill="currentColor" />
<path d="M154 189v7" stroke="currentColor" strokeWidth="3" strokeLinecap="round" />
<text x="214" y="160" textAnchor="middle" fontSize="18" fontWeight="800" fill="var(--background)">۴۰۳</text>
</HangingSign>
<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
disabled={requested}
onClick={() => {
setRequested(true)
toast.success("درخواستت برای مدیر فرستاده شد.")
}}
>
{requested ? "درخواست فرستاده شد" : "درخواستِ دسترسی"}
</Button>
<Button asChild variant="outline">
<NextLink href="/">برگردیم خونه</NextLink>
</Button>
</div>
<p className="text-sm text-muted-foreground">
با حسابِ اشتباه اومدی؟ <Link href="/login">با حسابِ دیگه وارد شو</Link>
</p>
</main>
</ControlSizeProvider>
)
}
<script setup lang="ts">
import { ref } from "vue"
import Button from "@/components/ui/Button.vue"
import ControlSize from "@/components/ui/ControlSize.vue"
import Link from "@/components/ui/Link.vue"
import { toast } from "@/components/ui/Toast.vue"
/** صفحهٔ ۴۰۳ (دسترسی ندارید)؛ همسبکِ ۴۰۴ و ۵۰۲، با راهِ درخواستِ دسترسی. */
const requested = ref(false)
function requestAccess() {
requested.value = true
toast.success("درخواستت برای مدیر فرستاده شد.")
}
</script>
<template>
<ControlSize size="xl" as-child>
<main class="flex min-h-svh flex-col items-center justify-center gap-8 p-6 text-center">
<svg viewBox="-10 0 320 290" role="img" aria-label="تابلوی ۴۰۳ با قفل" class="w-64 max-w-full text-foreground sm:w-80">
<circle cx="150" cy="26" r="6" fill="var(--background)" stroke="currentColor" stroke-width="2" />
<path d="M150 20v-8" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
<path d="M150 30 96 108M150 30l58 78" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" />
<path d="M58 114h200v122H58z" transform="translate(8 7)" fill="var(--background)" stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
<path d="M258 114l8 7v122l-8-7M58 236l8 7h200" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
<rect x="50" y="108" width="208" height="126" fill="var(--background)" stroke="currentColor" stroke-width="2" />
<path d="M50 128h208" stroke="currentColor" stroke-width="2" />
<path d="M60 114h10M60 118h10M60 122h10" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" />
<circle cx="236" cy="118" r="2.6" fill="none" stroke="currentColor" stroke-width="1.6" />
<circle cx="246" cy="118" r="2.6" fill="none" stroke="currentColor" stroke-width="1.6" />
<circle cx="96" cy="112" r="3.2" fill="var(--background)" stroke="currentColor" stroke-width="1.75" />
<circle cx="208" cy="112" r="3.2" fill="var(--background)" stroke="currentColor" stroke-width="1.75" />
<rect x="56" y="134" width="196" height="94" fill="currentColor" />
<rect x="132" y="170" width="44" height="36" rx="5" fill="var(--background)" />
<path d="M140 170v-9a14 14 0 0 1 28 0v9" fill="none" stroke="var(--background)" stroke-width="5" stroke-linecap="round" />
<circle cx="154" cy="186" r="4" fill="currentColor" />
<path d="M154 189v7" stroke="currentColor" stroke-width="3" stroke-linecap="round" />
<text x="214" y="160" text-anchor="middle" font-size="18" font-weight="800" fill="var(--background)">۴۰۳</text>
</svg>
<div class="flex max-w-md flex-col items-center gap-3">
<h1 class="text-3xl leading-snug font-bold">این در قفله!</h1>
<p class="leading-7 text-muted-foreground">
برای دیدنِ این صفحه دسترسی نداری. از مدیرِ فضای کار بخواه دسترسی بده، یا با حسابِ دیگهای وارد شو.
</p>
</div>
<div class="flex flex-wrap justify-center gap-3">
<Button :disabled="requested" @click="requestAccess">
{{ requested ? "درخواست فرستاده شد" : "درخواستِ دسترسی" }}
</Button>
<Button as-child variant="outline">
<a href="/">برگردیم خونه</a>
</Button>
</div>
<p class="text-sm text-muted-foreground">
با حسابِ اشتباه اومدی؟ <Link href="/login">با حسابِ دیگه وارد شو</Link>
</p>
</main>
</ControlSize>
</template>
کدِ این بلاک هنوز برای Svelte نوشته نشده است.
این موارد هنوز برای Svelte آماده نیستند: control-sizelinktoast
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="svelte" ایجنت آن را با کامپوننتهای Svelte میسازد.
import { ChangeDetectionStrategy, Component, signal } from "@angular/core"
import { DigButton } from "@/components/ui/button"
import { DigControlSize } from "@/components/ui/control-size"
import { DigLink } from "@/components/ui/link"
import { DigToaster, toast } from "@/components/ui/toast"
@Component({
selector: "dig-block-forbidden",
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [DigButton, DigControlSize, DigLink, DigToaster],
template: `
<main
digControlSize="xl"
class="flex min-h-svh flex-col items-center justify-center gap-8 p-6 text-center"
>
<svg
viewBox="-10 0 320 290"
role="img"
aria-label="تابلوی ۴۰۳ با قفل"
class="w-64 max-w-full text-foreground sm:w-80"
>
<circle
cx="150"
cy="26"
r="6"
fill="var(--background)"
stroke="currentColor"
strokeWidth="2"
></circle>
<path
d="M150 20v-8"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
></path>
<path
d="M150 30 96 108M150 30l58 78"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
></path>
<path
d="M58 114h200v122H58z"
transform="translate(8 7)"
fill="var(--background)"
stroke="currentColor"
strokeWidth="2"
strokeLinejoin="round"
></path>
<path
d="M258 114l8 7v122l-8-7M58 236l8 7h200"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinejoin="round"
></path>
<rect
x="50"
y="108"
width="208"
height="126"
fill="var(--background)"
stroke="currentColor"
strokeWidth="2"
></rect>
<path d="M50 128h208" stroke="currentColor" strokeWidth="2"></path>
<path
d="M60 114h10M60 118h10M60 122h10"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
></path>
<circle
cx="236"
cy="118"
r="2.6"
fill="none"
stroke="currentColor"
strokeWidth="1.6"
></circle>
<circle
cx="246"
cy="118"
r="2.6"
fill="none"
stroke="currentColor"
strokeWidth="1.6"
></circle>
<circle
cx="96"
cy="112"
r="3.2"
fill="var(--background)"
stroke="currentColor"
strokeWidth="1.75"
></circle>
<circle
cx="208"
cy="112"
r="3.2"
fill="var(--background)"
stroke="currentColor"
strokeWidth="1.75"
></circle>
<rect x="56" y="134" width="196" height="94" fill="currentColor"></rect>
<rect
x="132"
y="170"
width="44"
height="36"
rx="5"
fill="var(--background)"
></rect>
<path
d="M140 170v-9a14 14 0 0 1 28 0v9"
fill="none"
stroke="var(--background)"
strokeWidth="5"
strokeLinecap="round"
></path>
<circle cx="154" cy="186" r="4" fill="currentColor"></circle>
<path
d="M154 189v7"
stroke="currentColor"
strokeWidth="3"
strokeLinecap="round"
></path>
<text
x="214"
y="160"
textAnchor="middle"
fontSize="18"
fontWeight="800"
fill="var(--background)"
>
۴۰۳
</text>
</svg>
<div class="flex max-w-md flex-col items-center gap-3">
<h1 class="text-3xl leading-snug font-bold">این در قفله!</h1>
<p class="leading-7 text-muted-foreground">
برای دیدنِ این صفحه دسترسی نداری. از مدیرِ فضای کار بخواه دسترسی بده،
یا با حسابِ دیگهای وارد شو.
</p>
</div>
<div class="flex flex-wrap justify-center gap-3">
<button
digButton
type="button"
[disabled]="requested()"
(click)="requestAccess()"
>
{{ requested() ? "درخواست فرستاده شد" : "درخواستِ دسترسی" }}
</button>
<a digButton variant="outline" href="/">برگردیم خونه</a>
</div>
<p class="text-sm text-muted-foreground">
با حسابِ اشتباه اومدی؟
<a digLink href="/login">با حسابِ دیگه وارد شو</a>
</p>
</main>
<div digToaster></div>
`,
})
export class ForbiddenBlock {
readonly requested = signal(false)
requestAccess() {
// Replace this demo handler with your access request.
this.requested.set(true)
toast.success("درخواستت برای مدیر فرستاده شد.")
}
}
کدِ این بلاک هنوز برای Android نوشته نشده است.
همهٔ کامپوننتهای لازم برای Android آمادهاند؛ با MCP میتوانید همین صفحه را از روی نسخهٔ React بسازید.
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="android" ایجنت آن را با کامپوننتهای Android میسازد.