-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace rainbow bar with moving hill for no-color mode #5262
Conversation
This comment has been minimized.
This comment has been minimized.
e6717a9
to
a2e5f06
Compare
a2e5f06
to
913eb0d
Compare
913eb0d
to
4aee075
Compare
Coverage report
Show files with reduced coverage 🔻
Test suite run success2003 tests passing in 904 suites. Report generated by 🧪jest coverage report action from 549c884 |
19b7685
to
13716fb
Compare
@@ -25,6 +27,7 @@ interface TasksProps<TContext> { | |||
silent?: boolean | |||
onComplete?: (ctx: TContext) => void | |||
abortSignal?: AbortSignal | |||
noColor?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only introduced this to inject true
in tests because mocking output.js
(where we get shouldDisplayColors
) led to very weird results. It's a private interface, so I don't think this should matter all that much.
const loadingBar = new Array(twoThirds).fill(loadingBarChar).join('') | ||
let loadingBar = new Array(twoThirds).fill(loadingBarChar).join('') | ||
if (noColor ?? !shouldDisplayColors()) { | ||
loadingBar = hillString.repeat(Math.ceil(twoThirds / hillString.length)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rounding up here so we have a bit of extra insurance at the end (which TextAnimation
will truncate), rather than overtruncating immediately.
13716fb
to
549c884
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/ui/components/Tasks.d.ts@@ -13,6 +13,7 @@ interface TasksProps<TContext> {
silent?: boolean;
onComplete?: (ctx: TContext) => void;
abortSignal?: AbortSignal;
+ noColor?: boolean;
}
-declare function Tasks<TContext>({ tasks, silent, onComplete, abortSignal, }: React.PropsWithChildren<TasksProps<TContext>>): JSX.Element | null;
+declare function Tasks<TContext>({ tasks, silent, onComplete, abortSignal, noColor, }: React.PropsWithChildren<TasksProps<TContext>>): JSX.Element | null;
export { Tasks };
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/TextAnimation.d.ts@@ -1,9 +1,10 @@
import React from 'react';
interface TextAnimationProps {
text: string;
+ maxWidth?: number;
}
/**
* applies a rainbow animation to text.
*/
-declare const TextAnimation: React.MemoExoticComponent<({ text }: TextAnimationProps) => JSX.Element>;
+declare const TextAnimation: React.MemoExoticComponent<({ text, maxWidth }: TextAnimationProps) => JSX.Element>;
export { TextAnimation };
\ No newline at end of file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @amcaplan! Very neat accessibility enhancement! LGTM and works as expected as well:
WHY are these changes introduced?
Fixes the poor display of the loading bar in no-color terminals.
WHAT is this pull request doing?
Screen.Recording.2025-01-23.at.17.45.20.mov
How to test your changes?
or any other command which uses a rainbow bar (e.g. creating a new app)
Measuring impact
How do we know this change was effective? Please choose one:
Checklist