diff --git a/app/components/dashboard/strategic-alignment-popup.tsx b/app/components/dashboard/strategic-alignment-popup.tsx index 36f4136..cebb0bb 100644 --- a/app/components/dashboard/strategic-alignment-popup.tsx +++ b/app/components/dashboard/strategic-alignment-popup.tsx @@ -20,6 +20,7 @@ import apiService from "~/lib/api"; import { Skeleton } from "~/components/ui/skeleton"; import { formatNumber } from "~/lib/utils"; import { ChartContainer } from "../ui/chart"; +import { TruncatedText } from "../ui/truncatedText"; interface StrategicAlignmentData { strategic_theme: string; @@ -153,7 +154,22 @@ export function StrategicAlignmentPopup({ tickLine={false} axisLine={false} tickMargin={10} - tick={{ fill: "#94a3b8", fontSize: 12 }} + interval={0} + style={{ fill: "#94a3b8", fontSize: 12 }} + tick={(props) => { + const { x, y, payload } = props; + console.log(payload) + return ( + + + + + + ); + }} /> `${formatNumber(Math.round(value))}%` } + + label={{ value: "تعداد برنامه ها" , angle: -90, diff --git a/app/components/ui/truncatedText.tsx b/app/components/ui/truncatedText.tsx new file mode 100644 index 0000000..72cdd58 --- /dev/null +++ b/app/components/ui/truncatedText.tsx @@ -0,0 +1,31 @@ +import * as React from "react" +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip" + +interface TruncatedTextProps { + text: string + maxWords?: number +} + +export function TruncatedText({ text, maxWords = 4 }: TruncatedTextProps) { + const words = text.trim().split(/\s+/) + console.log(words) + const shouldTruncate = words.length > maxWords + const displayText = shouldTruncate ? words.slice(0, maxWords).join(" ") + " ..." : text + + return ( + + + + = 4 ? "cursor-help" : ""} text-foreground`}> + {displayText} + + + {shouldTruncate && ( + + {text} + + )} + + + ) +}