Skip to content

fix: validate max number of poll votes based on input validity #2701

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

Open
wants to merge 5 commits into
base: release-v12
Choose a base branch
from

Conversation

MartinCupela
Copy link
Contributor

@MartinCupela MartinCupela commented May 8, 2025

🎯 Goal

Show field error for numeric field with incorrect input.

CLOSES REACT-371

arnautov-anton and others added 5 commits May 8, 2025 10:19
### 🎯 Goal

Current `Channel.dragAndDropWindow` and
`Channel.optionalMessageInputProps` architecture which used to allow
drag&drop file upload by dropping files onto the message list (channel)
component suffers from a few pain points:
- duplicate `MessageInputContextProvider` initialization, see
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/Channel/Channel.tsx#L1479-L1484),
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/MessageInput/MessageInput.tsx#L137-L159)
and
[here](https://github.com/GetStream/stream-chat-react/blob/5fa6b0fc239a7d48032ae4c3d34e29969c52bd0c/src/components/MessageInput/DropzoneProvider.tsx#L47-L67)
([related
issue](https://getstream.slack.com/archives/C02R5UCGN6N/p1740392263047589))
- broken styling ([v2 vendor
folder](https://github.com/GetStream/stream-chat-css/tree/v5.8.0/src/v2/styles/vendor)
is missing [react-file-utils
styling](https://github.com/GetStream/stream-chat-css/blob/v5.8.0/src/vendor/react-file-utils.scss))

New solution allows dragging and uploading files both in "channel" and
in thread individually - which was previously impossible. The new
solution also reuses drag and drop styling which is used by default in
`MessageInputFlat` component (some minor adjustments from integrators
are needed - such as setting relative positioning on required parents).

#### Old API:

```tsx
<Channel dragAndDropWindow>
  <Window>
    <ChannelHeader />
    <MessageList />
    <AIStateIndicator />
    <MessageInput focus />
  </Window>
  <Thread virtualized />
</Channel>
```

#### New API:

```tsx
<Channel>
  <WithDragAndDropUpload className='str-chat__main-panel'>
    <ChannelHeader/>
    <MessageList />
    <AIStateIndicator />
    <MessageInput focus />
  </WithDragAndDropUpload>
  <WithDragAndDropUpload>
    <Thread virtualized />
  </WithDragAndDropUpload>
</Channel>
```

### Deprecations

#### Public

- `Channel.dragAndDropWindow` prop (will remove in v13)
- `Channel.optionalMessageInputProps` prop (will remove in v13)

#### Private

- `DropzoneProvider`
- `DropzoneInner`
- `ImageDropzone`

Note: This is not a direct fix of the issue I mentioned above (Slack
link), I believe the proper fix is to move away from this messy
architecture (by removing deprecated components and options which we'll
do in v13 once this PR is merged).

THIS PR RELIES ON [CSS
CHANGES](GetStream/stream-chat-css#329)

### 🎨 UI Changes
Before:

![image](https://github.com/user-attachments/assets/0514c338-8d52-44d8-aecd-60bf86acdee2)
After:

![image](https://github.com/user-attachments/assets/3afd1468-d552-4180-9be6-b9ffbe503526)
### 🎯 Goal

Yesterday evening I reconsidered how the wrapper should work - this way
it's much more simpler and allows multiple `MessageInput` components to
work under one wrapper without any clashing.

Since the previous feature has not been released yet, we can change the
context API without any worry and thus `refactor`.
## [12.15.0](v12.14.0...v12.15.0) (2025-05-02)

### Features

* introduce WithDragAndDropUpload component ([#2688](#2688)) ([6b03abd](6b03abd))

### Chores

* **deps:** upgrade @stream-io/stream-chat-css to v5.8.1 ([#2689](#2689)) ([d0c32e3](d0c32e3))

### Refactors

* simplify WithDragAndDropUpload API ([#2691](#2691)) ([46c9add](46c9add))
Copy link

codecov bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 75.40984% with 15 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-v12@5fa6b0f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../components/MessageInput/WithDragAndDropUpload.tsx 64.10% 11 Missing and 3 partials ⚠️
src/components/MessageInput/MessageInputFlat.tsx 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             release-v12    #2701   +/-   ##
==============================================
  Coverage               ?   81.07%           
==============================================
  Files                  ?      471           
  Lines                  ?     9984           
  Branches               ?     2358           
==============================================
  Hits                   ?     8095           
  Misses                 ?     1766           
  Partials               ?      123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants