بلاک‌ها · فروشگاهی
ری‌اکت ۱۹ و Next.js با پیاده‌سازی دسترس‌پذیری داخلی دیگویو ۳ با Composition APISvelte ۵ با runesانگولار با signals و دایرکتیوهای standaloneجتپک کامپوز با KotliniOS — هنوز پورت نشده

پیگیریِ زندهٔ پیک

پیش‌نمایش تمام‌صفحه

نقشهٔ تمام‌صفحه با کارتِ پایینی: زمانِ رسیدنِ درشت، نوارِ مسیر، پیک با عکس و پلاک، پیام و تماس؛ برای غذا و تحویلِ فوری.

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

این بلاک از ۵ آیتم دیگ استفاده می‌کند: avatarbuttoncontrol-sizeiconsprogress

پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
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.json
pnpm 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.json
yarn 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.json
bunx --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.json
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button control-size progress --framework vue
pnpm dlx digdesign@latest add avatar button control-size progress --framework vue
yarn dlx digdesign@latest add avatar button control-size progress --framework vue
bunx --bun digdesign@latest add avatar button control-size progress --framework vue
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add button --framework svelte
pnpm dlx digdesign@latest add button --framework svelte
yarn dlx digdesign@latest add button --framework svelte
bunx --bun digdesign@latest add button --framework svelte
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button control-size icons progress --framework angular
pnpm dlx digdesign@latest add avatar button control-size icons progress --framework angular
yarn dlx digdesign@latest add avatar button control-size icons progress --framework angular
bunx --bun digdesign@latest add avatar button control-size icons progress --framework angular
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add avatar button control-size progress --framework android
pnpm dlx digdesign@latest add avatar button control-size progress --framework android
yarn dlx digdesign@latest add avatar button control-size progress --framework android
bunx --bun digdesign@latest add avatar button control-size progress --framework android

۲. کد صفحه

کد را در صفحهٔ پروژه‌تان بگذارید (React: app/<route>/page.tsx) و متن‌ها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریم‌ورک کدِ همین صفحه در فریم‌ورک دیگر را ببینید.

order-tracking-live.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>
  )
}
order-tracking-live.vue
<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 می‌سازد.

order-tracking-live.ts
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 می‌سازد.