feat(frontend): implement main dashboard page (#48)
Implement the main dashboard / projects list page for Syndarix as the landing page after login. The implementation includes: Dashboard Components: - QuickStats: Overview cards showing active projects, agents, issues, approvals - ProjectsSection: Grid/list view with filtering and sorting controls - ProjectCardGrid: Rich project cards for grid view - ProjectRowList: Compact rows for list view - ActivityFeed: Real-time activity sidebar with connection status - PerformanceCard: Performance metrics display - EmptyState: Call-to-action for new users - ProjectStatusBadge: Status indicator with icons - ComplexityIndicator: Visual complexity dots - ProgressBar: Accessible progress bar component Features: - Projects grid/list view with view mode toggle - Filter by status (all, active, paused, completed, archived) - Sort by recent, name, progress, or issues - Quick stats overview with counts - Real-time activity feed sidebar with live/reconnecting status - Performance metrics card - Create project button linking to wizard - Responsive layout for mobile/desktop - Loading skeleton states - Empty state for new users API Integration: - useProjects hook for fetching projects (mock data until backend ready) - useDashboardStats hook for statistics - TanStack Query for caching and data fetching Testing: - 37 unit tests covering all dashboard components - E2E test suite for dashboard functionality - Accessibility tests (keyboard nav, aria attributes, heading hierarchy) Technical: - TypeScript strict mode compliance - ESLint passing - WCAG AA accessibility compliance - Mobile-first responsive design - Dark mode support via semantic tokens - Follows design system guidelines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
84
frontend/src/features/issues/components/ActivityTimeline.tsx
Normal file
84
frontend/src/features/issues/components/ActivityTimeline.tsx
Normal file
@@ -0,0 +1,84 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* ActivityTimeline Component
|
||||
*
|
||||
* Displays issue activity history.
|
||||
*
|
||||
* @module features/issues/components/ActivityTimeline
|
||||
*/
|
||||
|
||||
import { MessageSquare, Bot, User } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssueActivity } from '../types';
|
||||
|
||||
interface ActivityTimelineProps {
|
||||
activities: IssueActivity[];
|
||||
onAddComment?: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function ActivityTimeline({
|
||||
activities,
|
||||
onAddComment,
|
||||
className,
|
||||
}: ActivityTimelineProps) {
|
||||
return (
|
||||
<Card className={className}>
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<MessageSquare className="h-5 w-5" aria-hidden="true" />
|
||||
Activity
|
||||
</CardTitle>
|
||||
{onAddComment && (
|
||||
<Button variant="outline" size="sm" onClick={onAddComment}>
|
||||
Add Comment
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-6" role="list" aria-label="Issue activity">
|
||||
{activities.map((item, index) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className="flex gap-4"
|
||||
role="listitem"
|
||||
>
|
||||
<div className="relative flex flex-col items-center">
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-muted">
|
||||
{item.actor.type === 'agent' ? (
|
||||
<Bot className="h-4 w-4" aria-hidden="true" />
|
||||
) : (
|
||||
<User className="h-4 w-4" aria-hidden="true" />
|
||||
)}
|
||||
</div>
|
||||
{index < activities.length - 1 && (
|
||||
<div className="absolute top-8 h-full w-px bg-border" aria-hidden="true" />
|
||||
)}
|
||||
</div>
|
||||
<div className={cn('flex-1', index < activities.length - 1 && 'pb-6')}>
|
||||
<div className="flex flex-wrap items-baseline gap-2">
|
||||
<span className="font-medium">{item.actor.name}</span>
|
||||
<span className="text-sm text-muted-foreground">{item.message}</span>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<time dateTime={item.timestamp}>{item.timestamp}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{activities.length === 0 && (
|
||||
<div className="py-8 text-center text-muted-foreground">
|
||||
No activity yet
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
70
frontend/src/features/issues/components/BulkActions.tsx
Normal file
70
frontend/src/features/issues/components/BulkActions.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* BulkActions Component
|
||||
*
|
||||
* Actions bar for bulk operations on selected issues.
|
||||
*
|
||||
* @module features/issues/components/BulkActions
|
||||
*/
|
||||
|
||||
import { Trash2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface BulkActionsProps {
|
||||
selectedCount: number;
|
||||
onChangeStatus: () => void;
|
||||
onAssign: () => void;
|
||||
onAddLabels: () => void;
|
||||
onDelete: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function BulkActions({
|
||||
selectedCount,
|
||||
onChangeStatus,
|
||||
onAssign,
|
||||
onAddLabels,
|
||||
onDelete,
|
||||
className,
|
||||
}: BulkActionsProps) {
|
||||
if (selectedCount === 0) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center gap-4 rounded-lg border bg-muted/50 p-3',
|
||||
className
|
||||
)}
|
||||
role="toolbar"
|
||||
aria-label="Bulk actions for selected issues"
|
||||
>
|
||||
<span className="text-sm font-medium">
|
||||
{selectedCount} selected
|
||||
</span>
|
||||
<Separator orientation="vertical" className="h-6" />
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" size="sm" onClick={onChangeStatus}>
|
||||
Change Status
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={onAssign}>
|
||||
Assign
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={onAddLabels}>
|
||||
Add Labels
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="text-destructive hover:text-destructive"
|
||||
onClick={onDelete}
|
||||
>
|
||||
<Trash2 className="mr-2 h-4 w-4" aria-hidden="true" />
|
||||
Delete
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
163
frontend/src/features/issues/components/IssueDetailPanel.tsx
Normal file
163
frontend/src/features/issues/components/IssueDetailPanel.tsx
Normal file
@@ -0,0 +1,163 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* IssueDetailPanel Component
|
||||
*
|
||||
* Side panel showing issue details (assignee, labels, sprint, etc.)
|
||||
*
|
||||
* @module features/issues/components/IssueDetailPanel
|
||||
*/
|
||||
|
||||
import { GitBranch, GitPullRequest, Tag, Bot, User } from 'lucide-react';
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssueDetail } from '../types';
|
||||
|
||||
interface IssueDetailPanelProps {
|
||||
issue: IssueDetail;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function IssueDetailPanel({ issue, className }: IssueDetailPanelProps) {
|
||||
return (
|
||||
<div className={cn('space-y-6', className)}>
|
||||
{/* Assignment Panel */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg">Details</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
{/* Assignee */}
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Assignee</p>
|
||||
{issue.assignee ? (
|
||||
<div className="mt-1 flex items-center gap-2">
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-sm font-medium text-primary">
|
||||
{issue.assignee.avatar ||
|
||||
(issue.assignee.type === 'agent' ? (
|
||||
<Bot className="h-4 w-4" aria-hidden="true" />
|
||||
) : (
|
||||
<User className="h-4 w-4" aria-hidden="true" />
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-medium">{issue.assignee.name}</p>
|
||||
<p className="text-xs text-muted-foreground capitalize">
|
||||
{issue.assignee.type}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="mt-1 text-sm text-muted-foreground">Unassigned</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* Reporter */}
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Reporter</p>
|
||||
<div className="mt-1 flex items-center gap-2">
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-muted text-sm font-medium">
|
||||
{issue.reporter.avatar ||
|
||||
(issue.reporter.type === 'agent' ? (
|
||||
<Bot className="h-4 w-4" aria-hidden="true" />
|
||||
) : (
|
||||
<User className="h-4 w-4" aria-hidden="true" />
|
||||
))}
|
||||
</div>
|
||||
<p className="font-medium">{issue.reporter.name}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* Sprint */}
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Sprint</p>
|
||||
<p className="font-medium">{issue.sprint || 'Backlog'}</p>
|
||||
</div>
|
||||
|
||||
{/* Story Points */}
|
||||
{issue.story_points !== null && (
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Story Points</p>
|
||||
<p className="font-medium">{issue.story_points}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Due Date */}
|
||||
{issue.due_date && (
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Due Date</p>
|
||||
<p className="font-medium">
|
||||
{new Date(issue.due_date).toLocaleDateString()}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* Labels */}
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">Labels</p>
|
||||
<div className="mt-2 flex flex-wrap gap-1">
|
||||
{issue.labels.map((label) => (
|
||||
<Badge
|
||||
key={label.id}
|
||||
variant="secondary"
|
||||
className="text-xs"
|
||||
style={
|
||||
label.color
|
||||
? { backgroundColor: `${label.color}20`, color: label.color }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Tag className="mr-1 h-3 w-3" aria-hidden="true" />
|
||||
{label.name}
|
||||
</Badge>
|
||||
))}
|
||||
{issue.labels.length === 0 && (
|
||||
<span className="text-sm text-muted-foreground">No labels</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Development */}
|
||||
{(issue.branch || issue.pull_request) && (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg">Development</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
{issue.branch && (
|
||||
<div className="flex items-center gap-2">
|
||||
<GitBranch
|
||||
className="h-4 w-4 text-muted-foreground"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="font-mono text-sm">{issue.branch}</span>
|
||||
</div>
|
||||
)}
|
||||
{issue.pull_request && (
|
||||
<div className="flex items-center gap-2">
|
||||
<GitPullRequest
|
||||
className="h-4 w-4 text-muted-foreground"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="text-sm">{issue.pull_request}</span>
|
||||
<Badge variant="outline" className="text-xs">
|
||||
Open
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
205
frontend/src/features/issues/components/IssueFilters.tsx
Normal file
205
frontend/src/features/issues/components/IssueFilters.tsx
Normal file
@@ -0,0 +1,205 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* IssueFilters Component
|
||||
*
|
||||
* Filter controls for the issue list.
|
||||
*
|
||||
* @module features/issues/components/IssueFilters
|
||||
*/
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Search, Filter } from 'lucide-react';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssueFilters as IssueFiltersType, IssueStatus, IssuePriority } from '../types';
|
||||
import { STATUS_ORDER, PRIORITY_ORDER, STATUS_CONFIG, PRIORITY_CONFIG } from '../constants';
|
||||
import { mockSprints, mockAssignees } from '../mocks';
|
||||
|
||||
interface IssueFiltersProps {
|
||||
filters: IssueFiltersType;
|
||||
onFiltersChange: (filters: IssueFiltersType) => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function IssueFilters({ filters, onFiltersChange, className }: IssueFiltersProps) {
|
||||
const [showExtended, setShowExtended] = useState(false);
|
||||
|
||||
const handleSearchChange = (value: string) => {
|
||||
onFiltersChange({ ...filters, search: value || undefined });
|
||||
};
|
||||
|
||||
const handleStatusChange = (value: string) => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
status: value as IssueStatus | 'all',
|
||||
});
|
||||
};
|
||||
|
||||
const handlePriorityChange = (value: string) => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
priority: value as IssuePriority | 'all',
|
||||
});
|
||||
};
|
||||
|
||||
const handleSprintChange = (value: string) => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
sprint: value as string | 'all' | 'backlog',
|
||||
});
|
||||
};
|
||||
|
||||
const handleAssigneeChange = (value: string) => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
assignee: value as string | 'all' | 'unassigned',
|
||||
});
|
||||
};
|
||||
|
||||
const handleClearFilters = () => {
|
||||
onFiltersChange({
|
||||
search: undefined,
|
||||
status: 'all',
|
||||
priority: 'all',
|
||||
sprint: 'all',
|
||||
assignee: 'all',
|
||||
labels: undefined,
|
||||
});
|
||||
};
|
||||
|
||||
const hasActiveFilters =
|
||||
filters.search ||
|
||||
(filters.status && filters.status !== 'all') ||
|
||||
(filters.priority && filters.priority !== 'all') ||
|
||||
(filters.sprint && filters.sprint !== 'all') ||
|
||||
(filters.assignee && filters.assignee !== 'all');
|
||||
|
||||
return (
|
||||
<div className={cn('space-y-4', className)}>
|
||||
{/* Search and Quick Filters */}
|
||||
<div className="flex flex-col gap-4 sm:flex-row">
|
||||
<div className="relative flex-1">
|
||||
<Search
|
||||
className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<Input
|
||||
id="issue-search"
|
||||
placeholder="Search issues..."
|
||||
value={filters.search || ''}
|
||||
onChange={(e) => handleSearchChange(e.target.value)}
|
||||
className="pl-9"
|
||||
aria-label="Search issues"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Select value={filters.status || 'all'} onValueChange={handleStatusChange}>
|
||||
<SelectTrigger className="w-32" aria-label="Filter by status">
|
||||
<SelectValue placeholder="Status" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All Status</SelectItem>
|
||||
{STATUS_ORDER.map((status) => (
|
||||
<SelectItem key={status} value={status}>
|
||||
{STATUS_CONFIG[status].label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={() => setShowExtended(!showExtended)}
|
||||
className={cn(showExtended && 'bg-muted')}
|
||||
aria-expanded={showExtended}
|
||||
aria-label="Toggle extended filters"
|
||||
>
|
||||
<Filter className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Extended Filters */}
|
||||
{showExtended && (
|
||||
<Card className="p-4">
|
||||
<div className="grid gap-4 sm:grid-cols-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="priority-filter">Priority</Label>
|
||||
<Select
|
||||
value={filters.priority || 'all'}
|
||||
onValueChange={handlePriorityChange}
|
||||
>
|
||||
<SelectTrigger id="priority-filter">
|
||||
<SelectValue placeholder="All" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All</SelectItem>
|
||||
{PRIORITY_ORDER.map((priority) => (
|
||||
<SelectItem key={priority} value={priority}>
|
||||
{PRIORITY_CONFIG[priority].label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sprint-filter">Sprint</Label>
|
||||
<Select value={filters.sprint || 'all'} onValueChange={handleSprintChange}>
|
||||
<SelectTrigger id="sprint-filter">
|
||||
<SelectValue placeholder="All" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All Sprints</SelectItem>
|
||||
{mockSprints.map((sprint) => (
|
||||
<SelectItem key={sprint} value={sprint}>
|
||||
{sprint}
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectItem value="backlog">Backlog</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="assignee-filter">Assignee</Label>
|
||||
<Select
|
||||
value={filters.assignee || 'all'}
|
||||
onValueChange={handleAssigneeChange}
|
||||
>
|
||||
<SelectTrigger id="assignee-filter">
|
||||
<SelectValue placeholder="All" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All</SelectItem>
|
||||
<SelectItem value="unassigned">Unassigned</SelectItem>
|
||||
{mockAssignees.map((assignee) => (
|
||||
<SelectItem key={assignee.id} value={assignee.id}>
|
||||
{assignee.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-end">
|
||||
{hasActiveFilters && (
|
||||
<Button variant="ghost" size="sm" onClick={handleClearFilters}>
|
||||
Clear Filters
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
265
frontend/src/features/issues/components/IssueTable.tsx
Normal file
265
frontend/src/features/issues/components/IssueTable.tsx
Normal file
@@ -0,0 +1,265 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* IssueTable Component
|
||||
*
|
||||
* Sortable table displaying issues with selection support.
|
||||
*
|
||||
* @module features/issues/components/IssueTable
|
||||
*/
|
||||
|
||||
import { ChevronUp, ChevronDown, MoreVertical, Bot, User, CircleDot } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import type { IssueSummary, IssueSort, IssueSortField, IssueSortDirection } from '../types';
|
||||
|
||||
/**
|
||||
* Convert our sort direction to ARIA sort value
|
||||
*/
|
||||
function toAriaSortValue(
|
||||
field: IssueSortField,
|
||||
currentField: IssueSortField,
|
||||
direction: IssueSortDirection
|
||||
): 'ascending' | 'descending' | 'none' | undefined {
|
||||
if (field !== currentField) return undefined;
|
||||
return direction === 'asc' ? 'ascending' : 'descending';
|
||||
}
|
||||
|
||||
import { StatusBadge } from './StatusBadge';
|
||||
import { PriorityBadge } from './PriorityBadge';
|
||||
import { SyncStatusIndicator } from './SyncStatusIndicator';
|
||||
|
||||
interface IssueTableProps {
|
||||
issues: IssueSummary[];
|
||||
selectedIssues: string[];
|
||||
onSelectionChange: (ids: string[]) => void;
|
||||
onIssueClick: (id: string) => void;
|
||||
sort: IssueSort;
|
||||
onSortChange: (sort: IssueSort) => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function IssueTable({
|
||||
issues,
|
||||
selectedIssues,
|
||||
onSelectionChange,
|
||||
onIssueClick,
|
||||
sort,
|
||||
onSortChange,
|
||||
className,
|
||||
}: IssueTableProps) {
|
||||
const handleSelectAll = () => {
|
||||
if (selectedIssues.length === issues.length) {
|
||||
onSelectionChange([]);
|
||||
} else {
|
||||
onSelectionChange(issues.map((i) => i.id));
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectIssue = (id: string, e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
if (selectedIssues.includes(id)) {
|
||||
onSelectionChange(selectedIssues.filter((i) => i !== id));
|
||||
} else {
|
||||
onSelectionChange([...selectedIssues, id]);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSort = (field: IssueSortField) => {
|
||||
if (sort.field === field) {
|
||||
onSortChange({
|
||||
field,
|
||||
direction: sort.direction === 'asc' ? 'desc' : 'asc',
|
||||
});
|
||||
} else {
|
||||
onSortChange({ field, direction: 'desc' });
|
||||
}
|
||||
};
|
||||
|
||||
const SortIcon = ({ field }: { field: IssueSortField }) => {
|
||||
if (sort.field !== field) return null;
|
||||
return sort.direction === 'asc' ? (
|
||||
<ChevronUp className="ml-1 inline h-4 w-4" aria-hidden="true" />
|
||||
) : (
|
||||
<ChevronDown className="ml-1 inline h-4 w-4" aria-hidden="true" />
|
||||
);
|
||||
};
|
||||
|
||||
const allSelected = selectedIssues.length === issues.length && issues.length > 0;
|
||||
const someSelected = selectedIssues.length > 0 && !allSelected;
|
||||
|
||||
return (
|
||||
<Card className={className}>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-12">
|
||||
<Checkbox
|
||||
checked={allSelected}
|
||||
ref={(el) => {
|
||||
if (el) {
|
||||
(el as unknown as HTMLInputElement).indeterminate = someSelected;
|
||||
}
|
||||
}}
|
||||
onCheckedChange={handleSelectAll}
|
||||
aria-label={allSelected ? 'Deselect all issues' : 'Select all issues'}
|
||||
/>
|
||||
</TableHead>
|
||||
<TableHead
|
||||
className="w-20 cursor-pointer select-none"
|
||||
onClick={() => handleSort('number')}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-sort={toAriaSortValue('number', sort.field, sort.direction)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleSort('number')}
|
||||
>
|
||||
#
|
||||
<SortIcon field="number" />
|
||||
</TableHead>
|
||||
<TableHead>Title</TableHead>
|
||||
<TableHead className="w-32">Status</TableHead>
|
||||
<TableHead
|
||||
className="w-24 cursor-pointer select-none"
|
||||
onClick={() => handleSort('priority')}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-sort={toAriaSortValue('priority', sort.field, sort.direction)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleSort('priority')}
|
||||
>
|
||||
Priority
|
||||
<SortIcon field="priority" />
|
||||
</TableHead>
|
||||
<TableHead className="w-40">Assignee</TableHead>
|
||||
<TableHead className="w-28">Sprint</TableHead>
|
||||
<TableHead className="w-10">Sync</TableHead>
|
||||
<TableHead className="w-10">
|
||||
<span className="sr-only">Actions</span>
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{issues.map((issue) => (
|
||||
<TableRow
|
||||
key={issue.id}
|
||||
className="cursor-pointer"
|
||||
onClick={() => onIssueClick(issue.id)}
|
||||
data-testid={`issue-row-${issue.id}`}
|
||||
>
|
||||
<TableCell onClick={(e) => handleSelectIssue(issue.id, e)}>
|
||||
<Checkbox
|
||||
checked={selectedIssues.includes(issue.id)}
|
||||
onCheckedChange={() => {}}
|
||||
aria-label={`Select issue ${issue.number}`}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="font-mono text-sm text-muted-foreground">
|
||||
{issue.number}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="space-y-1">
|
||||
<p className="font-medium">{issue.title}</p>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{issue.labels.slice(0, 3).map((label) => (
|
||||
<Badge key={label} variant="secondary" className="text-xs">
|
||||
{label}
|
||||
</Badge>
|
||||
))}
|
||||
{issue.labels.length > 3 && (
|
||||
<Badge variant="outline" className="text-xs">
|
||||
+{issue.labels.length - 3}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<StatusBadge status={issue.status} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<PriorityBadge priority={issue.priority} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{issue.assignee ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary">
|
||||
{issue.assignee.type === 'agent' ? (
|
||||
<Bot className="h-3 w-3" aria-hidden="true" />
|
||||
) : (
|
||||
<User className="h-3 w-3" aria-hidden="true" />
|
||||
)}
|
||||
</div>
|
||||
<span className="text-sm">{issue.assignee.name}</span>
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-sm text-muted-foreground">Unassigned</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{issue.sprint ? (
|
||||
<Badge variant="outline" className="text-xs">
|
||||
{issue.sprint}
|
||||
</Badge>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">Backlog</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<SyncStatusIndicator status={issue.sync_status} />
|
||||
</TableCell>
|
||||
<TableCell onClick={(e) => e.stopPropagation()}>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
aria-label={`Actions for issue ${issue.number}`}
|
||||
>
|
||||
<MoreVertical className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => onIssueClick(issue.id)}>
|
||||
View Details
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>Edit</DropdownMenuItem>
|
||||
<DropdownMenuItem>Assign</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem>Sync with Tracker</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem className="text-destructive">Delete</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
{issues.length === 0 && (
|
||||
<div className="py-12 text-center">
|
||||
<CircleDot className="mx-auto h-12 w-12 text-muted-foreground" aria-hidden="true" />
|
||||
<h3 className="mt-4 font-semibold">No issues found</h3>
|
||||
<p className="text-muted-foreground">Try adjusting your search or filters</p>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
29
frontend/src/features/issues/components/PriorityBadge.tsx
Normal file
29
frontend/src/features/issues/components/PriorityBadge.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* PriorityBadge Component
|
||||
*
|
||||
* Displays issue priority with appropriate styling.
|
||||
*
|
||||
* @module features/issues/components/PriorityBadge
|
||||
*/
|
||||
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssuePriority } from '../types';
|
||||
import { PRIORITY_CONFIG } from '../constants';
|
||||
|
||||
interface PriorityBadgeProps {
|
||||
priority: IssuePriority;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function PriorityBadge({ priority, className }: PriorityBadgeProps) {
|
||||
const config = PRIORITY_CONFIG[priority] || PRIORITY_CONFIG.medium;
|
||||
|
||||
return (
|
||||
<Badge className={cn(config.color, className)} variant="outline">
|
||||
{config.label}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
51
frontend/src/features/issues/components/StatusBadge.tsx
Normal file
51
frontend/src/features/issues/components/StatusBadge.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* StatusBadge Component
|
||||
*
|
||||
* Displays issue status with appropriate icon and color.
|
||||
*
|
||||
* @module features/issues/components/StatusBadge
|
||||
*/
|
||||
|
||||
import {
|
||||
CircleDot,
|
||||
PlayCircle,
|
||||
Clock,
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
XCircle,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssueStatus } from '../types';
|
||||
import { STATUS_CONFIG } from '../constants';
|
||||
|
||||
const STATUS_ICONS = {
|
||||
open: CircleDot,
|
||||
in_progress: PlayCircle,
|
||||
in_review: Clock,
|
||||
blocked: AlertCircle,
|
||||
done: CheckCircle2,
|
||||
closed: XCircle,
|
||||
} as const;
|
||||
|
||||
interface StatusBadgeProps {
|
||||
status: IssueStatus;
|
||||
className?: string;
|
||||
showLabel?: boolean;
|
||||
}
|
||||
|
||||
export function StatusBadge({ status, className, showLabel = true }: StatusBadgeProps) {
|
||||
const config = STATUS_CONFIG[status] || STATUS_CONFIG.open;
|
||||
const Icon = STATUS_ICONS[status] || CircleDot;
|
||||
|
||||
return (
|
||||
<div className={cn('flex items-center gap-1.5', config.color, className)}>
|
||||
<Icon className="h-4 w-4" aria-hidden="true" />
|
||||
{showLabel && (
|
||||
<span className="text-sm font-medium">{config.label}</span>
|
||||
)}
|
||||
<span className="sr-only">{config.label}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
86
frontend/src/features/issues/components/StatusWorkflow.tsx
Normal file
86
frontend/src/features/issues/components/StatusWorkflow.tsx
Normal file
@@ -0,0 +1,86 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* StatusWorkflow Component
|
||||
*
|
||||
* Interactive status selector with workflow transitions.
|
||||
*
|
||||
* @module features/issues/components/StatusWorkflow
|
||||
*/
|
||||
|
||||
import {
|
||||
CircleDot,
|
||||
PlayCircle,
|
||||
Clock,
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
XCircle,
|
||||
} from 'lucide-react';
|
||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { IssueStatus } from '../types';
|
||||
import { STATUS_ORDER, STATUS_CONFIG } from '../constants';
|
||||
|
||||
const STATUS_ICONS = {
|
||||
open: CircleDot,
|
||||
in_progress: PlayCircle,
|
||||
in_review: Clock,
|
||||
blocked: AlertCircle,
|
||||
done: CheckCircle2,
|
||||
closed: XCircle,
|
||||
} as const;
|
||||
|
||||
interface StatusWorkflowProps {
|
||||
currentStatus: IssueStatus;
|
||||
onStatusChange: (status: IssueStatus) => void;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function StatusWorkflow({
|
||||
currentStatus,
|
||||
onStatusChange,
|
||||
disabled = false,
|
||||
className,
|
||||
}: StatusWorkflowProps) {
|
||||
return (
|
||||
<Card className={className}>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg">Status Workflow</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-2" role="radiogroup" aria-label="Issue status">
|
||||
{STATUS_ORDER.map((status) => {
|
||||
const config = STATUS_CONFIG[status];
|
||||
const Icon = STATUS_ICONS[status];
|
||||
const isActive = currentStatus === status;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={status}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={isActive}
|
||||
disabled={disabled}
|
||||
className={cn(
|
||||
'flex w-full items-center gap-2 rounded-lg p-2 text-left transition-colors',
|
||||
isActive
|
||||
? 'bg-primary/10 text-primary'
|
||||
: 'hover:bg-muted',
|
||||
disabled && 'cursor-not-allowed opacity-50'
|
||||
)}
|
||||
onClick={() => !disabled && onStatusChange(status)}
|
||||
>
|
||||
<Icon className={cn('h-4 w-4', config.color)} aria-hidden="true" />
|
||||
<span className="text-sm">{config.label}</span>
|
||||
{isActive && (
|
||||
<CheckCircle2 className="ml-auto h-4 w-4" aria-hidden="true" />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* SyncStatusIndicator Component
|
||||
*
|
||||
* Displays sync status with external issue trackers.
|
||||
*
|
||||
* @module features/issues/components/SyncStatusIndicator
|
||||
*/
|
||||
|
||||
import { CheckCircle2, RefreshCw, AlertCircle, AlertTriangle } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { SyncStatus } from '../types';
|
||||
import { SYNC_STATUS_CONFIG } from '../constants';
|
||||
|
||||
const SYNC_ICONS = {
|
||||
synced: CheckCircle2,
|
||||
pending: RefreshCw,
|
||||
conflict: AlertTriangle,
|
||||
error: AlertCircle,
|
||||
} as const;
|
||||
|
||||
interface SyncStatusIndicatorProps {
|
||||
status: SyncStatus;
|
||||
className?: string;
|
||||
showLabel?: boolean;
|
||||
}
|
||||
|
||||
export function SyncStatusIndicator({
|
||||
status,
|
||||
className,
|
||||
showLabel = false,
|
||||
}: SyncStatusIndicatorProps) {
|
||||
const config = SYNC_STATUS_CONFIG[status] || SYNC_STATUS_CONFIG.synced;
|
||||
const Icon = SYNC_ICONS[status] || CheckCircle2;
|
||||
const isPending = status === 'pending';
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn('flex items-center gap-1', className)}
|
||||
title={config.label}
|
||||
role="status"
|
||||
aria-label={`Sync status: ${config.label}`}
|
||||
>
|
||||
<Icon
|
||||
className={cn('h-3.5 w-3.5', config.color, isPending && 'animate-spin')}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{showLabel && <span className={cn('text-xs', config.color)}>{config.label}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
15
frontend/src/features/issues/components/index.ts
Normal file
15
frontend/src/features/issues/components/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Issue Management Components
|
||||
*
|
||||
* @module features/issues/components
|
||||
*/
|
||||
|
||||
export { StatusBadge } from './StatusBadge';
|
||||
export { PriorityBadge } from './PriorityBadge';
|
||||
export { SyncStatusIndicator } from './SyncStatusIndicator';
|
||||
export { IssueFilters } from './IssueFilters';
|
||||
export { IssueTable } from './IssueTable';
|
||||
export { BulkActions } from './BulkActions';
|
||||
export { StatusWorkflow } from './StatusWorkflow';
|
||||
export { ActivityTimeline } from './ActivityTimeline';
|
||||
export { IssueDetailPanel } from './IssueDetailPanel';
|
||||
106
frontend/src/features/issues/constants.ts
Normal file
106
frontend/src/features/issues/constants.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Issue Management Constants
|
||||
*
|
||||
* Configuration for status, priority, and workflow.
|
||||
*
|
||||
* @module features/issues/constants
|
||||
*/
|
||||
|
||||
import type {
|
||||
IssueStatus,
|
||||
IssuePriority,
|
||||
StatusConfig,
|
||||
PriorityConfig,
|
||||
StatusTransition,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* Status configuration with labels and colors
|
||||
*/
|
||||
export const STATUS_CONFIG: Record<IssueStatus, StatusConfig> = {
|
||||
open: { label: 'Open', color: 'text-blue-500' },
|
||||
in_progress: { label: 'In Progress', color: 'text-yellow-500' },
|
||||
in_review: { label: 'In Review', color: 'text-purple-500' },
|
||||
blocked: { label: 'Blocked', color: 'text-red-500' },
|
||||
done: { label: 'Done', color: 'text-green-500' },
|
||||
closed: { label: 'Closed', color: 'text-muted-foreground' },
|
||||
};
|
||||
|
||||
/**
|
||||
* Priority configuration with labels and colors
|
||||
*/
|
||||
export const PRIORITY_CONFIG: Record<IssuePriority, PriorityConfig> = {
|
||||
high: { label: 'High', color: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200' },
|
||||
medium: {
|
||||
label: 'Medium',
|
||||
color: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200',
|
||||
},
|
||||
low: { label: 'Low', color: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' },
|
||||
};
|
||||
|
||||
/**
|
||||
* Status workflow transitions
|
||||
* Defines which status transitions are available from each status
|
||||
*/
|
||||
export const STATUS_TRANSITIONS: StatusTransition[] = [
|
||||
{ from: 'open', to: 'in_progress', label: 'Start Work' },
|
||||
{ from: 'in_progress', to: 'in_review', label: 'Submit for Review' },
|
||||
{ from: 'in_progress', to: 'blocked', label: 'Mark Blocked' },
|
||||
{ from: 'in_review', to: 'done', label: 'Mark Done' },
|
||||
{ from: 'in_review', to: 'in_progress', label: 'Request Changes' },
|
||||
{ from: 'blocked', to: 'in_progress', label: 'Unblock' },
|
||||
{ from: 'done', to: 'closed', label: 'Close Issue' },
|
||||
{ from: 'closed', to: 'open', label: 'Reopen' },
|
||||
];
|
||||
|
||||
/**
|
||||
* Get available transitions for a given status
|
||||
*/
|
||||
export function getAvailableTransitions(currentStatus: IssueStatus): StatusTransition[] {
|
||||
return STATUS_TRANSITIONS.filter((t) => t.from === currentStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get primary transition for a given status (the main workflow action)
|
||||
*/
|
||||
export function getPrimaryTransition(currentStatus: IssueStatus): StatusTransition | undefined {
|
||||
const transitions = getAvailableTransitions(currentStatus);
|
||||
return transitions[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* All possible statuses in workflow order
|
||||
*/
|
||||
export const STATUS_ORDER: IssueStatus[] = [
|
||||
'open',
|
||||
'in_progress',
|
||||
'in_review',
|
||||
'blocked',
|
||||
'done',
|
||||
'closed',
|
||||
];
|
||||
|
||||
/**
|
||||
* All possible priorities in order
|
||||
*/
|
||||
export const PRIORITY_ORDER: IssuePriority[] = ['high', 'medium', 'low'];
|
||||
|
||||
/**
|
||||
* Sync status configuration
|
||||
*/
|
||||
export const SYNC_STATUS_CONFIG = {
|
||||
synced: { label: 'Synced', color: 'text-green-500' },
|
||||
pending: { label: 'Syncing', color: 'text-yellow-500' },
|
||||
conflict: { label: 'Conflict', color: 'text-orange-500' },
|
||||
error: { label: 'Sync Error', color: 'text-red-500' },
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Default page size for issue list
|
||||
*/
|
||||
export const DEFAULT_PAGE_SIZE = 25;
|
||||
|
||||
/**
|
||||
* Maximum issues for bulk actions
|
||||
*/
|
||||
export const MAX_BULK_SELECTION = 100;
|
||||
15
frontend/src/features/issues/hooks/index.ts
Normal file
15
frontend/src/features/issues/hooks/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Issue Management Hooks
|
||||
*
|
||||
* @module features/issues/hooks
|
||||
*/
|
||||
|
||||
export {
|
||||
useIssues,
|
||||
useIssue,
|
||||
useUpdateIssue,
|
||||
useUpdateIssueStatus,
|
||||
useBulkIssueAction,
|
||||
useSyncIssue,
|
||||
issueKeys,
|
||||
} from './useIssues';
|
||||
332
frontend/src/features/issues/hooks/useIssues.ts
Normal file
332
frontend/src/features/issues/hooks/useIssues.ts
Normal file
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* Issue Management React Query Hooks
|
||||
*
|
||||
* Hooks for fetching and mutating issues.
|
||||
* Uses TanStack Query for server state management.
|
||||
*
|
||||
* Note: Until backend API is implemented, these hooks use mock data.
|
||||
* The API integration points are marked for future implementation.
|
||||
*
|
||||
* @module features/issues/hooks/useIssues
|
||||
*/
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import type {
|
||||
IssueSummary,
|
||||
IssueDetail,
|
||||
IssueFilters,
|
||||
IssueSort,
|
||||
IssueUpdateRequest,
|
||||
IssueBulkActionRequest,
|
||||
PaginatedIssuesResponse,
|
||||
} from '../types';
|
||||
import { mockIssues, mockIssueDetail } from '../mocks';
|
||||
|
||||
/**
|
||||
* Query keys for issues
|
||||
*/
|
||||
export const issueKeys = {
|
||||
all: ['issues'] as const,
|
||||
lists: () => [...issueKeys.all, 'list'] as const,
|
||||
list: (projectId: string, filters?: IssueFilters, sort?: IssueSort) =>
|
||||
[...issueKeys.lists(), projectId, filters, sort] as const,
|
||||
details: () => [...issueKeys.all, 'detail'] as const,
|
||||
detail: (issueId: string) => [...issueKeys.details(), issueId] as const,
|
||||
};
|
||||
|
||||
/**
|
||||
* Mock filtering and sorting logic
|
||||
* This simulates server-side filtering until API is ready
|
||||
*/
|
||||
function filterAndSortIssues(
|
||||
issues: IssueSummary[],
|
||||
filters?: IssueFilters,
|
||||
sort?: IssueSort
|
||||
): IssueSummary[] {
|
||||
let result = [...issues];
|
||||
|
||||
if (filters) {
|
||||
// Search filter
|
||||
if (filters.search) {
|
||||
const searchLower = filters.search.toLowerCase();
|
||||
result = result.filter(
|
||||
(issue) =>
|
||||
issue.title.toLowerCase().includes(searchLower) ||
|
||||
issue.description.toLowerCase().includes(searchLower) ||
|
||||
issue.number.toString().includes(searchLower)
|
||||
);
|
||||
}
|
||||
|
||||
// Status filter
|
||||
if (filters.status && filters.status !== 'all') {
|
||||
result = result.filter((issue) => issue.status === filters.status);
|
||||
}
|
||||
|
||||
// Priority filter
|
||||
if (filters.priority && filters.priority !== 'all') {
|
||||
result = result.filter((issue) => issue.priority === filters.priority);
|
||||
}
|
||||
|
||||
// Sprint filter
|
||||
if (filters.sprint && filters.sprint !== 'all') {
|
||||
if (filters.sprint === 'backlog') {
|
||||
result = result.filter((issue) => !issue.sprint);
|
||||
} else {
|
||||
result = result.filter((issue) => issue.sprint === filters.sprint);
|
||||
}
|
||||
}
|
||||
|
||||
// Assignee filter
|
||||
if (filters.assignee && filters.assignee !== 'all') {
|
||||
if (filters.assignee === 'unassigned') {
|
||||
result = result.filter((issue) => !issue.assignee);
|
||||
} else {
|
||||
result = result.filter((issue) => issue.assignee?.id === filters.assignee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sorting
|
||||
if (sort) {
|
||||
const direction = sort.direction === 'asc' ? 1 : -1;
|
||||
result.sort((a, b) => {
|
||||
switch (sort.field) {
|
||||
case 'number':
|
||||
return (a.number - b.number) * direction;
|
||||
case 'priority': {
|
||||
const priorityOrder = { high: 3, medium: 2, low: 1 };
|
||||
return (priorityOrder[a.priority] - priorityOrder[b.priority]) * direction;
|
||||
}
|
||||
case 'updated_at':
|
||||
return (new Date(a.updated_at).getTime() - new Date(b.updated_at).getTime()) * direction;
|
||||
case 'created_at':
|
||||
return (new Date(a.created_at).getTime() - new Date(b.created_at).getTime()) * direction;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch paginated issues for a project
|
||||
*
|
||||
* @param projectId - Project ID
|
||||
* @param filters - Optional filters
|
||||
* @param sort - Optional sort configuration
|
||||
* @param page - Page number (1-based)
|
||||
* @param pageSize - Number of items per page
|
||||
*/
|
||||
export function useIssues(
|
||||
projectId: string,
|
||||
filters?: IssueFilters,
|
||||
sort?: IssueSort,
|
||||
page: number = 1,
|
||||
pageSize: number = 25
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: issueKeys.list(projectId, filters, sort),
|
||||
queryFn: async (): Promise<PaginatedIssuesResponse> => {
|
||||
// TODO: Replace with actual API call when backend is ready
|
||||
// const response = await getProjectIssues({
|
||||
// path: { project_id: projectId },
|
||||
// query: { ...filters, ...sort, page, page_size: pageSize },
|
||||
// });
|
||||
|
||||
// Simulate API delay
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
|
||||
const filteredIssues = filterAndSortIssues(mockIssues, filters, sort);
|
||||
const start = (page - 1) * pageSize;
|
||||
const paginatedIssues = filteredIssues.slice(start, start + pageSize);
|
||||
|
||||
return {
|
||||
data: paginatedIssues,
|
||||
pagination: {
|
||||
total: filteredIssues.length,
|
||||
page,
|
||||
page_size: pageSize,
|
||||
total_pages: Math.ceil(filteredIssues.length / pageSize),
|
||||
has_next: start + pageSize < filteredIssues.length,
|
||||
has_prev: page > 1,
|
||||
},
|
||||
};
|
||||
},
|
||||
staleTime: 30000, // 30 seconds
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch a single issue detail
|
||||
*
|
||||
* @param issueId - Issue ID
|
||||
*/
|
||||
export function useIssue(issueId: string) {
|
||||
return useQuery({
|
||||
queryKey: issueKeys.detail(issueId),
|
||||
queryFn: async (): Promise<IssueDetail> => {
|
||||
// TODO: Replace with actual API call when backend is ready
|
||||
// const response = await getIssue({
|
||||
// path: { issue_id: issueId },
|
||||
// });
|
||||
|
||||
// Simulate API delay
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
// Return mock detail for any issue ID
|
||||
return {
|
||||
...mockIssueDetail,
|
||||
id: issueId,
|
||||
};
|
||||
},
|
||||
staleTime: 30000,
|
||||
enabled: !!issueId,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to update an issue
|
||||
*/
|
||||
export function useUpdateIssue() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
issueId,
|
||||
data,
|
||||
}: {
|
||||
issueId: string;
|
||||
data: IssueUpdateRequest;
|
||||
}): Promise<IssueDetail> => {
|
||||
// TODO: Replace with actual API call when backend is ready
|
||||
// const response = await updateIssue({
|
||||
// path: { issue_id: issueId },
|
||||
// body: data,
|
||||
// });
|
||||
|
||||
// Simulate API delay
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
|
||||
// Return updated mock data - only apply non-label fields from data
|
||||
return {
|
||||
...mockIssueDetail,
|
||||
id: issueId,
|
||||
title: data.title || mockIssueDetail.title,
|
||||
description: data.description || mockIssueDetail.description,
|
||||
status: data.status || mockIssueDetail.status,
|
||||
priority: data.priority || mockIssueDetail.priority,
|
||||
sprint: data.sprint !== undefined ? data.sprint : mockIssueDetail.sprint,
|
||||
due_date: data.due_date !== undefined ? data.due_date : mockIssueDetail.due_date,
|
||||
};
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
// Invalidate and update cache
|
||||
queryClient.invalidateQueries({ queryKey: issueKeys.lists() });
|
||||
queryClient.setQueryData(issueKeys.detail(data.id), data);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to update issue status (optimistic update)
|
||||
*/
|
||||
export function useUpdateIssueStatus() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
issueId,
|
||||
status,
|
||||
}: {
|
||||
issueId: string;
|
||||
status: IssueUpdateRequest['status'];
|
||||
}): Promise<IssueDetail> => {
|
||||
// TODO: Replace with actual API call
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
|
||||
return {
|
||||
...mockIssueDetail,
|
||||
id: issueId,
|
||||
status: status || mockIssueDetail.status,
|
||||
};
|
||||
},
|
||||
onMutate: async ({ issueId, status }) => {
|
||||
// Cancel outgoing refetches
|
||||
await queryClient.cancelQueries({ queryKey: issueKeys.detail(issueId) });
|
||||
|
||||
// Snapshot previous value
|
||||
const previousIssue = queryClient.getQueryData<IssueDetail>(issueKeys.detail(issueId));
|
||||
|
||||
// Optimistically update
|
||||
if (previousIssue && status) {
|
||||
queryClient.setQueryData(issueKeys.detail(issueId), {
|
||||
...previousIssue,
|
||||
status,
|
||||
});
|
||||
}
|
||||
|
||||
return { previousIssue };
|
||||
},
|
||||
onError: (_err, { issueId }, context) => {
|
||||
// Rollback on error
|
||||
if (context?.previousIssue) {
|
||||
queryClient.setQueryData(issueKeys.detail(issueId), context.previousIssue);
|
||||
}
|
||||
},
|
||||
onSettled: () => {
|
||||
// Invalidate lists to refetch
|
||||
queryClient.invalidateQueries({ queryKey: issueKeys.lists() });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for bulk actions on issues
|
||||
*/
|
||||
export function useBulkIssueAction() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (request: IssueBulkActionRequest): Promise<{ affected_count: number }> => {
|
||||
// TODO: Replace with actual API call
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
||||
return { affected_count: request.issue_ids.length };
|
||||
},
|
||||
onSuccess: () => {
|
||||
// Invalidate all issue queries
|
||||
queryClient.invalidateQueries({ queryKey: issueKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to sync an issue with external tracker
|
||||
*/
|
||||
export function useSyncIssue() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({ issueId }: { issueId: string }): Promise<IssueSummary> => {
|
||||
// TODO: Replace with actual API call
|
||||
// const response = await syncIssue({
|
||||
// path: { issue_id: issueId },
|
||||
// body: { direction: 'bidirectional' },
|
||||
// });
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
||||
const issue = mockIssues.find((i) => i.id === issueId);
|
||||
return {
|
||||
...(issue || mockIssues[0]),
|
||||
sync_status: 'synced',
|
||||
};
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
queryClient.invalidateQueries({ queryKey: issueKeys.lists() });
|
||||
queryClient.invalidateQueries({ queryKey: issueKeys.detail(data.id) });
|
||||
},
|
||||
});
|
||||
}
|
||||
70
frontend/src/features/issues/index.ts
Normal file
70
frontend/src/features/issues/index.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Issue Management Feature
|
||||
*
|
||||
* Complete issue tracking and management for Syndarix projects.
|
||||
*
|
||||
* @module features/issues
|
||||
*/
|
||||
|
||||
// Components
|
||||
export {
|
||||
StatusBadge,
|
||||
PriorityBadge,
|
||||
SyncStatusIndicator,
|
||||
IssueFilters,
|
||||
IssueTable,
|
||||
BulkActions,
|
||||
StatusWorkflow,
|
||||
ActivityTimeline,
|
||||
IssueDetailPanel,
|
||||
} from './components';
|
||||
|
||||
// Hooks
|
||||
export {
|
||||
useIssues,
|
||||
useIssue,
|
||||
useUpdateIssue,
|
||||
useUpdateIssueStatus,
|
||||
useBulkIssueAction,
|
||||
useSyncIssue,
|
||||
issueKeys,
|
||||
} from './hooks';
|
||||
|
||||
// Types - use explicit names to avoid collision with component IssueFilters
|
||||
export type {
|
||||
IssueStatus,
|
||||
IssuePriority,
|
||||
SyncStatus,
|
||||
ActorType,
|
||||
IssueAssignee,
|
||||
IssueLabel,
|
||||
IssueActivity,
|
||||
IssueSummary,
|
||||
IssueDetail,
|
||||
IssueFilters as IssueFiltersType,
|
||||
IssueSortField,
|
||||
IssueSortDirection,
|
||||
IssueSort,
|
||||
IssueBulkAction,
|
||||
IssueBulkActionRequest,
|
||||
IssueUpdateRequest,
|
||||
IssueSyncRequest,
|
||||
StatusTransition,
|
||||
StatusConfig,
|
||||
PriorityConfig,
|
||||
PaginatedIssuesResponse,
|
||||
} from './types';
|
||||
|
||||
// Constants
|
||||
export {
|
||||
STATUS_CONFIG,
|
||||
PRIORITY_CONFIG,
|
||||
STATUS_TRANSITIONS,
|
||||
getAvailableTransitions,
|
||||
getPrimaryTransition,
|
||||
STATUS_ORDER,
|
||||
PRIORITY_ORDER,
|
||||
SYNC_STATUS_CONFIG,
|
||||
DEFAULT_PAGE_SIZE,
|
||||
MAX_BULK_SELECTION,
|
||||
} from './constants';
|
||||
252
frontend/src/features/issues/mocks.ts
Normal file
252
frontend/src/features/issues/mocks.ts
Normal file
@@ -0,0 +1,252 @@
|
||||
/**
|
||||
* Issue Management Mock Data
|
||||
*
|
||||
* Mock data for development and testing.
|
||||
* This will be removed once the backend API is implemented.
|
||||
*
|
||||
* @module features/issues/mocks
|
||||
*/
|
||||
|
||||
import type { IssueSummary, IssueDetail } from './types';
|
||||
|
||||
/**
|
||||
* Mock issues for list view
|
||||
*/
|
||||
export const mockIssues: IssueSummary[] = [
|
||||
{
|
||||
id: 'ISS-001',
|
||||
number: 42,
|
||||
title: 'Implement user authentication flow',
|
||||
description:
|
||||
'Create complete authentication flow with login, register, and password reset.',
|
||||
status: 'in_progress',
|
||||
priority: 'high',
|
||||
labels: ['feature', 'auth', 'backend'],
|
||||
sprint: 'Sprint 3',
|
||||
assignee: { id: 'agent-be', name: 'Backend Engineer', type: 'agent' },
|
||||
created_at: '2025-01-15T10:30:00Z',
|
||||
updated_at: '2025-01-20T14:22:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-002',
|
||||
number: 43,
|
||||
title: 'Design product catalog component',
|
||||
description: 'Create reusable product card and catalog grid components.',
|
||||
status: 'in_review',
|
||||
priority: 'medium',
|
||||
labels: ['feature', 'frontend', 'ui'],
|
||||
sprint: 'Sprint 3',
|
||||
assignee: { id: 'agent-fe', name: 'Frontend Engineer', type: 'agent' },
|
||||
created_at: '2025-01-16T09:00:00Z',
|
||||
updated_at: '2025-01-20T15:30:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-003',
|
||||
number: 44,
|
||||
title: 'Fix cart total calculation bug',
|
||||
description: 'Cart total shows incorrect amount when discount is applied.',
|
||||
status: 'blocked',
|
||||
priority: 'high',
|
||||
labels: ['bug', 'critical', 'backend'],
|
||||
sprint: 'Sprint 3',
|
||||
assignee: { id: 'agent-be', name: 'Backend Engineer', type: 'agent' },
|
||||
created_at: '2025-01-17T11:00:00Z',
|
||||
updated_at: '2025-01-20T13:00:00Z',
|
||||
sync_status: 'pending',
|
||||
blocked_by: 'Waiting for discount API specification',
|
||||
},
|
||||
{
|
||||
id: 'ISS-004',
|
||||
number: 45,
|
||||
title: 'Add product search functionality',
|
||||
description: 'Implement full-text search with filters for the product catalog.',
|
||||
status: 'open',
|
||||
priority: 'medium',
|
||||
labels: ['feature', 'search', 'backend'],
|
||||
sprint: 'Sprint 3',
|
||||
assignee: null,
|
||||
created_at: '2025-01-18T14:00:00Z',
|
||||
updated_at: '2025-01-18T14:00:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-005',
|
||||
number: 46,
|
||||
title: 'Optimize database queries for product listing',
|
||||
description: 'Performance optimization for product queries with pagination.',
|
||||
status: 'done',
|
||||
priority: 'low',
|
||||
labels: ['performance', 'backend', 'database'],
|
||||
sprint: 'Sprint 2',
|
||||
assignee: { id: 'agent-be', name: 'Backend Engineer', type: 'agent' },
|
||||
created_at: '2025-01-10T09:00:00Z',
|
||||
updated_at: '2025-01-18T10:00:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-006',
|
||||
number: 47,
|
||||
title: 'Create checkout page wireframes',
|
||||
description: 'Design wireframes for the checkout flow including payment selection.',
|
||||
status: 'done',
|
||||
priority: 'high',
|
||||
labels: ['design', 'checkout', 'ui'],
|
||||
sprint: 'Sprint 2',
|
||||
assignee: { id: 'agent-po', name: 'Product Owner', type: 'agent' },
|
||||
created_at: '2025-01-08T08:00:00Z',
|
||||
updated_at: '2025-01-15T16:00:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-007',
|
||||
number: 48,
|
||||
title: 'Implement responsive navigation',
|
||||
description: 'Create mobile-friendly navigation with hamburger menu.',
|
||||
status: 'open',
|
||||
priority: 'medium',
|
||||
labels: ['feature', 'frontend', 'responsive'],
|
||||
sprint: null,
|
||||
assignee: null,
|
||||
created_at: '2025-01-19T10:00:00Z',
|
||||
updated_at: '2025-01-19T10:00:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
{
|
||||
id: 'ISS-008',
|
||||
number: 49,
|
||||
title: 'Set up E2E test framework',
|
||||
description: 'Configure Playwright for end-to-end testing.',
|
||||
status: 'in_progress',
|
||||
priority: 'medium',
|
||||
labels: ['testing', 'infrastructure'],
|
||||
sprint: 'Sprint 3',
|
||||
assignee: { id: 'agent-qa', name: 'QA Engineer', type: 'agent' },
|
||||
created_at: '2025-01-20T08:00:00Z',
|
||||
updated_at: '2025-01-20T12:00:00Z',
|
||||
sync_status: 'synced',
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Mock issue detail for detail view
|
||||
*/
|
||||
export const mockIssueDetail: IssueDetail = {
|
||||
id: 'ISS-001',
|
||||
number: 42,
|
||||
title: 'Implement user authentication flow',
|
||||
description: `## Overview
|
||||
Create a complete authentication flow for the e-commerce platform.
|
||||
|
||||
## Requirements
|
||||
- Login with email/password
|
||||
- Registration with email verification
|
||||
- Password reset functionality
|
||||
- OAuth support (Google, GitHub)
|
||||
- JWT token management
|
||||
- Session handling
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Users can register with email and password
|
||||
- [ ] Users receive email verification link
|
||||
- [ ] Users can log in with verified email
|
||||
- [ ] Password reset email is sent within 30 seconds
|
||||
- [ ] OAuth buttons redirect properly
|
||||
- [x] JWT tokens are stored securely
|
||||
- [x] Tokens refresh automatically
|
||||
|
||||
## Technical Notes
|
||||
- Use FastAPI security utilities
|
||||
- Store sessions in Redis
|
||||
- Follow OWASP guidelines`,
|
||||
status: 'in_progress',
|
||||
priority: 'high',
|
||||
labels: [
|
||||
{ id: 'lbl-1', name: 'feature', color: '#3b82f6' },
|
||||
{ id: 'lbl-2', name: 'auth', color: '#8b5cf6' },
|
||||
{ id: 'lbl-3', name: 'backend', color: '#10b981' },
|
||||
{ id: 'lbl-4', name: 'security', color: '#ef4444' },
|
||||
],
|
||||
sprint: 'Sprint 3',
|
||||
milestone: 'MVP Launch',
|
||||
story_points: 8,
|
||||
assignee: { id: 'agent-be', name: 'Backend Engineer', type: 'agent', avatar: 'BE' },
|
||||
reporter: { id: 'agent-po', name: 'Product Owner', type: 'agent', avatar: 'PO' },
|
||||
created_at: '2025-01-15T10:30:00Z',
|
||||
updated_at: '2025-01-20T14:22:00Z',
|
||||
due_date: '2025-02-01',
|
||||
sync_status: 'synced',
|
||||
external_url: 'https://gitea.example.com/project/issues/42',
|
||||
branch: 'feature/42-auth-flow',
|
||||
pull_request: 'PR #15',
|
||||
activity: [
|
||||
{
|
||||
id: 'act-001',
|
||||
type: 'status_change',
|
||||
actor: { id: 'agent-be', name: 'Backend Engineer', type: 'agent' },
|
||||
message: 'moved issue from "Open" to "In Progress"',
|
||||
timestamp: '2 hours ago',
|
||||
},
|
||||
{
|
||||
id: 'act-002',
|
||||
type: 'comment',
|
||||
actor: { id: 'agent-be', name: 'Backend Engineer', type: 'agent' },
|
||||
message:
|
||||
'Started implementing JWT token generation. Using HS256 algorithm as discussed in architecture meeting.',
|
||||
timestamp: '3 hours ago',
|
||||
},
|
||||
{
|
||||
id: 'act-003',
|
||||
type: 'assignment',
|
||||
actor: { id: 'agent-po', name: 'Product Owner', type: 'agent' },
|
||||
message: 'assigned this issue to Backend Engineer',
|
||||
timestamp: '1 day ago',
|
||||
},
|
||||
{
|
||||
id: 'act-004',
|
||||
type: 'label',
|
||||
actor: { id: 'agent-po', name: 'Product Owner', type: 'agent' },
|
||||
message: 'added labels: security, backend',
|
||||
timestamp: '1 day ago',
|
||||
},
|
||||
{
|
||||
id: 'act-005',
|
||||
type: 'created',
|
||||
actor: { id: 'agent-po', name: 'Product Owner', type: 'agent' },
|
||||
message: 'created this issue',
|
||||
timestamp: '5 days ago',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Mock sprints for filter options
|
||||
*/
|
||||
export const mockSprints = ['Sprint 3', 'Sprint 2', 'Sprint 1'];
|
||||
|
||||
/**
|
||||
* Mock assignees for filter options
|
||||
*/
|
||||
export const mockAssignees = [
|
||||
{ id: 'agent-be', name: 'Backend Engineer', type: 'agent' as const },
|
||||
{ id: 'agent-fe', name: 'Frontend Engineer', type: 'agent' as const },
|
||||
{ id: 'agent-qa', name: 'QA Engineer', type: 'agent' as const },
|
||||
{ id: 'agent-po', name: 'Product Owner', type: 'agent' as const },
|
||||
];
|
||||
|
||||
/**
|
||||
* Mock labels for filter options
|
||||
*/
|
||||
export const mockLabels = [
|
||||
'feature',
|
||||
'bug',
|
||||
'backend',
|
||||
'frontend',
|
||||
'ui',
|
||||
'auth',
|
||||
'testing',
|
||||
'performance',
|
||||
'design',
|
||||
'infrastructure',
|
||||
];
|
||||
192
frontend/src/features/issues/types/index.ts
Normal file
192
frontend/src/features/issues/types/index.ts
Normal file
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* Issue Management Types
|
||||
*
|
||||
* Type definitions for the issue tracking feature.
|
||||
* These types align with the backend API schema for issues.
|
||||
*
|
||||
* @module features/issues/types
|
||||
*/
|
||||
|
||||
/**
|
||||
* Issue status values
|
||||
*/
|
||||
export type IssueStatus = 'open' | 'in_progress' | 'in_review' | 'blocked' | 'done' | 'closed';
|
||||
|
||||
/**
|
||||
* Issue priority values
|
||||
*/
|
||||
export type IssuePriority = 'high' | 'medium' | 'low';
|
||||
|
||||
/**
|
||||
* Sync status with external trackers
|
||||
*/
|
||||
export type SyncStatus = 'synced' | 'pending' | 'conflict' | 'error';
|
||||
|
||||
/**
|
||||
* Actor type for issue activity
|
||||
*/
|
||||
export type ActorType = 'agent' | 'human';
|
||||
|
||||
/**
|
||||
* Issue assignee
|
||||
*/
|
||||
export interface IssueAssignee {
|
||||
id: string;
|
||||
name: string;
|
||||
type: ActorType;
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue label
|
||||
*/
|
||||
export interface IssueLabel {
|
||||
id: string;
|
||||
name: string;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue activity item
|
||||
*/
|
||||
export interface IssueActivity {
|
||||
id: string;
|
||||
type: 'status_change' | 'comment' | 'assignment' | 'label' | 'created' | 'branch' | 'pr';
|
||||
actor: IssueAssignee;
|
||||
message: string;
|
||||
timestamp: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue summary for list views
|
||||
*/
|
||||
export interface IssueSummary {
|
||||
id: string;
|
||||
number: number;
|
||||
title: string;
|
||||
description: string;
|
||||
status: IssueStatus;
|
||||
priority: IssuePriority;
|
||||
labels: string[];
|
||||
sprint: string | null;
|
||||
assignee: IssueAssignee | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
sync_status: SyncStatus;
|
||||
blocked_by?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full issue detail
|
||||
*/
|
||||
export interface IssueDetail extends Omit<IssueSummary, 'labels'> {
|
||||
labels: IssueLabel[];
|
||||
milestone: string | null;
|
||||
story_points: number | null;
|
||||
reporter: IssueAssignee;
|
||||
due_date: string | null;
|
||||
external_url: string | null;
|
||||
branch: string | null;
|
||||
pull_request: string | null;
|
||||
activity: IssueActivity[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue filters
|
||||
*/
|
||||
export interface IssueFilters {
|
||||
search?: string;
|
||||
status?: IssueStatus | 'all';
|
||||
priority?: IssuePriority | 'all';
|
||||
sprint?: string | 'all' | 'backlog';
|
||||
assignee?: string | 'all' | 'unassigned';
|
||||
labels?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue sort options
|
||||
*/
|
||||
export type IssueSortField = 'number' | 'priority' | 'updated_at' | 'created_at' | 'status';
|
||||
export type IssueSortDirection = 'asc' | 'desc';
|
||||
|
||||
export interface IssueSort {
|
||||
field: IssueSortField;
|
||||
direction: IssueSortDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk action types
|
||||
*/
|
||||
export type IssueBulkAction = 'change_status' | 'assign' | 'add_labels' | 'delete';
|
||||
|
||||
export interface IssueBulkActionRequest {
|
||||
action: IssueBulkAction;
|
||||
issue_ids: string[];
|
||||
payload?: {
|
||||
status?: IssueStatus;
|
||||
assignee_id?: string;
|
||||
labels?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue update request
|
||||
*/
|
||||
export interface IssueUpdateRequest {
|
||||
title?: string;
|
||||
description?: string;
|
||||
status?: IssueStatus;
|
||||
priority?: IssuePriority;
|
||||
assignee_id?: string | null;
|
||||
labels?: string[];
|
||||
sprint?: string | null;
|
||||
due_date?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue sync request
|
||||
*/
|
||||
export interface IssueSyncRequest {
|
||||
direction?: 'push' | 'pull' | 'bidirectional';
|
||||
}
|
||||
|
||||
/**
|
||||
* Status workflow transition
|
||||
*/
|
||||
export interface StatusTransition {
|
||||
from: IssueStatus;
|
||||
to: IssueStatus;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status configuration
|
||||
*/
|
||||
export interface StatusConfig {
|
||||
label: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Priority configuration
|
||||
*/
|
||||
export interface PriorityConfig {
|
||||
label: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginated issues response
|
||||
*/
|
||||
export interface PaginatedIssuesResponse {
|
||||
data: IssueSummary[];
|
||||
pagination: {
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
total_pages: number;
|
||||
has_next: boolean;
|
||||
has_prev: boolean;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user