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
37 changes: 1 addition & 36 deletions packages/tui/apps/status/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"
import { getStatusColor } from "../../src/utils/index.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -120,18 +121,6 @@ function VersionSelector({
exit()
}
})
const getStatusColor = (status: string) => {
switch (status) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
return (
<Box flexDirection="column">
<Text bold>Select a version of {expertName}:</Text>
Expand Down Expand Up @@ -184,18 +173,6 @@ function StatusSelector({
exit()
}
})
const getStatusColor = (status: string) => {
switch (status) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
return (
<Box flexDirection="column">
<Text bold>Select status for {expertKey}:</Text>
Expand Down Expand Up @@ -255,18 +232,6 @@ function ConfirmStep({
}
})
const statusChanged = status !== currentStatus
const getStatusColor = (s: string) => {
switch (s) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
return (
<Box flexDirection="column">
<Text bold>Confirm status change for {expertKey}:</Text>
Expand Down
13 changes: 1 addition & 12 deletions packages/tui/apps/tag/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"
import { getStatusColor } from "../../src/utils/index.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -107,18 +108,6 @@ function VersionSelector({
exit()
}
})
const getStatusColor = (status: string) => {
switch (status) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
return (
<Box flexDirection="column">
<Text bold>Select a version of {expertName}:</Text>
Expand Down
13 changes: 1 addition & 12 deletions packages/tui/apps/unpublish/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Text, useApp, useInput } from "ink"
import { useState } from "react"
import { ErrorStep } from "../../src/components/error-step.js"
import { getStatusColor } from "../../src/utils/index.js"

type ExpertChoice = {
name: string
Expand Down Expand Up @@ -99,18 +100,6 @@ function VersionSelector({
exit()
}
})
const getStatusColor = (status: string) => {
switch (status) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
return (
<Box flexDirection="column">
<Text bold>Select a version of {expertName} to unpublish:</Text>
Expand Down
1 change: 1 addition & 0 deletions packages/tui/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { createErrorHandler } from "./error-handling.js"
export { EventQueue } from "./event-queue.js"
export { getStatusColor } from "./status-color.js"
13 changes: 13 additions & 0 deletions packages/tui/src/utils/status-color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type StatusColor = "green" | "yellow" | "red"
export const getStatusColor = (status: string): StatusColor | undefined => {
switch (status) {
case "available":
return "green"
case "deprecated":
return "yellow"
case "disabled":
return "red"
default:
return undefined
}
}
Loading