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: add Poll support #2530

Merged
merged 78 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
91b08f3
feat: add Poll component for Message
MartinCupela Oct 2, 2024
0efdaa1
feat: add QuotedPoll component
MartinCupela Oct 2, 2024
4831f45
feat: add AttachmentSelector component
MartinCupela Oct 4, 2024
034ee16
feat: add poll creation dialog
MartinCupela Oct 10, 2024
b900256
fix: reflect WS events in vote and answers listings
MartinCupela Oct 15, 2024
ae8ecc8
Merge branch 'master' into feat/polls
MartinCupela Oct 15, 2024
049e9d4
Merge branch 'master' into feat/polls
MartinCupela Oct 15, 2024
5c3f390
feat: support poll info in latest message message preview
MartinCupela Oct 15, 2024
6b13c34
refactor: take poll instances from client poll manager
MartinCupela Oct 15, 2024
b04b6f7
fix: check for undefined value in the next cursor
MartinCupela Oct 16, 2024
22bcdcf
refactor: remove unnecessary effect
MartinCupela Oct 16, 2024
d204f86
fix: add close button to PollCreationDialog
MartinCupela Oct 17, 2024
ac72f69
refactor: attach poll creation modal to Channel container
MartinCupela Oct 17, 2024
75ac167
fix: account for possible undefined latestMessage in ChannelPreview
MartinCupela Oct 17, 2024
32349c0
refactor: keep poll answers list UI together
MartinCupela Oct 17, 2024
01e2112
fix: prevent allowing to update poll answer on closed poll
MartinCupela Oct 17, 2024
da4eda1
feat: debounce poll voting
MartinCupela Oct 17, 2024
5205969
feat: adapt AttachmentSelector contents to Thread
MartinCupela Oct 17, 2024
10c7021
feat: allow to override Poll component
MartinCupela Oct 21, 2024
f1ef9af
feat: allow to override PollCreationDialog component
MartinCupela Oct 21, 2024
3a1cacf
feat: allow to override poll actions components in PollActions
MartinCupela Oct 21, 2024
684db80
fix: export component props types that which components can be overri…
MartinCupela Oct 21, 2024
17e2aff
fix: make props in PollActionsProps to be optional
MartinCupela Oct 21, 2024
4e770cc
feat: add translations
MartinCupela Oct 22, 2024
bb68092
Merge branch 'master' into feat/polls
MartinCupela Oct 22, 2024
6e53375
fix: fix English translations of singular
MartinCupela Oct 22, 2024
d5b5e09
fix: add return type to Portal component
MartinCupela Oct 22, 2024
0876cb8
style: remove commented code
MartinCupela Oct 22, 2024
b425757
fix: sort poll results descending
MartinCupela Oct 22, 2024
e4792de
feat: unify form field error rendering
MartinCupela Oct 22, 2024
f96c91e
fix: vote for suggested option
MartinCupela Oct 22, 2024
03c57aa
fix: maximum number of votes is not mandatory if multiple votes are e…
MartinCupela Oct 22, 2024
094bcd7
fix: remove the oldest vote if reached voting limit
MartinCupela Oct 22, 2024
e22cd0f
Revert "fix: remove the oldest vote if reached voting limit"
MartinCupela Oct 23, 2024
d4db28d
fix: reflect ownVotesByOptionId maps PollVote values
MartinCupela Oct 23, 2024
9bd76a7
fix: remove stale error in FormDialog
MartinCupela Oct 23, 2024
22f14b2
fix: add poll creation dialog layout fixes
MartinCupela Oct 24, 2024
3e3cfdf
refactor: prevent warning logs from usePollContext hook
MartinCupela Oct 25, 2024
4b1590f
fix: retrieve Poll component from ComponentContext in MessageSimple
MartinCupela Oct 25, 2024
420fa41
feat: jump to the next input in the OptionFieldSet on Enter key
MartinCupela Oct 25, 2024
185f682
refactor: use Poll component to display quoted poll
MartinCupela Oct 26, 2024
afff61f
test: add tests for quoted poll scenario
MartinCupela Oct 26, 2024
9403229
Merge branch 'master' into feat/polls
MartinCupela Oct 28, 2024
6ea3c6f
feat: make AttachmentSelectorActions customizable
MartinCupela Oct 28, 2024
f1aca51
test: add AttachmentSelector tests
MartinCupela Oct 28, 2024
eb8effb
Merge branch 'master' into feat/polls
MartinCupela Oct 29, 2024
b14da49
test: update snapshots
MartinCupela Oct 31, 2024
bc750cb
refactor: deprecate FileUploadIcon from component context
MartinCupela Oct 31, 2024
0e4cfac
fix: keep using SimpleAttachmentSelector in EditMessageForm
MartinCupela Oct 31, 2024
7363286
test: fix EditMessageForm tests
MartinCupela Oct 31, 2024
3b3ee82
test: fix AudioRecorder tests related to MessageInput
MartinCupela Oct 31, 2024
1bf9142
refactor: remove the use of usePollState hook
MartinCupela Oct 31, 2024
50b9719
fix: on poll.vote_changed remove votes by their id
MartinCupela Oct 31, 2024
ac3ffe2
test: finish Poll related tests
MartinCupela Oct 31, 2024
f66be60
chore(deps): bump stream-chat version to 8.42.0
MartinCupela Oct 31, 2024
a214928
feat: add missing translations
MartinCupela Oct 31, 2024
ebf1f57
Merge branch 'master' into feat/polls
MartinCupela Oct 31, 2024
72ccbc2
feat: respect channel.config.polls flag
MartinCupela Oct 31, 2024
be03659
test: fix import
MartinCupela Oct 31, 2024
28e3404
feat: add PollActions to the component context
MartinCupela Oct 31, 2024
a74a39b
feat: turn off autocomplete on forms
MartinCupela Oct 31, 2024
dce8f01
fix: use custom PollCreationDialog from component context in Attachme…
MartinCupela Oct 31, 2024
f5bcd7f
feat: allow to customize modal content for AttachmentSelector actions
MartinCupela Oct 31, 2024
7c44c39
feat: allow to customize PollHeader, PollOptionSelector, QuotedPoll
MartinCupela Oct 31, 2024
5da765b
refactor: make customizable the poll content, not the whole Poll comp…
MartinCupela Oct 31, 2024
5d29296
fix: do not assign default poll creation dialog twice
MartinCupela Oct 31, 2024
8174682
fix: change back the FormDialog submit button text
MartinCupela Nov 1, 2024
cd3c25a
docs: add poll documentation
MartinCupela Nov 1, 2024
0cf5482
fix: fix import
MartinCupela Nov 1, 2024
235c636
Merge remote-tracking branch 'origin/feat/polls' into feat/polls
MartinCupela Nov 1, 2024
42fb767
fix: do not export PromptDialog and FormDialog
MartinCupela Nov 1, 2024
4fd9c9d
refactor: use usePollContext instead of usePoll hook
MartinCupela Nov 1, 2024
184d6cd
refactor: export more PollActions components
MartinCupela Nov 1, 2024
7bb970f
docs: document new ComponentContext props
MartinCupela Nov 1, 2024
5b3ff7e
docs: document PollContext
MartinCupela Nov 1, 2024
dd25c4e
docs: document AttachmentSelectorContext
MartinCupela Nov 1, 2024
f5458ec
docs: fix typos
MartinCupela Nov 1, 2024
f4b5e46
chore(deps): bump @stream-io/stream-chat-css to version 5.2.0
MartinCupela Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docusaurus/docs/React/assets/end-poll-dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docusaurus/docs/React/assets/poll-results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 74 additions & 2 deletions docusaurus/docs/React/components/contexts/component-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@ Custom UI component to display a attachment previews in `MessageInput`.
| --------- | ---------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentPreviewList' path='/MessageInput/AttachmentPreviewList.tsx'/> |

### AttachmentSelector

Custom UI component to control adding attachments to MessageInput, defaults to and accepts same props as:

| Type | Default |
| --------- | ---------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentSelector' path='/MessageInput/AttachmentSelector.tsx'/> |

### AttachmentSelectorInitiationButtonContents

Custom UI component for contents of attachment selector initiation button.

| Type |
| --------- |
| component |

### AudioRecorder

Custom UI component to display AudioRecorder in `MessageInput`.

| Type | Default |
| --------- | ------------------------------------------------------------------------------ |
| component | <GHComponentLink text='AudioRecorder' path='/MessageInput/AudioRecorder.tsx'/> |

### AutocompleteSuggestionItem

Custom UI component to override the default suggestion Item component.
Expand Down Expand Up @@ -155,9 +179,9 @@ Custom UI component to be displayed when the `MessageList` is empty.
| --------- | ------------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='EmptyStateIndicator' path='/EmptyStateIndicator/EmptyStateIndicator.tsx'/> |

### FileUploadIcon
### FileUploadIcon (deprecated)

Custom UI component for file upload icon.
Custom UI component for file upload icon. The component is now deprecated. Use [`AttachmentSelectorInitiationButtonContents`](#attachmentselectorinitiationbuttoncontents) instead.

| Type | Default |
| --------- | ----------------------------------------------------------------------- |
Expand Down Expand Up @@ -309,6 +333,46 @@ Custom UI component to override default pinned message indicator.
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='PinIndicator' path='/Message/icons.tsx'/> |

### PollActions

Custom UI component to override default poll actions rendering in a message.

| Type | Default |
| --------- | ------------------------------------------------------------------------------ |
| component | <GHComponentLink text='PollActions' path='/Poll/PollActions/PollActions.tsx'/> |

### PollContent

Custom UI component to override default poll rendering in a message.

| Type | Default |
| --------- | ------------------------------------------------------------------ |
| component | <GHComponentLink text='PollContent' path='/Poll/PollContent.tsx'/> |

### PollCreationDialog

Custom UI component to override default poll creation dialog contents.

| Type | Default |
| --------- | --------------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='PollCreationDialog' path='/Poll/PollCreationDialog/PollCreationDialog.tsx'/> |

### PollHeader

Custom UI component to override default poll header in a message.

| Type | Default |
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='PollHeader' path='/Poll/PollHeader.tsx'/> |

### PollOptionSelector

Custom UI component to override default poll option selector.

| Type | Default |
| --------- | -------------------------------------------------------------------------------- |
| component | <GHComponentLink text='PollOptionSelector' path='/Poll/PollOptionSelector.tsx'/> |

### QuotedMessage

Custom UI component to override quoted message UI on a sent message.
Expand All @@ -325,6 +389,14 @@ Custom UI component to override the message input's quoted message preview.
| --------- | -------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='QuotedMessagePreview' path='/MessageInput/QuotedMessagePreview.tsx'/> |

### QuotedPoll

Custom UI component to override the rendering of quoted poll.

| Type | Default |
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='QuotedPoll' path='/Poll/QuotedPoll.tsx'/> |

### ReactionSelector

Custom UI component to display the reaction selector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ Function to insert text into the value of the underlying `textarea` component.
| ------------------------------ |
| (textToInsert: string) => void |

### isThreadInput

Signals that the MessageInput is rendered in a message thread (Thread component).

| Type |
| ------- |
| boolean |

### isUploadEnabled

If true, file uploads are enabled in the currently active channel.
Expand Down
72 changes: 72 additions & 0 deletions docusaurus/docs/React/components/core-components/channel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,30 @@ Custom UI component to display an attachment previews in `MessageInput`.
| --------- | ---------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentPreviewList' path='/MessageInput/AttachmentPreviewList.tsx'/> |

### AttachmentSelector

Custom UI component to control adding attachments to MessageInput, defaults to and accepts same props as:

| Type | Default |
| --------- | ---------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentSelector' path='/MessageInput/AttachmentSelector.tsx'/> |

### AttachmentSelectorInitiationButtonContents

Custom UI component for contents of attachment selector initiation button.

| Type |
| --------- |
| component |

### AudioRecorder

Custom UI component to display AudioRecorder in `MessageInput`.

| Type | Default |
| --------- | ------------------------------------------------------------------------------ |
| component | <GHComponentLink text='AudioRecorder' path='/MessageInput/AudioRecorder.tsx'/> |

### AutocompleteSuggestionItem

Custom UI component to override the default suggestion Item component.
Expand Down Expand Up @@ -609,6 +633,46 @@ Custom UI component to override default pinned message indicator.
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='PinIndicator' path='/Message/icons.tsx'/> |

### PollActions

Custom UI component to override default poll actions rendering in a message.

| Type | Default |
| --------- | ------------------------------------------------------------------------------ |
| component | <GHComponentLink text='PollActions' path='/Poll/PollActions/PollActions.tsx'/> |

### PollContent

Custom UI component to override default poll rendering in a message.

| Type | Default |
| --------- | ------------------------------------------------------------------ |
| component | <GHComponentLink text='PollContent' path='/Poll/PollContent.tsx'/> |

### PollCreationDialog

Custom UI component to override default poll creation dialog contents.

| Type | Default |
| --------- | --------------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='PollCreationDialog' path='/Poll/PollCreationDialog/PollCreationDialog.tsx'/> |

### PollHeader

Custom UI component to override default poll header in a message.

| Type | Default |
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='PollHeader' path='/Poll/PollHeader.tsx'/> |

### PollOptionSelector

Custom UI component to override default poll option selector.

| Type | Default |
| --------- | -------------------------------------------------------------------------------- |
| component | <GHComponentLink text='PollOptionSelector' path='/Poll/PollOptionSelector.tsx'/> |

### QuotedMessage

Custom UI component to override quoted message UI on a sent message.
Expand All @@ -625,6 +689,14 @@ Custom UI component to override the message input's quoted message preview.
| --------- | -------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='QuotedMessagePreview' path='/MessageInput/QuotedMessagePreview.tsx'/> |

### QuotedPoll

Custom UI component to override the rendering of quoted poll.

| Type | Default |
| --------- | ---------------------------------------------------------------- |
| component | <GHComponentLink text='QuotedPoll' path='/Poll/QuotedPoll.tsx'/> |

### ReactionSelector

Custom UI component to display the reaction selector.
Expand Down
Loading
Loading