mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:14:28 +00:00
Describe the live catalog, the plan ladder, the open-source read, the Sigil maths, the tilt and the sound kit with real types. Sound is now off until the visitor sets localStorage hz-sound to "on". Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
9 lines
564 B
TypeScript
9 lines
564 B
TypeScript
// The shade a day's commits earn, cut as @hanzo/ui's Heatmap cuts it: 0 for a day without commits, then 1 to 4 up the
|
|
// quartiles of the days that had any. Days are ranked, not scaled to the busiest, so one outlier cannot flatten a year.
|
|
export function cuts(counts: number[]): number[] {
|
|
const nz = counts.filter((v) => v > 0).sort((a, b) => a - b);
|
|
return [0.25, 0.5, 0.75].map((p) => nz[Math.floor(nz.length * p)] ?? 0);
|
|
}
|
|
|
|
export const shade = (v: number, cut: number[]): number => (v <= 0 ? 0 : v <= cut[0] ? 1 : v <= cut[1] ? 2 : v <= cut[2] ? 3 : 4);
|