Skip to content

Commit

Permalink
Chore (editor): Cleanup rendering logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 27, 2024
1 parent f2bacfe commit c52a91f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/editor/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,19 @@ export default createPrompt<string, EditorConfig>((config, done) => {
const isLoading = status === 'loading';
const prefix = usePrefix(isLoading);

let message = chalk.bold(config.message);
const message = chalk.bold(config.message);

let helpTip;
if (status === 'loading') {
message += chalk.dim(' Received');
helpTip = chalk.dim('Received');
} else if (status === 'pending') {
message += chalk.dim(' Press <enter> to launch your preferred editor.');
helpTip = chalk.dim('Press <enter> to launch your preferred editor.');
}

let error = '';
if (errorMsg) {
error = chalk.red(`> ${errorMsg}`);
}

return [`${prefix} ${message}`, error];
return [[prefix, message, helpTip].filter(Boolean).join(' '), error];
});

0 comments on commit c52a91f

Please sign in to comment.