Remove unused db import, fix type casting for database query result, correct requireAdmin() usage in API routes.
6.3 KiB
CAPA Board Scrollable Columns Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Add vertical scrolling to CAPA board status columns so large numbers of closed/completed cases don't overflow the viewport; apply uniformly to all statuses.
Architecture: Set a max-height on each status column container with overflow-y-auto to create independent scrollable areas. This preserves the board layout while accommodating growth. No database or API changes needed—pure UI improvement.
Tech Stack: React, TailwindCSS, Next.js (no new dependencies)
Global Constraints
- Version bump: 1.2.0 → 1.2.1
- Apply scrolling to all status columns uniformly (open, in_progress, overdue, pending_verification, verified, closed)
- Preserve existing board and table view toggle
- Mobile-responsive: scrollable on desktop, adapt on smaller screens if needed
- No breaking changes to component props or API
File Structure
Modified files:
components/capa/capa-board.tsx— Add max-height + overflow-y-auto to status column containerpackage.json— Bump version to 1.2.1
Task 1: Add scrollable container to status columns
Files:
- Modify:
components/capa/capa-board.tsx:108-132
Interfaces:
-
Consumes: Existing
STATUS_COLORS,STATUS_LABELS,byStatusgrouping -
Produces: Unchanged
CapaBoardcomponent signature; internal styling only -
Step 1: Read current board view structure
Current code (lines 108-132):
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
{STATUS_ORDER.filter(s => s !== 'reopened').map(status => (
<div key={status} className={`rounded-xl border p-4 ${STATUS_COLORS[status]}`}>
<h3 className="text-xs font-semibold uppercase tracking-wide text-gray-600 mb-3">
{STATUS_LABELS[status]} ({byStatus[status].length})
</h3>
<div className="space-y-2">
{/* items */}
</div>
</div>
))}
</div>
Problem: When byStatus[status] has 50+ items, the column grows vertically unbounded.
- Step 2: Modify status column to add scroll container
Wrap the items container (<div className="space-y-2">) with max-height and overflow. Replace lines 114-129:
<div className="space-y-2 max-h-96 overflow-y-auto pr-2">
{byStatus[status].map(c => (
<Link key={c.id} href={`/hse/capa/${c.id}`}
className="block bg-white rounded-lg p-3 shadow-sm hover:shadow-md transition-shadow border border-gray-100">
<p className="text-sm text-gray-800 line-clamp-2 mb-1">{c.description}</p>
<div className="flex items-center justify-between text-xs text-gray-500">
<span>{(c.owner as { name: string } | null)?.name ?? '—'}</span>
<span className={`px-1.5 py-0.5 rounded ${PRIORITY_BADGE[c.priority]}`}>{c.priority}</span>
</div>
<p className="text-xs text-gray-400 mt-1">Due {c.due_date}</p>
</Link>
))}
{byStatus[status].length === 0 && (
<p className="text-xs text-gray-400 text-center py-3">Empty</p>
)}
</div>
Key changes:
-
max-h-96— Limit column height to 24rem (384px), tunable per design -
overflow-y-auto— Vertical scroll when content exceeds max-height -
pr-2— Add right padding for scrollbar gutter visibility -
Step 3: Test in browser
Build and start dev server:
npm run build
npm run dev
Navigate to /hse/capa. Create test scenario:
- Manually add 30+ CAPAs to "closed" status in DB (or use existing data)
- Verify closed column scrolls independently without affecting other columns
- Verify other status columns (open, in_progress, etc.) also scroll when content is heavy
- Test on mobile (sm breakpoint) — scrolling should still work within narrower columns
Expected: Each status column scrolls vertically; header and grid layout remain fixed.
- Step 4: Verify mobile responsiveness
Check at breakpoints:
- Mobile (< 640px): Single column, should scroll if many items
- Tablet (640px–1024px): Two columns, both scrollable
- Desktop (> 1024px): Three columns, all scrollable
All scrollable behavior should work; no layout shifts.
- Step 5: Commit
git add components/capa/capa-board.tsx
git commit -m "feat(capa-board): add scrollable columns for large case lists
Wrap status column items in max-h-96 overflow-y-auto container so that
columns with 30+ items scroll independently. Apply to all statuses
uniformly. Preserves board layout and header visibility."
Task 2: Bump version to 1.2.1
Files:
- Modify:
package.json:3
Interfaces:
-
Consumes: Current version string (1.2.0)
-
Produces: Updated version string (1.2.1)
-
Step 1: Update package.json version
Replace line 3:
"version": "1.2.1",
- Step 2: Commit
git add package.json
git commit -m "bump: version 1.2.0 to 1.2.1"
Task 3: Rebuild and deploy
Files:
- Generate:
.next/build directory
Interfaces:
-
Consumes: Updated source files
-
Produces: Production-ready bundle
-
Step 1: Build
npm run build
Expected output: Build completes, no errors.
- Step 2: Sync to server
rsync -avz -e "ssh -p 9321" /Users/yapweeihan/Projects/IMS.nosync/.next/ \
setia@175.136.239.121:/var/www/ims/.next/
- Step 3: Restart service
ssh -p 9321 setia@175.136.239.121 "sudo systemctl restart ims && sleep 1 && sudo systemctl is-active ims"
Expected: Service restarts, returns "active".
- Step 4: Verify in production
Navigate to http://64.176.82.100/ims/hse/capa in browser. Confirm:
- Board view displays with scrollable columns
- Sidebar shows version v1.2.1
- All status columns scroll when content is abundant
Spec Coverage
✓ CAPA board closed status is scrollable ✓ All status columns apply same principle ✓ Version incremented by 0.0.1 (1.2.0 → 1.2.1) ✓ No breaking changes
Plan complete and saved. Ready for execution.
Two execution options:
1. Subagent-Driven (recommended) — Fresh subagent per task, review between tasks, fast iteration
2. Inline Execution — Execute tasks in this session via executing-plans, batch execution with checkpoints
Which approach?