-
Notifications
You must be signed in to change notification settings - Fork 113
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
Added a loading spinner in NLU prediction #648
base: main
Are you sure you want to change the base?
Conversation
@@ -205,6 +209,22 @@ const Selectable: FC<SelectableProps> = ({ | |||
onChange={(e) => handleTextChange(e.target.value)} | |||
placeholder={placeholder} |
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.
placeholder={placeholder} | |
placeholder={placeholder} | |
InputProps={{ | |
endAdornment: loading ? ( | |
<InputAdornment position="end"> | |
<CircularProgress size={20} /> | |
</InputAdornment> | |
) : null, | |
}} |
I think you can add it as a adornment to the input.
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.
Okay I will do that
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.
In the TextField
component, we can use InputProps
to pass the endAdornment
, but in the Input
component, we need to use endAdornment
directly. While using InputAdornment
with TextField
works as expected, it did not behave as intended when applied to Input
.
To resolve this, I implemented custom CSS to properly position the spinner within the input field. After thorough testing across different devices, the solution is responsive and working as expected.
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.
Hello @marrouchi ,
Any further changes needed ?
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 @TheCoderAdi for your contribution 🚀 👏
Left some minor comments
…ibility in Selectable component
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.
Can you please format the code by running this command
npm run lint:fix
…rainForm component
…electable component
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 @TheCoderAdi for being very responsive 🚀
Thanks! Looking forward to more feedback and improvements together. |
Motivation
This PR introduces a loading state to the
Selectable
component to improve the user experience while fetching NLP predictions. TheCircularProgress
spinner is displayed during API requests to indicate loading status.Fixes issue: #638
Changes Made
Selectable.tsx
usinguseQuery
withreact-query
.isLoading
prop to theSelectable
component for better state management.CircularProgress
spinner insideSelectable
whenloading
istrue
.Type of Change
Checklist