//این فایل مخصوص //شماتیک نوری import React from "react"; import { formatNumber } from "~/lib/utils"; export type CompanyInfo = { id: string; imageUrl: string; name: string; costReduction: number; revenue?: number; capacity?: number; costI : number, capacityI : number, revenueI : number, cost : number | string, }; export type D3ImageInfoProps = { companies: CompanyInfo[]; width?: number; height?: number; }; const InfoBox = ({ company, style }: { company: CompanyInfo; style :any }) => { return (
هزینه عملیاتی:
{formatNumber(company?.cost || 0)}
میلیون ریال
افزایش ظرفیت:
{formatNumber(company?.capacity || 0)}
تن در سال
); }; export function D3ImageInfo({ companies }: D3ImageInfoProps) { const sample = [ { id: "PX", name: "PX", imageUrl: "/abniro.png" }, { id: "LLTE&HLTE", name: "LLTE&HLTE", imageUrl: "/besparan.png" }, { id: "BTX", name: "BTX", imageUrl: "/khwarazmi.png" }, { id: "Utility", name: "Utility", imageUrl: "/faravash1.png" }, { id: "Reforming", name: "Reforming", imageUrl: "/faravash2.png" }, { id: "Storage Tank", name: "Storage Tank", imageUrl: "/kimia.png" } ]; const merged = sample.map(company => { const found = companies.find(item => item.id == company.id); return found ? found : { ...company, cost: 0, capacity: 0, revenue: 0 }; }); const displayCompanies = merged; // Positions inside a 5x4 grid (col, row) // Layout keeps same visual logic: left/middle/right on two bands with spacing grid around const gridPositions = [ { col: 2, row: 2 , colI : 1 , rowI : 2 , name : "LLTE&HLTE"}, // left - top band { col: 3, row: 2 , colI : 3 , rowI : 1 , name : "BTX"}, // middle top (image sits in row 2, info box goes to row 1) { col: 4, row: 2 ,colI : 5 , rowI : 2 , name : "Utility"}, // right - top band { col: 2, row: 3 , colI : 1 , rowI : 3 , name : "Storage Tank"}, // left - bottom band { col: 3, row: 3 , colI : 3, rowI : 4 , name : "PX"}, // middle bottom (image sits in row 3, info box goes to row 4) { col: 4, row: 3 , colI : 5 , rowI : 3 , name : "Reforming"}, // right - bottom band ]; return (
{displayCompanies.map((company, index) => { const gp = gridPositions.find(v => v.name === company.name); return ( <>
{company.name}
{company.name}
); })}
); }