Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

93 lines
3.9 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
blockedAndAllowedMinuteIntervalsForQuietHours,
MINUTES_PER_DAY,
} from 'products/alerts/frontend/logic/scheduleRestrictionValidation'
import type { BlockedWindow } from 'products/alerts/frontend/types'
type TimelineSegment = { kind: 'blocked' | 'allowed'; from: number; to: number }
function buildDayTimelineSegments(windows: BlockedWindow[]): TimelineSegment[] | null {
const both = blockedAndAllowedMinuteIntervalsForQuietHours(windows)
if (both === null) {
return null
}
const { blocked: merged, allowed } = both
return [
...merged.map(([from, to]) => ({ kind: 'blocked' as const, from, to })),
...allowed.map(([from, to]) => ({ kind: 'allowed' as const, from, to })),
].sort((a, b) => a.from - b.from || a.to - b.to)
}
function formatMinuteLabel(m: number): string {
if (m <= 0 || m >= MINUTES_PER_DAY) {
return '12a'
}
const h = Math.floor(m / 60)
const isPm = h >= 12
const hour12 = h % 12 === 0 ? 12 : h % 12
return `${hour12}${isPm ? 'p' : 'a'}`
}
/** Hour starts 12am … 11pm (24 columns under the bar). */
const HOUR_START_MINUTES = Array.from({ length: 24 }, (_, h) => h * 60)
export interface QuietHoursDayTimelineProps {
windows: BlockedWindow[]
}
/** Single-row 24h bar: allowed (run) vs blocked (quiet) in project-local wall time. */
export function QuietHoursDayTimeline({ windows }: QuietHoursDayTimelineProps): JSX.Element | null {
const segments = buildDayTimelineSegments(windows)
if (!segments?.length) {
return null
}
const ariaPieces = segments.map((s) => {
const kind = s.kind === 'allowed' ? 'alert may run' : 'quiet hours'
return `${formatMinuteLabel(s.from)}–${formatMinuteLabel(s.to)} ${kind}`
})
return (
<div className="space-y-1.5" data-attr="alertForm-quiet-day-timeline">
<div className="text-secondary text-xs">One local day (project timezone)</div>
<div
className="flex h-4 w-full overflow-hidden rounded border border-primary"
role="img"
aria-label={`Quiet hours and run times throughout the day: ${ariaPieces.join('; ')}.`}
>
{segments.map((s) => (
<div
key={`${s.kind}-${s.from}-${s.to}`}
title={`${formatMinuteLabel(s.from)}–${formatMinuteLabel(s.to)} · ${
s.kind === 'allowed' ? 'Alert can run' : 'Quiet hours'
}`}
className={
s.kind === 'allowed'
? 'min-w-px shrink-0 bg-success dark:bg-success-light'
: 'min-w-px shrink-0 bg-fill-secondary'
}
style={{ width: `${((s.to - s.from) / MINUTES_PER_DAY) * 100}%` }}
/>
))}
</div>
<div className="grid w-full grid-cols-[repeat(24,minmax(0,1fr))] text-secondary text-[8px] leading-none tabular-nums sm:text-[9px]">
{HOUR_START_MINUTES.map((m, hour) => (
<span
key={m}
className={`block min-w-0 text-center ${hour % 2 === 1 ? 'max-sm:invisible max-sm:select-none' : ''}`}
>
{formatMinuteLabel(m)}
</span>
))}
</div>
<p className="text-secondary text-xs m-0">
<span className="inline-block size-2.5 shrink-0 rounded-sm bg-success dark:bg-success-light mr-1 align-middle" />{' '}
Runs allowed
<span className="mx-2 text-border">·</span>
<span className="inline-block size-2.5 shrink-0 rounded-sm bg-fill-secondary mr-1 align-middle" /> Quiet
hours
</p>
</div>
)
}