پیگیریِ زندهٔ پیک
پیشنمایش تمامصفحهنقشهٔ تمامصفحه با کارتِ پایینی: زمانِ رسیدنِ درشت، نوارِ مسیر، پیک با عکس و پلاک، پیام و تماس؛ برای غذا و تحویلِ فوری.
۱. نصب کامپوننتها
این بلاک از ۵ آیتم دیگ استفاده میکند: avatarbuttoncontrol-sizeiconsprogress
npx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/progress.jsonpnpm dlx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/progress.jsonyarn dlx digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/progress.jsonbunx --bun digdesign@latest add https://docs.digdesign.ir/r/avatar.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/progress.jsonnpx digdesign@latest add avatar button control-size progress --framework vuepnpm dlx digdesign@latest add avatar button control-size progress --framework vueyarn dlx digdesign@latest add avatar button control-size progress --framework vuebunx --bun digdesign@latest add avatar button control-size progress --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 avatar button control-size icons progress --framework angularpnpm dlx digdesign@latest add avatar button control-size icons progress --framework angularyarn dlx digdesign@latest add avatar button control-size icons progress --framework angularbunx --bun digdesign@latest add avatar button control-size icons progress --framework angularnpx digdesign@latest add avatar button control-size progress --framework androidpnpm dlx digdesign@latest add avatar button control-size progress --framework androidyarn dlx digdesign@latest add avatar button control-size progress --framework androidbunx --bun digdesign@latest add avatar button control-size progress --framework android۲. کد صفحه
کد را در صفحهٔ پروژهتان بگذارید (React: app/<route>/page.tsx) و متنها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریمورک کدِ همین صفحه در فریمورک دیگر را ببینید.
"use client"
import { ChatIcon, PhoneIcon } from "@/components/icons"
import { Avatar } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { Progress } from "@/components/ui/progress"
import { stockImages } from "@/lib/stock-images"
/**
* پیگیری زندهٔ پیک: نقشهٔ تمامصفحه و کارتِ پایینی ثابت با زمانِ رسیدنِ درشت، نوارِ پیشرفت،
* پیک با عکس و پلاک، و تماس یا پیام؛ برای سفارشِ غذا و تحویلِ فوری.
*/
export default function OrderTrackingLiveBlock() {
return (
<ControlSizeProvider size="xl" asChild>
<main className="relative mx-auto flex min-h-svh w-full max-w-md flex-col overflow-hidden bg-subtle">
<h1 className="sr-only">پیگیری پیک</h1>
{/* eslint-disable-next-line @next/next/no-img-element -- نقشهٔ تزئینی؛ در محصول نقشهٔ واقعی میآید */}
<img src="/blocks/contact-map.svg" alt="مسیرِ پیک روی نقشه" className="dark:brightness-[0.75] absolute inset-0 size-full object-cover" />
<section aria-live="polite" className="relative mt-auto flex flex-col gap-5 rounded-t-xl bg-card p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-card">
<div className="flex items-end justify-between gap-3">
<div className="flex flex-col">
<span className="text-sm text-muted-foreground">رسیدن تا</span>
<span className="text-3xl font-black tabular-nums">۱۲ دقیقه</span>
</div>
<span className="text-sm text-muted-foreground">۲٫۴ کیلومتر مانده</span>
</div>
<Progress value={70} aria-label="پیشرفتِ مسیر" color="success" />
<div className="flex items-center gap-3 rounded-xl bg-subtle p-3">
<Avatar size="lg" alt="" src={stockImages.personMan2.src} />
<span className="flex flex-1 flex-col">
<span className="font-semibold">علی کاظمی</span>
<span className="text-sm text-muted-foreground">موتور · ۲۲۴ ایران ۱۱</span>
</span>
<Button variant="outline" size="icon" aria-label="پیام به پیک" className="bg-card">
<ChatIcon />
</Button>
<Button size="icon" aria-label="تماس با پیک">
<PhoneIcon />
</Button>
</div>
<p className="text-sm text-muted-foreground">سفارش از کافه رست · ۲ قلم</p>
</section>
</main>
</ControlSizeProvider>
)
}
<script setup lang="ts">
import Avatar from "@/components/ui/Avatar.vue"
import Button from "@/components/ui/Button.vue"
import ControlSize from "@/components/ui/ControlSize.vue"
import Progress from "@/components/ui/Progress.vue"
import { DigIcon } from "@/lib/icons"
// تصویرهای کتابخانهٔ تصویرِ دیگ (همان فایلهای stock-images نسخهٔ React).
const stockImages = {
personMan2: { src: "https://docs.digdesign.ir/images/person-man-2.webp", alt: "پرترهٔ مردی با تیشرتِ سفید" },
}
type StockImageName = keyof typeof stockImages
/**
* پیگیری زندهٔ پیک: نقشهٔ تمامصفحه و کارتِ پایینی ثابت با زمانِ رسیدنِ درشت، نوارِ پیشرفت،
* پیک با عکس و پلاک، و تماس یا پیام؛ برای سفارشِ غذا و تحویلِ فوری.
*/
</script>
<template>
<ControlSize size="xl" as-child>
<main class="relative mx-auto flex min-h-svh w-full max-w-md flex-col overflow-hidden bg-subtle">
<h1 class="sr-only">پیگیری پیک</h1>
<!-- نقشهٔ تزئینی؛ در محصول نقشهٔ واقعی میآید -->
<img src="/blocks/contact-map.svg" alt="مسیرِ پیک روی نقشه" class="dark:brightness-[0.75] absolute inset-0 size-full object-cover" />
<section aria-live="polite" class="relative mt-auto flex flex-col gap-5 rounded-t-xl bg-card p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-card">
<div class="flex items-end justify-between gap-3">
<div class="flex flex-col">
<span class="text-sm text-muted-foreground">رسیدن تا</span>
<span class="text-3xl font-black tabular-nums">۱۲ دقیقه</span>
</div>
<span class="text-sm text-muted-foreground">۲٫۴ کیلومتر مانده</span>
</div>
<Progress :value="70" aria-label="پیشرفتِ مسیر" color="success" />
<div class="flex items-center gap-3 rounded-xl bg-subtle p-3">
<Avatar size="lg" alt="" :src="stockImages.personMan2.src" />
<span class="flex flex-1 flex-col">
<span class="font-semibold">علی کاظمی</span>
<span class="text-sm text-muted-foreground">موتور · ۲۲۴ ایران ۱۱</span>
</span>
<Button variant="outline" size="icon" aria-label="پیام به پیک" class="bg-card">
<DigIcon name="chat" />
</Button>
<Button size="icon" aria-label="تماس با پیک">
<DigIcon name="phone" />
</Button>
</div>
<p class="text-sm text-muted-foreground">سفارش از کافه رست · ۲ قلم</p>
</section>
</main>
</ControlSize>
</template>
کدِ این بلاک هنوز برای Svelte نوشته نشده است.
این موارد هنوز برای Svelte آماده نیستند: avatarcontrol-sizeprogressآیکون chatآیکون phone
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="svelte" ایجنت آن را با کامپوننتهای Svelte میسازد.
import { ChangeDetectionStrategy, Component } from "@angular/core"
import { DigIcon } from "@/lib/icons"
import { DigAvatar } from "@/components/ui/avatar"
import { DigButton } from "@/components/ui/button"
import { DigControlSize } from "@/components/ui/control-size"
import { DigProgress } from "@/components/ui/progress"
const stockImages = {
personMan2: {
src: "https://docs.digdesign.ir/images/person-man-2.webp",
alt: "پرترهٔ مردی با تیشرتِ سفید",
},
}
type StockImageName = keyof typeof stockImages
@Component({
selector: "dig-block-order-tracking-live",
imports: [DigAvatar, DigButton, DigControlSize, DigIcon, DigProgress],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<main
digControlSize="xl"
class="relative mx-auto flex min-h-svh w-full max-w-md flex-col overflow-hidden bg-subtle"
>
<h1 class="sr-only">پیگیری پیک</h1>
<!-- نقشهٔ تزئینی؛ در محصول نقشهٔ واقعی میآید -->
<img
src="/blocks/contact-map.svg"
alt="مسیرِ پیک روی نقشه"
class="dark:brightness-[0.75] absolute inset-0 size-full object-cover"
/>
<section
aria-live="polite"
class="relative mt-auto flex flex-col gap-5 rounded-t-xl bg-card p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-card"
>
<div class="flex items-end justify-between gap-3">
<div class="flex flex-col">
<span class="text-sm text-muted-foreground">رسیدن تا</span>
<span class="text-3xl font-black tabular-nums">۱۲ دقیقه</span>
</div>
<span class="text-sm text-muted-foreground">۲٫۴ کیلومتر مانده</span>
</div>
<div
digProgress
[value]="70"
aria-label="پیشرفتِ مسیر"
color="success"
></div>
<div class="flex items-center gap-3 rounded-xl bg-subtle p-3">
<span
digAvatar
size="lg"
alt=""
[src]="stockImages.personMan2.src"
></span>
<span class="flex flex-1 flex-col">
<span class="font-semibold">علی کاظمی</span>
<span class="text-sm text-muted-foreground"
>موتور · ۲۲۴ ایران ۱۱</span
>
</span>
<button
digButton
type="button"
variant="outline"
size="icon"
aria-label="پیام به پیک"
class="bg-card"
>
<svg digIcon="chat"></svg>
</button>
<button digButton type="button" size="icon" aria-label="تماس با پیک">
<svg digIcon="phone"></svg>
</button>
</div>
<p class="text-sm text-muted-foreground">سفارش از کافه رست · ۲ قلم</p>
</section>
</main>
`,
})
export class OrderTrackingLiveBlock {
readonly stockImages = stockImages
}
کدِ این بلاک هنوز برای Android نوشته نشده است.
همهٔ کامپوننتهای لازم برای Android آمادهاند؛ با MCP میتوانید همین صفحه را از روی نسخهٔ React بسازید.
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="android" ایجنت آن را با کامپوننتهای Android میسازد.