Files
movies-diary/spa/src/components/rating-histogram.tsx
Gabriel Kaszewski b9c0b10740 feat: add SPA, serve at /app/, update Dockerfile and README
- React + TanStack Router + shadcn/ui SPA under spa/
- serve spa/dist at /app/ with index.html fallback for client routing
- Dockerfile: node build stage for SPA, copy dist into runtime image
- README: document SPA, CORS_ORIGINS env var, architecture entry
- vite base set to /app/, manifest.json paths fixed
2026-06-04 04:20:15 +02:00

27 lines
734 B
TypeScript

type RatingHistogramProps = {
histogram: number[]
}
export function RatingHistogram({ histogram }: RatingHistogramProps) {
const max = Math.max(...histogram, 1)
return (
<div>
<div className="flex items-end gap-1" style={{ height: 40 }}>
{histogram.map((count, i) => (
<div
key={i}
className="flex-1 rounded-t bg-amber-500/80"
style={{ height: `${(count / max) * 100}%`, minHeight: count > 0 ? 2 : 0 }}
/>
))}
</div>
<div className="mt-1 flex gap-1">
{[1, 2, 3, 4, 5].map((n) => (
<div key={n} className="flex-1 text-center text-[10px] text-muted-foreground/40">{n}</div>
))}
</div>
</div>
)
}