-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Expand file tree
/
Copy pathCreatingStep.tsx
More file actions
63 lines (58 loc) · 1.95 KB
/
Copy pathCreatingStep.tsx
File metadata and controls
63 lines (58 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Box, Text } from '@anthropic/ink';
import type { Workflow } from './types.js';
interface CreatingStepProps {
currentWorkflowInstallStep: number;
secretExists: boolean;
useExistingSecret: boolean;
secretName: string;
skipWorkflow?: boolean;
selectedWorkflows: Workflow[];
}
export function CreatingStep({
currentWorkflowInstallStep,
secretExists,
useExistingSecret,
secretName,
skipWorkflow = false,
selectedWorkflows,
}: CreatingStepProps) {
const progressSteps = skipWorkflow
? [
'Getting repository information',
secretExists && useExistingSecret ? 'Using existing API key secret' : `Setting up ${secretName} secret`,
]
: [
'Getting repository information',
'Creating branch',
selectedWorkflows.length > 1 ? 'Creating workflow files' : 'Creating workflow file',
secretExists && useExistingSecret ? 'Using existing API key secret' : `Setting up ${secretName} secret`,
'Opening pull request page',
];
return (
<>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="column" marginBottom={1}>
<Text bold>Install GitHub App</Text>
<Text dimColor>Create GitHub Actions workflow</Text>
</Box>
{progressSteps.map((stepText, index) => {
let status: 'completed' | 'in-progress' | 'pending' = 'pending';
if (index < currentWorkflowInstallStep) {
status = 'completed';
} else if (index === currentWorkflowInstallStep) {
status = 'in-progress';
}
return (
<Box key={index}>
<Text color={status === 'completed' ? 'success' : status === 'in-progress' ? 'warning' : undefined}>
{status === 'completed' ? '✓ ' : ''}
{stepText}
{status === 'in-progress' ? '…' : ''}
</Text>
</Box>
);
})}
</Box>
</>
);
}