⭐️⭐️⭐️ 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.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
import { useDraggable } from '@dnd-kit/core';
import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import type { Issue } from '@/lib/api/endpoints/issues';
import { useIsPhone } from '@/hooks/useIsPhone';
import { usePermissions } from '@/hooks/usePermissions';
import { cn } from '@/lib/utils';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import IssueContextMenu from '@/features/issue/components/actions/IssueContextMenu';
// A draggable chip inside a day cell. A click (no drag) opens the issue; a drag
// moves it to another day or the unscheduled panel.
export function CalendarDayChip({
project,
issue,
color,
onOpen,
}: {
project: ProjectDetail;
issue: Issue;
color: string;
onOpen: (id: number) => void;
}) {
// Drag is disabled on phones, and without work_items edit (rescheduling an
// issue is an issue edit).
const { can } = usePermissions();
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
id: issue.id,
disabled: useIsPhone() || !can('work_items', 'edit'),
});
return (
<Tooltip>
<IssueContextMenu project={project} issue={issue}>
<TooltipTrigger asChild>
<div
ref={setNodeRef}
{...attributes}
{...listeners}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onOpen(issue.id);
}}
className={cn(
'flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 text-xs transition-colors hover:bg-accent',
isDragging && 'opacity-40',
)}
>
<span
className="inline-block size-1.5 shrink-0 rounded-full"
style={{ backgroundColor: color }}
/>
<span className="truncate text-foreground">{issue.title}</span>
</div>
</TooltipTrigger>
</IssueContextMenu>
<TooltipContent>{`${issue.identifier} ${issue.title}`}</TooltipContent>
</Tooltip>
);
}