Signed-off-by: Max <ai-agent@topdoglabs.com>
This commit is contained in:
parent
ab8cc0a6a1
commit
6cdd584b82
@ -309,7 +309,14 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
// Get current active sprint
|
// Get current active sprint
|
||||||
// Treat end date as end-of-day (23:59:59) to handle timezone issues
|
// Treat end date as end-of-day (23:59:59) to handle timezone issues
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const currentSprint = sprints.find((s) => {
|
const projectSprints = selectedProjectId
|
||||||
|
? sprints.filter((s) => s.projectId === selectedProjectId)
|
||||||
|
: sprints
|
||||||
|
const projectTasks = selectedProjectId
|
||||||
|
? tasks.filter((t) => t.projectId === selectedProjectId)
|
||||||
|
: tasks
|
||||||
|
|
||||||
|
const currentSprint = projectSprints.find((s) => {
|
||||||
if (s.status !== "active") return false
|
if (s.status !== "active") return false
|
||||||
const sprintStart = parseSprintStart(s.startDate)
|
const sprintStart = parseSprintStart(s.startDate)
|
||||||
const sprintEnd = parseSprintEnd(s.endDate)
|
const sprintEnd = parseSprintEnd(s.endDate)
|
||||||
@ -317,20 +324,20 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Get other sprints (not current)
|
// Get other sprints (not current)
|
||||||
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
|
const otherSprints = projectSprints.filter((s) => s.id !== currentSprint?.id)
|
||||||
|
|
||||||
// Sort tasks by updatedAt (descending) - latest first
|
// Sort tasks by updatedAt (descending) - latest first
|
||||||
const sortByUpdated = (a: Task, b: Task) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
const sortByUpdated = (a: Task, b: Task) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
||||||
|
|
||||||
// Get tasks by section (sorted by last updated)
|
// Get tasks by section (sorted by last updated)
|
||||||
const currentSprintTasks = currentSprint
|
const currentSprintTasks = currentSprint
|
||||||
? tasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t)).sort(sortByUpdated)
|
? projectTasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||||
: []
|
: []
|
||||||
|
|
||||||
const backlogTasks = tasks.filter((t) => !t.sprintId && matchesSearch(t)).sort(sortByUpdated)
|
const backlogTasks = projectTasks.filter((t) => !t.sprintId && matchesSearch(t)).sort(sortByUpdated)
|
||||||
|
|
||||||
// Get active task for drag overlay
|
// Get active task for drag overlay
|
||||||
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
|
const activeTask = activeId ? projectTasks.find((t) => t.id === activeId) : null
|
||||||
|
|
||||||
const handleDragStart = (event: DragStartEvent) => {
|
const handleDragStart = (event: DragStartEvent) => {
|
||||||
setActiveId(event.active.id as string)
|
setActiveId(event.active.id as string)
|
||||||
@ -344,7 +351,7 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
|
|
||||||
const taskId = active.id as string
|
const taskId = active.id as string
|
||||||
const overId = over.id as string
|
const overId = over.id as string
|
||||||
const overTask = tasks.find((t) => t.id === overId)
|
const overTask = projectTasks.find((t) => t.id === overId)
|
||||||
|
|
||||||
const destinationId = overTask
|
const destinationId = overTask
|
||||||
? overTask.sprintId
|
? overTask.sprintId
|
||||||
@ -418,8 +425,7 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
{otherSprints
|
{otherSprints
|
||||||
.sort((a, b) => parseSprintStart(a.startDate).getTime() - parseSprintStart(b.startDate).getTime())
|
.sort((a, b) => parseSprintStart(a.startDate).getTime() - parseSprintStart(b.startDate).getTime())
|
||||||
.map((sprint) => {
|
.map((sprint) => {
|
||||||
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t)).sort(sortByUpdated)
|
const sprintTasks = projectTasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||||
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
|
|
||||||
return (
|
return (
|
||||||
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
||||||
<TaskSection
|
<TaskSection
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user