Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
83 lines
2.8 KiB
TypeScript
83 lines
2.8 KiB
TypeScript
"use client";
|
||
|
||
import Link from "next/link";
|
||
import { useSportsCenterCapabilities } from "@/modules/sports-center/hooks/useSportsCenterCapabilities";
|
||
import { SportsCenterPageLoader } from "@/modules/sports-center/pages/shared";
|
||
import { PageHeader, Card, CardContent, Button, Badge } from "@/components/ds";
|
||
import { SportsCenterBreadcrumbs } from "@/modules/sports-center/components/SportsCenterBreadcrumbs";
|
||
|
||
function IntegrationPage({
|
||
title,
|
||
moduleHref,
|
||
moduleLabel,
|
||
enabled,
|
||
}: {
|
||
title: string;
|
||
moduleHref: string;
|
||
moduleLabel: string;
|
||
enabled?: boolean;
|
||
}) {
|
||
return (
|
||
<div className="space-y-6">
|
||
<SportsCenterBreadcrumbs current={title} />
|
||
<PageHeader
|
||
title={title}
|
||
description="یکپارچهسازی از طریق API و Events — بدون mock"
|
||
actions={<Badge tone={enabled ? "success" : "warning"}>{enabled ? "آماده" : "فاز بعدی"}</Badge>}
|
||
/>
|
||
<Card>
|
||
<CardContent className="space-y-4 p-6">
|
||
<p className="text-sm text-[var(--muted)]">
|
||
Sports Center از provider contracts استفاده میکند. برای عملیات کامل به ماژول {moduleLabel} مراجعه کنید.
|
||
</p>
|
||
<Link href={moduleHref}>
|
||
<Button variant="outline">باز کردن {moduleLabel}</Button>
|
||
</Link>
|
||
</CardContent>
|
||
</Card>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
export function CrmIntegrationPage() {
|
||
const caps = useSportsCenterCapabilities();
|
||
if (caps.isLoading) return <SportsCenterPageLoader />;
|
||
return <IntegrationPage title="یکپارچهسازی CRM" moduleHref="/crm/hub" moduleLabel="CRM" enabled />;
|
||
}
|
||
|
||
export function AccountingIntegrationPage() {
|
||
const caps = useSportsCenterCapabilities();
|
||
if (caps.isLoading) return <SportsCenterPageLoader />;
|
||
return (
|
||
<IntegrationPage
|
||
title="یکپارچهسازی حسابداری"
|
||
moduleHref="/accounting"
|
||
moduleLabel="حسابداری"
|
||
enabled={caps.data?.features?.accounting_integration}
|
||
/>
|
||
);
|
||
}
|
||
|
||
export function LoyaltyIntegrationPage() {
|
||
return <IntegrationPage title="یکپارچهسازی وفاداری" moduleHref="/dashboard" moduleLabel="Loyalty" enabled />;
|
||
}
|
||
|
||
export function CommunicationIntegrationPage() {
|
||
return <IntegrationPage title="یکپارچهسازی ارتباطات" moduleHref="/dashboard" moduleLabel="Communication" enabled />;
|
||
}
|
||
|
||
export function AiInsightsPage() {
|
||
const caps = useSportsCenterCapabilities();
|
||
if (caps.isLoading) return <SportsCenterPageLoader />;
|
||
return (
|
||
<IntegrationPage
|
||
title="بینش هوش مصنوعی"
|
||
moduleHref="/dashboard"
|
||
moduleLabel="AI Assistant"
|
||
enabled={caps.data?.features?.ai}
|
||
/>
|
||
);
|
||
}
|
||
|
||
export default CrmIntegrationPage;
|