From 98fd9492be9f29da64c03de36981a3750d0afda7 Mon Sep 17 00:00:00 2001 From: Ting-Wai To <40179554+tingwai@users.noreply.github.com> Date: Thu, 14 Aug 2025 02:02:26 -0700 Subject: [PATCH] lint format --- src/ui/Selector.tsx | 38 +++++++++++++++++++++----------------- src/ui/SlashCommandUI.tsx | 14 ++++++++++---- src/ui/TUIChat.tsx | 2 +- src/ui/UserInput.tsx | 8 ++++++-- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/ui/Selector.tsx b/src/ui/Selector.tsx index ba82abce1..17ab203e7 100644 --- a/src/ui/Selector.tsx +++ b/src/ui/Selector.tsx @@ -70,7 +70,10 @@ export function Selector({ {title} - {loadingMessage} + + + {loadingMessage} + ); } @@ -94,22 +97,23 @@ export function Selector({ ); } - const defaultRenderOption = ( - option: T, - isSelected: boolean, - isCurrent: boolean, - ) => ( - - {isSelected ? "> " : " "} - {option.name} - {option.displaySuffix || ""} - {isCurrent ? " (current)" : ""} - - ); + // Transform options for ink-ui Select + const selectOptions = options.map((option) => { + const displayName = option.name + (option.displaySuffix || ""); + + return { + label: displayName, + value: option.id, + }; + }); + + // Handle selection change from ink-ui Select + const handleChange = (value: string) => { + const selectedOption = options.find((option) => option.id === value); + if (selectedOption) { + onSelect(selectedOption); + } + }; return ( = ({ }); // Find the longest command name for alignment - const maxCommandLength = Math.max(...filteredCommands.map(cmd => cmd.name.length)); + const maxCommandLength = Math.max( + ...filteredCommands.map((cmd) => cmd.name.length), + ); if (filteredCommands.length === 0) { return ( @@ -61,14 +63,18 @@ const SlashCommandUI: React.FC = ({ {filteredCommands.map((command, index) => { const isSelected = index === selectedIndex; - const paddedCommandName = `/${command.name}`.padEnd(maxCommandLength + 1); + const paddedCommandName = `/${command.name}`.padEnd( + maxCommandLength + 1, + ); return ( - {" "}{paddedCommandName} + {" "} + {paddedCommandName} - {" "}{command.description} + {" "} + {command.description} diff --git a/src/ui/TUIChat.tsx b/src/ui/TUIChat.tsx index 8539f8db6..c29bd9346 100644 --- a/src/ui/TUIChat.tsx +++ b/src/ui/TUIChat.tsx @@ -211,7 +211,7 @@ const BottomStatusBar: React.FC = ({ closeCurrentScreen, }) => ( - + {currentMode === "normal" && ( <> diff --git a/src/ui/UserInput.tsx b/src/ui/UserInput.tsx index 2fe18e016..142838020 100644 --- a/src/ui/UserInput.tsx +++ b/src/ui/UserInput.tsx @@ -469,10 +469,14 @@ const UserInput: React.FC = ({ return ( <> {(inputMode || isWaitingForResponse) && ( - ▋{placeholderText} + + ▋{placeholderText} + )} {!inputMode && !isWaitingForResponse && ( - {placeholderText} + + {placeholderText} + )} );