Skip to content
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

feat(ChatUI.tsx): Add isLoading` state, improve code #354

Merged
merged 2 commits into from
May 15, 2024

Conversation

AVGVSTVS96
Copy link
Owner

@AVGVSTVS96 AVGVSTVS96 commented May 14, 2024

  • refactor: Use optional chaining to make HandleKeyDown more concise

  • feat: Use isLoading state and input length check to set disabled state, add disabled styles

    • This disables the send button and reduces it's opacity when the textarea input is empty or if a response is in progress (isLoading)
      • Use isLoading state from AI-SDK to set disabled const in ChatInput
      • Adds disabled prop to the Textarea component
      • Passes isLoading to ChatInput component from useChat hook in Chat component

…ate, add disabled styles

- This disables the send button and reduces it's opacity when the textarea input is empty or if a response is in progress (`isLoading`)
  - Use `isLoading` state from AI-SDK to set disabled const in `ChatInput`
  - Adds `disabled` prop to the `Textarea` component
  - Passes `isLoading` to `ChatInput` component from `useChat` hook in `Chat` component
Copy link

cloudflare-workers-and-pages bot commented May 14, 2024

Deploying astrosite with  Cloudflare Pages  Cloudflare Pages

Latest commit: 69b96ae
Status: ✅  Deploy successful!
Preview URL: https://a7a5a839.astrosite-aid.pages.dev
Branch Preview URL: https://refactorchatui.astrosite-aid.pages.dev

View logs

Copy link

codesandbox bot commented May 14, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @AVGVSTVS96 and the rest of your teammates on Graphite Graphite

@AVGVSTVS96 AVGVSTVS96 added refactor Update code structure enhancement New feature or request labels May 14, 2024 — with Graphite App
@AVGVSTVS96 AVGVSTVS96 marked this pull request as ready for review May 14, 2024 21:54
@AVGVSTVS96 AVGVSTVS96 changed the title refactor: Use optional chaining to make HandleKeyDown more concise refactor(ChatUI.tsx): Add isLoading` state, improve code May 14, 2024
@AVGVSTVS96 AVGVSTVS96 changed the title refactor(ChatUI.tsx): Add isLoading` state, improve code feat(ChatUI.tsx): Add isLoading` state, improve code May 15, 2024
@AVGVSTVS96 AVGVSTVS96 merged commit 4c56b3a into master May 15, 2024
1 check passed
@AVGVSTVS96 AVGVSTVS96 deleted the refactorChatUI branch June 3, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Update code structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant