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.

1.2 KB
Raw Blame
'use client';

import { useTranslations } from 'next-intl';
import { useShell } from '@/context/shellContext';
import { Skeleton } from '@/components/ui/skeleton';
import { useCycleQuery } from '@/services/cycles.service';
import { titlePath, useDocumentTitle } from '@/hooks/useDocumentTitle';
import CycleHeader from './components/detail/CycleHeader';
import CycleIssuesBoard from './components/detail/CycleIssuesBoard';

// One cycle: its header over the board of the issues planned into it.
export default function CycleDetailPage({ cycleId }: { cycleId: number }) {
  const t = useTranslations('cycles');
  const { project } = useShell();
  const projectKey = project?.project.ref ?? null;
  const query = useCycleQuery(cycleId);
  const cycle = query.data;
  useDocumentTitle(titlePath(project?.project.name, !query.isError && cycle?.name));

  if (!project || !projectKey) return null;
  if (!cycle)
    return query.isLoading ? (
      <Skeleton className="m-6 h-8 w-64" />
    ) : (
      <p className="px-6 py-8 text-sm text-muted-foreground">{t('notFound')}</p>
    );

  return (
    <div className="flex min-h-0 flex-1 flex-col">
      <CycleHeader cycle={cycle} projectKey={projectKey} />
      <CycleIssuesBoard cycle={cycle} />
    </div>
  );
}