import React from 'react'; import { Link } from 'react-router'; import { ChevronLeftIcon } from '@heroicons/react/24/outline'; import BackButton from './BackButton'; import TourButton from './TourButton'; interface Crumb { label: string; to?: string; } interface Props { title: string; breadcrumbs?: Crumb[]; action?: React.ReactNode; description?: string; /** * صفحه از دل صفحهٔ دیگری باز می‌شود → دکمهٔ «بازگشت» بالای عنوان. * مقدار، مقصدِ fallback است وقتی تاریخچه‌ای برای برگشتن نیست. */ backTo?: string; /** شناسهٔ تور راهنمای این صفحه؛ اگر در registry ثبت نشده باشد دکمه‌ای نمی‌آید. */ tourId?: string; /** * محتوای صفحه نشسته است و تورِ بار اول می‌تواند خودکار اجرا شود. * صفحه‌ای که داده‌اش دیر می‌آید، `!isLoading` بدهد تا تور روی صفحهٔ نیمه‌ساخته نیفتد. */ tourReady?: boolean; } export default function PageHeader({ title, breadcrumbs, action, description, backTo, tourId, tourReady = true }: Props) { return (
{backTo && (
)} {breadcrumbs && breadcrumbs.length > 0 && ( )}

{title}

{description && (

{description}

)}
{action &&
{action}
}
); }