feat: Improve DynamicPipeline component with enhanced fallback UI and add localization for no stages message

This commit is contained in:
catlog22
2026-03-04 11:51:30 +08:00
parent ffd5282932
commit 91fa594578
4 changed files with 24 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ import { useIntl } from 'react-intl';
import { CheckCircle2, Circle, Loader2, Ban, SkipForward } from 'lucide-react';
import { Badge } from '@/components/ui/Badge';
import { cn } from '@/lib/utils';
import { TeamPipeline } from './TeamPipeline';
import type { DynamicStage, DynamicStageStatus, PhaseInfo } from '@/types/team';
interface DynamicPipelineProps {
@@ -70,9 +69,18 @@ function Arrow() {
export function DynamicPipeline({ stages, phaseInfo }: DynamicPipelineProps) {
const { formatMessage } = useIntl();
// Fallback to static pipeline when no dynamic stages
// Fallback: empty state when no dynamic stages are available
if (stages.length === 0) {
return <TeamPipeline messages={[]} />;
return (
<div className="flex flex-col h-full">
<h3 className="text-sm font-medium text-muted-foreground">
{formatMessage({ id: 'team.pipeline.title' })}
</h3>
<p className="text-xs text-muted-foreground text-center py-8">
{formatMessage({ id: 'team.pipeline.noStages' })}
</p>
</div>
);
}
return (
@@ -91,7 +99,7 @@ export function DynamicPipeline({ stages, phaseInfo }: DynamicPipelineProps) {
</Badge>
{phaseInfo.currentStep && (
<Badge variant="secondary">
{phaseInfo.currentStep}
{formatMessage({ id: 'team.coordinates.step' })}: {phaseInfo.currentStep}
</Badge>
)}
{phaseInfo.gapIteration > 0 && (

View File

@@ -79,7 +79,8 @@
"inProgress": "In Progress",
"pending": "Pending",
"blocked": "Blocked",
"skipped": "Skipped"
"skipped": "Skipped",
"noStages": "No pipeline stages defined for this session"
},
"coordinates": {
"phase": "Phase",

View File

@@ -79,7 +79,8 @@
"inProgress": "进行中",
"pending": "待处理",
"blocked": "已阻塞",
"skipped": "已跳过"
"skipped": "已跳过",
"noStages": "此会话未定义流水线阶段"
},
"coordinates": {
"phase": "阶段",

View File

@@ -77,8 +77,8 @@ export function TeamPage() {
[teamData?.role_state]
);
// List view
if (viewMode === 'list' || !selectedTeam) {
// List view (also fallback when selected team data is not available)
if (viewMode === 'list' || !selectedTeam || (viewMode === 'detail' && teams.length > 0 && !teamData)) {
return (
<div className="space-y-6">
<TeamListView />
@@ -163,11 +163,15 @@ export function TeamPage() {
tabs={tabs}
/>
{/* Pipeline Tab */}
{/* Pipeline Tab - shows role details */}
{detailTab === 'pipeline' && (
<Card>
<CardContent className="p-6">
<DynamicPipeline stages={stages} phaseInfo={phaseInfo} />
<TeamRolePanel
members={members}
stages={stages}
roleState={teamData?.role_state}
/>
</CardContent>
</Card>
)}