Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

1010 B
Raw Blame
import { useTranslations } from 'next-intl';
import type { WidgetConfig } from '@/utils/dashboardWidgets';
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from '@/components/ui/select';

const DAYS_OPTIONS = [7, 30, 90];

// The window in days, shared by the health widgets (agent runs, webhook deliveries).
export default function WidgetDaysSettings({
  config,
  onConfigChange,
}: {
  config: WidgetConfig;
  onConfigChange: (config: WidgetConfig) => void;
}) {
  const t = useTranslations('dashboards');
  const days = config.days ?? 30;
  return (
    <Select value={String(days)} onValueChange={(v) => onConfigChange({ days: Number(v) })}>
      <SelectTrigger size="sm" className="w-[130px]">
        <SelectValue />
      </SelectTrigger>
      <SelectContent>
        {DAYS_OPTIONS.map((n) => (
          <SelectItem key={n} value={String(n)}>
            {t('lastDays', { days: n })}
          </SelectItem>
        ))}
      </SelectContent>
    </Select>
  );
}