feat: toon code + titel + status in sprint-switcher dropdown items
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9335ad0e0d
commit
1a5c0b2d01
2 changed files with 23 additions and 8 deletions
|
|
@ -39,7 +39,7 @@ export default async function ProductBacklogPage({ params, searchParams }: Props
|
|||
prisma.sprint.findMany({
|
||||
where: { product_id: id },
|
||||
orderBy: { created_at: 'desc' },
|
||||
select: { id: true, code: true, status: true },
|
||||
select: { id: true, code: true, sprint_goal: true, status: true },
|
||||
}),
|
||||
prisma.user.findUnique({ where: { id: session.userId! }, select: { active_product_id: true } }),
|
||||
resolveActiveSprint(id),
|
||||
|
|
@ -61,13 +61,18 @@ export default async function ProductBacklogPage({ params, searchParams }: Props
|
|||
const sprintItems = allSprints.map(s => ({
|
||||
id: s.id,
|
||||
code: s.code,
|
||||
sprint_goal: s.sprint_goal,
|
||||
status: sprintStatusToApi(s.status),
|
||||
}))
|
||||
const activeSprintItem = resolvedActiveSprint
|
||||
const activeSprintFromList = resolvedActiveSprint
|
||||
? allSprints.find(s => s.id === resolvedActiveSprint.id)
|
||||
: null
|
||||
const activeSprintItem = activeSprintFromList
|
||||
? {
|
||||
id: resolvedActiveSprint.id,
|
||||
code: resolvedActiveSprint.code,
|
||||
status: sprintStatusToApi(resolvedActiveSprint.status),
|
||||
id: activeSprintFromList.id,
|
||||
code: activeSprintFromList.code,
|
||||
sprint_goal: activeSprintFromList.sprint_goal,
|
||||
status: sprintStatusToApi(activeSprintFromList.status),
|
||||
}
|
||||
: null
|
||||
const isActiveProduct = user?.active_product_id === id
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { cn } from '@/lib/utils'
|
|||
import { setActiveSprintAction } from '@/actions/active-sprint'
|
||||
import type { SprintStatusApi } from '@/lib/task-status'
|
||||
|
||||
type SprintItem = { id: string; code: string; status: SprintStatusApi }
|
||||
type SprintItem = { id: string; code: string; sprint_goal: string; status: SprintStatusApi }
|
||||
|
||||
interface SprintSwitcherProps {
|
||||
productId: string
|
||||
|
|
@ -95,16 +95,26 @@ export function SprintSwitcher({
|
|||
)}
|
||||
<ChevronDown className="w-3 h-3 shrink-0 text-muted-foreground" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center" className="w-64">
|
||||
<DropdownMenuContent align="center" className="w-80">
|
||||
{sprints.map(s => (
|
||||
<DropdownMenuItem
|
||||
key={s.id}
|
||||
onClick={() => handleSwitchSprint(s.id)}
|
||||
className={cn(
|
||||
'flex items-center gap-2',
|
||||
s.id === activeSprint?.id && 'bg-primary-container text-primary-container-foreground font-medium',
|
||||
)}
|
||||
>
|
||||
<span className="truncate">{s.code}</span>
|
||||
<span className="text-xs font-medium shrink-0">{s.code}</span>
|
||||
<span className="text-xs truncate flex-1">{s.sprint_goal}</span>
|
||||
<span
|
||||
className={cn(
|
||||
'text-[10px] shrink-0',
|
||||
buildingSet.has(s.id) ? 'text-warning' : 'text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{buildingSet.has(s.id) ? 'BUILDING' : SPRINT_STATUS_LABEL[s.status]}
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue