diff --git a/app/components/dashboard/d3-image-info.tsx b/app/components/dashboard/d3-image-info.tsx index 7a9dc02..a1ccaf8 100644 --- a/app/components/dashboard/d3-image-info.tsx +++ b/app/components/dashboard/d3-image-info.tsx @@ -11,7 +11,7 @@ export type CompanyInfo = { costI : number, capacityI : number, revenueI : number, - cost : number | string, + cost : number | string, }; export type D3ImageInfoProps = { @@ -46,7 +46,24 @@ const InfoBox = ({ company, style }: { company: CompanyInfo; style :any }) => { export function D3ImageInfo({ companies }: D3ImageInfoProps) { // Ensure we have exactly 6 companies - const displayCompanies = companies; + + const sample = [ + { id: "آب نیرو", name: "آب نیرو", imageUrl: "/abniro.png" }, + { id: "بسپاران", name: "بسپاران", imageUrl: "/besparan.png" }, + { id: "خوارزمی", name: "خوارزمی", imageUrl: "/khwarazmi.png" }, + { id: "فراورش 1", name: "فراورش 1", imageUrl: "/faravash1.png" }, + { id: "فراورش 2", name: "فراورش 2", imageUrl: "/faravash2.png" }, + { id: "کیمیا", name: "کیمیا", 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; + console.log(displayCompanies) // Positions inside a 5x4 grid (col, row) // Layout keeps same visual logic: left/middle/right on two bands with spacing grid around @@ -58,7 +75,7 @@ export function D3ImageInfo({ companies }: D3ImageInfoProps) { { col: 3, row: 3 , colI : 3, rowI : 4 , name : "آب نیرو"}, // middle bottom (image sits in row 3, info box goes to row 4) { col: 4, row: 3 , colI : 5 , rowI : 3 , name : "فراورش 2"}, // right - bottom band ]; - + return (
@@ -72,10 +89,10 @@ export function D3ImageInfo({ companies }: D3ImageInfoProps) { style={{ gridColumn: gp.col, gridRow: gp.row }} >
- {company.name}
@@ -124,6 +141,7 @@ export function D3ImageInfo({ companies }: D3ImageInfoProps) { align-self : center; justify-self : center; padding : .2rem 1.2rem; + min-width : 8rem; background-color: transparent; } diff --git a/app/components/dashboard/dashboard-custom-bar-chart.tsx b/app/components/dashboard/dashboard-custom-bar-chart.tsx index 5130265..cb10668 100644 --- a/app/components/dashboard/dashboard-custom-bar-chart.tsx +++ b/app/components/dashboard/dashboard-custom-bar-chart.tsx @@ -1,5 +1,10 @@ import React from "react"; import { formatNumber } from "~/lib/utils"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "~/components/ui/tooltip" interface DataItem { label: string; @@ -54,12 +59,27 @@ export function DashboardCustomBarChart({
{/* Animated bar */}
- + { widthPercentage > 20 ? ( + {item.label} + ) : ( + + + + "" + + + + +

{item.label}

+
+ +
+ ) }
{formatNumber(item.value)} diff --git a/app/components/ui/tooltip.tsx b/app/components/ui/tooltip.tsx index fc97fa5..811f42b 100644 --- a/app/components/ui/tooltip.tsx +++ b/app/components/ui/tooltip.tsx @@ -52,7 +52,7 @@ function TooltipContent({ {...props} > {children} - + )