'use client'; /** * Project Issues List Page * * Displays filterable, sortable list of issues for a project. * Supports bulk actions and sync with external trackers. * * @module app/[locale]/(authenticated)/projects/[id]/issues/page */ import { useState, use } from 'react'; import { useRouter } from 'next/navigation'; import { Plus, Upload } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Skeleton } from '@/components/ui/skeleton'; import { IssueFilters, IssueTable, BulkActions, useIssues, } from '@/features/issues'; import type { IssueFiltersType, IssueSort } from '@/features/issues'; interface ProjectIssuesPageProps { params: Promise<{ locale: string; id: string; }>; } export default function ProjectIssuesPage({ params }: ProjectIssuesPageProps) { const { locale, id: projectId } = use(params); const router = useRouter(); // Filter state const [filters, setFilters] = useState({ status: 'all', priority: 'all', sprint: 'all', assignee: 'all', }); // Sort state const [sort, setSort] = useState({ field: 'updated_at', direction: 'desc', }); // Selection state const [selectedIssues, setSelectedIssues] = useState([]); // Fetch issues const { data, isLoading, error } = useIssues(projectId, filters, sort); const handleIssueClick = (issueId: string) => { router.push(`/${locale}/projects/${projectId}/issues/${issueId}`); }; const handleBulkChangeStatus = () => { // TODO: Open status change dialog console.log('Change status for:', selectedIssues); }; const handleBulkAssign = () => { // TODO: Open assign dialog console.log('Assign:', selectedIssues); }; const handleBulkAddLabels = () => { // TODO: Open labels dialog console.log('Add labels to:', selectedIssues); }; const handleBulkDelete = () => { // TODO: Confirm and delete console.log('Delete:', selectedIssues); }; const handleSync = () => { // TODO: Sync all issues console.log('Sync issues'); }; const handleNewIssue = () => { // TODO: Navigate to new issue page or open dialog console.log('Create new issue'); }; if (error) { return (

Error Loading Issues

Failed to load issues. Please try again later.

); } return (
{/* Header */}

Issues

{isLoading ? ( ) : ( `${data?.pagination.total || 0} issues found` )}

{/* Filters */} {/* Bulk Actions */} {/* Issue Table */} {isLoading ? (
{[...Array(5)].map((_, i) => ( ))}
) : ( )} {/* Pagination info */} {data && data.pagination.total > 0 && (
Showing {(data.pagination.page - 1) * data.pagination.page_size + 1} to{' '} {Math.min( data.pagination.page * data.pagination.page_size, data.pagination.total )}{' '} of {data.pagination.total} issues {data.pagination.total_pages > 1 && (
)}
)}
); }