Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions packages/tui/apps/status/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -404,14 +405,7 @@ export function StatusApp({ experts, onFetchVersions, onComplete, onCancel }: St
/>
)
case "error":
return (
<Box flexDirection="column">
<Text color="red">Error: {step.message}</Text>
<Box marginTop={1}>
<Text dimColor>Press any key to go back</Text>
</Box>
</Box>
)
return <ErrorStep message={step.message} onBack={handleBack} />
default:
return null
}
Expand Down
10 changes: 2 additions & 8 deletions packages/tui/apps/tag/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -379,14 +380,7 @@ export function TagApp({ experts, onFetchVersions, onComplete, onCancel }: TagAp
/>
)
case "error":
return (
<Box flexDirection="column">
<Text color="red">Error: {step.message}</Text>
<Box marginTop={1}>
<Text dimColor>Press any key to go back</Text>
</Box>
</Box>
)
return <ErrorStep message={step.message} onBack={handleBack} />
default:
return null
}
Expand Down
10 changes: 2 additions & 8 deletions packages/tui/apps/unpublish/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -267,14 +268,7 @@ export function UnpublishApp({
/>
)
case "error":
return (
<Box flexDirection="column">
<Text color="red">Error: {step.message}</Text>
<Box marginTop={1}>
<Text dimColor>Press any key to go back</Text>
</Box>
</Box>
)
return <ErrorStep message={step.message} onBack={handleBack} />
default:
return null
}
Expand Down
20 changes: 20 additions & 0 deletions packages/tui/src/components/error-step.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Box, Text, useInput } from "ink"

type ErrorStepProps = {
message: string
onBack: () => void
}

export function ErrorStep({ message, onBack }: ErrorStepProps) {
useInput(() => onBack())
return (
<Box flexDirection="column">
<Text color="red">Error: {message}</Text>
<Box marginTop={1}>
<Text dimColor>Press any key to go back</Text>
</Box>
</Box>
)
}

export type { ErrorStepProps }
1 change: 1 addition & 0 deletions packages/tui/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { App } from "./app.js"
export { BrowserRouter } from "./browser-router.js"
export { ErrorStep, type ErrorStepProps } from "./error-step.js"
export { ExpertList, type ExpertListProps } from "./expert-list.js"
export { ExpertSelectorBase, type ExpertSelectorBaseProps } from "./expert-selector-base.js"
export { ListBrowser, type ListBrowserProps } from "./list-browser.js"
Expand Down
Loading