Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

1006 B
Raw Blame
import type { MonitorVar } from "../lib/palette";

// Pure-SVG sparkline. Stretches to fill its card via preserveAspectRatio="none"
// + non-scaling-stroke; colour from a slice-scoped CSS var (no hex in markup).
export function Sparkline({
  data,
  accent,
  max,
}: {
  data: number[];
  accent: MonitorVar;
  max?: number; // fixed scale; defaults to data peak
}) {
  const W = 300;
  const H = 54;
  const peak = Math.max(max ?? 0, ...data, 1);
  const pts = data
    .map((d, i) => `${(i / (data.length - 1)) * W},${H - (d / peak) * H}`)
    .join(" ");
  const stroke = `var(${accent})`;
  return (
    <svg
      viewBox={`0 0 ${W} ${H}`}
      preserveAspectRatio="none"
      className="h-[54px] w-full"
    >
      <polygon points={`0,${H} ${pts} ${W},${H}`} fill={stroke} opacity={0.14} />
      <polyline
        points={pts}
        fill="none"
        stroke={stroke}
        strokeWidth="2"
        strokeLinejoin="round"
        vectorEffect="non-scaling-stroke"
      />
    </svg>
  );
}