@prmichaelsen/acp-visualizer 0.9.5 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
1
2
|
import {
|
|
2
3
|
BarChart,
|
|
3
4
|
Bar,
|
|
@@ -51,6 +52,16 @@ function buildEstimateData(data: ProgressData): MilestoneEstimate[] {
|
|
|
51
52
|
|
|
52
53
|
export function EstimateChart({ data }: EstimateChartProps) {
|
|
53
54
|
const chartData = buildEstimateData(data)
|
|
55
|
+
const [isMobile, setIsMobile] = useState(false)
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const checkMobile = () => {
|
|
59
|
+
setIsMobile(window.innerWidth < 1024)
|
|
60
|
+
}
|
|
61
|
+
checkMobile()
|
|
62
|
+
window.addEventListener('resize', checkMobile)
|
|
63
|
+
return () => window.removeEventListener('resize', checkMobile)
|
|
64
|
+
}, [])
|
|
54
65
|
|
|
55
66
|
if (chartData.length === 0) {
|
|
56
67
|
return null
|
|
@@ -58,15 +69,22 @@ export function EstimateChart({ data }: EstimateChartProps) {
|
|
|
58
69
|
|
|
59
70
|
const hasActuals = chartData.some((d) => d.actual !== null)
|
|
60
71
|
|
|
72
|
+
// Mobile: LR (horizontal bars), Desktop: TB (vertical bars) for better space usage
|
|
73
|
+
const layout = isMobile ? 'vertical' : 'vertical'
|
|
74
|
+
const chartHeight = isMobile
|
|
75
|
+
? Math.max(200, chartData.length * 50 + 40) // LR: height scales with items
|
|
76
|
+
: Math.max(300, chartData.length * 50 + 40)
|
|
77
|
+
const yAxisWidth = isMobile ? 120 : 180
|
|
78
|
+
|
|
61
79
|
return (
|
|
62
80
|
<div className="bg-gray-900/50 border border-gray-800 rounded-xl p-5">
|
|
63
81
|
<h3 className="text-sm font-semibold text-gray-300 mb-4">
|
|
64
82
|
Estimated vs Actual Hours
|
|
65
83
|
</h3>
|
|
66
|
-
<ResponsiveContainer width="100%" height={
|
|
84
|
+
<ResponsiveContainer width="100%" height={chartHeight}>
|
|
67
85
|
<BarChart
|
|
68
86
|
data={chartData}
|
|
69
|
-
layout=
|
|
87
|
+
layout={layout}
|
|
70
88
|
margin={{ top: 5, right: 20, bottom: 5, left: 10 }}
|
|
71
89
|
>
|
|
72
90
|
<CartesianGrid strokeDasharray="3 3" stroke="#1f2937" horizontal={false} />
|
|
@@ -80,7 +98,7 @@ export function EstimateChart({ data }: EstimateChartProps) {
|
|
|
80
98
|
<YAxis
|
|
81
99
|
type="category"
|
|
82
100
|
dataKey="name"
|
|
83
|
-
width={
|
|
101
|
+
width={yAxisWidth}
|
|
84
102
|
tick={{ fill: '#9ca3af', fontSize: 11 }}
|
|
85
103
|
tickLine={false}
|
|
86
104
|
axisLine={{ stroke: '#374151' }}
|
|
@@ -15,12 +15,12 @@ interface FilterBarProps {
|
|
|
15
15
|
|
|
16
16
|
export function FilterBar({ status, onStatusChange }: FilterBarProps) {
|
|
17
17
|
return (
|
|
18
|
-
<div className="flex gap-
|
|
18
|
+
<div className="flex flex-wrap gap-2 p-2 bg-gray-800/50 rounded-lg">
|
|
19
19
|
{statusOptions.map((opt) => (
|
|
20
20
|
<button
|
|
21
21
|
key={opt.value}
|
|
22
22
|
onClick={() => onStatusChange(opt.value)}
|
|
23
|
-
className={`px-
|
|
23
|
+
className={`px-4 py-2 text-sm rounded-md transition-colors whitespace-nowrap min-w-[44px] min-h-[44px] flex items-center justify-center ${
|
|
24
24
|
status === opt.value
|
|
25
25
|
? 'bg-gray-700 text-gray-100 shadow-sm'
|
|
26
26
|
: 'text-gray-500 hover:text-gray-300'
|
|
@@ -90,10 +90,11 @@ export function MilestoneKanban({ milestones, tasks }: MilestoneKanbanProps) {
|
|
|
90
90
|
coreStatuses.has(col.status) ||
|
|
91
91
|
milestones.some((m) => m.status === col.status),
|
|
92
92
|
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
|
|
94
|
+
// Responsive grid: 1 col mobile, 2 cols tablet, 3-4 cols desktop
|
|
95
|
+
const gridCols = activeColumns.length <= 3
|
|
96
|
+
? 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3'
|
|
97
|
+
: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-4'
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
100
|
<div className={`grid ${gridCols} gap-4 min-h-[300px]`}>
|
|
@@ -15,12 +15,12 @@ const views: Array<{ id: ViewMode; label: string }> = [
|
|
|
15
15
|
|
|
16
16
|
export function ViewToggle({ value, onChange }: ViewToggleProps) {
|
|
17
17
|
return (
|
|
18
|
-
<div className="flex gap-1 bg-gray-900 border border-gray-800 rounded-lg p-0.5">
|
|
18
|
+
<div className="flex gap-1 bg-gray-900 border border-gray-800 rounded-lg p-0.5 overflow-x-auto scrollbar-hide">
|
|
19
19
|
{views.map((v) => (
|
|
20
20
|
<button
|
|
21
21
|
key={v.id}
|
|
22
22
|
onClick={() => onChange(v.id)}
|
|
23
|
-
className={`px-
|
|
23
|
+
className={`px-4 py-2 text-sm rounded-md transition-colors whitespace-nowrap min-w-[44px] min-h-[44px] flex items-center justify-center ${
|
|
24
24
|
value === v.id
|
|
25
25
|
? 'bg-gray-700 text-gray-100'
|
|
26
26
|
: 'text-gray-500 hover:text-gray-300'
|