diff --git a/apps/web/src/pages/ModuleDetailPage.tsx b/apps/web/src/pages/ModuleDetailPage.tsx index c2c45d2e..c697d8b1 100644 --- a/apps/web/src/pages/ModuleDetailPage.tsx +++ b/apps/web/src/pages/ModuleDetailPage.tsx @@ -10,6 +10,7 @@ import { issueService } from '../services/issueService'; import { stateService } from '../services/stateService'; import { labelService } from '../services/labelService'; import { cycleService } from '../services/cycleService'; +import { estimateService } from '../services/estimateService'; import type { WorkspaceApiResponse, ProjectApiResponse, @@ -19,6 +20,7 @@ import type { LabelApiResponse, WorkspaceMemberApiResponse, CycleApiResponse, + EstimateApiResponse, } from '../api/types'; import type { Priority } from '../types'; import type { SavedViewDisplayPropertyId } from '../lib/projectSavedViewDisplay'; @@ -191,6 +193,7 @@ export function ModuleDetailPage() { const [states, setStates] = useState([]); const [labels, setLabels] = useState([]); const [cycles, setCycles] = useState([]); + const [estimates, setEstimates] = useState([]); const [projectModules, setProjectModules] = useState([]); const [members, setMembers] = useState([]); const [projects, setProjects] = useState([]); @@ -292,12 +295,14 @@ export function ModuleDetailPage() { cycleService.list(workspaceSlug, projectId), workspaceService.listMembers(workspaceSlug), projectService.list(workspaceSlug), + estimateService.list(workspaceSlug, projectId), ]) - .then(([w, p, mods, iss, st, lab, cyc, mem, proj]) => { + .then(([w, p, mods, iss, st, lab, cyc, mem, proj, est]) => { if (cancelled) return; setWorkspace(w ?? null); setProject(p ?? null); setProjectModules(mods ?? []); + setEstimates(est ?? []); const key = moduleId.trim().toLowerCase(); const found = (mods ?? []).find((x) => x.id === moduleId) ?? @@ -325,6 +330,7 @@ export function ModuleDetailPage() { setCycles([]); setMembers([]); setProjects([]); + setEstimates([]); } }) .finally(() => { @@ -487,6 +493,13 @@ export function ModuleDetailPage() { return id ? (projectModules.find((m) => m.id === id)?.name ?? '—') : '—'; }; + const estimateValue = (issue: IssueApiResponse) => { + if (!issue.estimate_point_id) return '—'; + return ( + estimates.flatMap((e) => e.points).find((p) => p.id === issue.estimate_point_id)?.value ?? '—' + ); + }; + const dp = listDisplay.displayProperties; const hasCol = (id: SavedViewDisplayPropertyId) => dp.has(id); @@ -602,7 +615,12 @@ export function ModuleDetailPage() { ) : null} {hasCol('estimate') ? ( - + + {estimateValue(issue)} + ) : null} {hasCol('module') ? ( ([]); const [cycles, setCycles] = useState([]); const [modules, setModules] = useState([]); + const [estimates, setEstimates] = useState([]); const [loading, setLoading] = useState(true); const [issuesLoading, setIssuesLoading] = useState(false); const [error, setError] = useState(null); @@ -276,8 +279,9 @@ export function ViewDetailPage() { workspaceService.listMembers(workspaceSlug), cycleService.list(workspaceSlug, projectId), moduleService.list(workspaceSlug, projectId), + estimateService.list(workspaceSlug, projectId), ]) - .then(([w, p, list, iss, st, lab, mem, cy, mod]) => { + .then(([w, p, list, iss, st, lab, mem, cy, mod, est]) => { if (cancelled) return; setWorkspace(w); setProject(p); @@ -288,6 +292,7 @@ export function ViewDetailPage() { setMembers(mem ?? []); setCycles(cy ?? []); setModules(mod ?? []); + setEstimates(est ?? []); }) .catch(() => { if (!cancelled) { @@ -300,6 +305,7 @@ export function ViewDetailPage() { setMembers([]); setCycles([]); setModules([]); + setEstimates([]); } }) .finally(() => { @@ -848,6 +854,13 @@ export function ViewDetailPage() { return id ? (modules.find((m) => m.id === id)?.name ?? '—') : '—'; }; + const estimateValue = (issue: IssueApiResponse) => { + if (!issue.estimate_point_id) return '—'; + return ( + estimates.flatMap((e) => e.points).find((p) => p.id === issue.estimate_point_id)?.value ?? '—' + ); + }; + const totalIssueCount = groupedSections.order.reduce( (n, key) => n + (groupedSections.groups.get(key)?.length ?? 0), 0, @@ -1022,7 +1035,12 @@ export function ViewDetailPage() { ) : null} {hasCol('estimate') ? ( - + + {estimateValue(issue)} + ) : null} {hasCol('module') ? (