feat(poll): improve poll card and dialog UI#16137
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Show resolved
Hide resolved
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
2f7924b to
966f993
Compare
966f993 to
3aebb75
Compare
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Show resolved
Hide resolved
| }, | ||
|
|
||
| showPollStatus() { | ||
| return this.poll && Object.keys(this.poll).length > 0 && this.poll.status !== POLL.STATUS.DRAFT |
There was a problem hiding this comment.
| return this.poll && Object.keys(this.poll).length > 0 && this.poll.status !== POLL.STATUS.DRAFT | |
| return this.poll?.status && this.poll.status !== POLL.STATUS.DRAFT |
There was a problem hiding this comment.
I'm still thinking this can be done better. this.poll can not be an empty object {} to capture this case, and poll status is a mandatory field. Maybe
| return this.poll && Object.keys(this.poll).length > 0 && this.poll.status !== POLL.STATUS.DRAFT | |
| return this.poll && this.poll.status !== POLL.STATUS.DRAFT |
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
a8501ed to
8eb3ce1
Compare
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Show resolved
Hide resolved
| overflow-wrap: anywhere; | ||
|
|
||
| &--draft { | ||
| display: flex; |
There was a problem hiding this comment.
Still needs align-items: center;
src/components/MessagesList/MessagesGroup/Message/MessagePart/PollCard.vue
Outdated
Show resolved
Hide resolved
Signed-off-by: Dorra Jaouad <dorra.jaoued7@gmail.com>
Signed-off-by: Dorra Jaouad <dorra.jaoued7@gmail.com>
8eb3ce1 to
0cbf6d5
Compare
| this.polls[token][poll.id] = poll | ||
|
|
||
| if (this.polls[token][poll.id]) { | ||
| Object.assign(this.polls[token][poll.id], poll) |
There was a problem hiding this comment.
Not sure it's going to work well with Pinia internals. Better would be to:
// Some comment on why it's needed e.g. for chat-relay
this.polls[token][poll.id] = Object.assign({}, this.polls[token][poll.id], poll)| context.dispatch('updateConversationLastMessage', { token, lastMessage: message }) | ||
| if (fromRealtime) { | ||
| const pollsStore = usePollsStore() | ||
| if (message.poll?.id) { |
There was a problem hiding this comment.
It's going to complain later at TS
| if (message.poll?.id) { | |
| if ('poll' in message && message.poll.id) { |
| token, | ||
| pollId: message.messageParameters.poll.id, | ||
| }) | ||
| if (message.poll?.id) { |
There was a problem hiding this comment.
It's going to complain later at TS
| if (message.poll?.id) { | |
| if ('poll' in message && message.poll.id) { |
| pollFooterText() { | ||
| if (this.poll?.status === POLL.STATUS.OPEN) { | ||
| if (this.isPollOpen) { | ||
| return this.poll?.votedSelf.length > 0 |
There was a problem hiding this comment.
consider that it's also used three times, I'd also move it to separate computed for perf and readability:
| return this.poll?.votedSelf.length > 0 | |
| selfHasVoted() { | |
| return this.poll?.votedSelf?.length > 0 | |
| }, |
| }, | ||
|
|
||
| showPollStatus() { | ||
| return this.poll && Object.keys(this.poll).length > 0 && this.poll.status !== POLL.STATUS.DRAFT |
There was a problem hiding this comment.
I'm still thinking this can be done better. this.poll can not be an empty object {} to capture this case, and poll status is a mandatory field. Maybe
| return this.poll && Object.keys(this.poll).length > 0 && this.poll.status !== POLL.STATUS.DRAFT | |
| return this.poll && this.poll.status !== POLL.STATUS.DRAFT |
| overflow-wrap: anywhere; | ||
|
|
||
| &--draft { | ||
| display: flex; |
There was a problem hiding this comment.
Still needs align-items: center;
| return calculateVotePercentage(votes, this.poll.numVoters) | ||
| }, | ||
|
|
||
| pollImportance() { |
There was a problem hiding this comment.
Nitpick: is it really important? Maybe we can go with more neutral pollChipVariant?


☑️ Resolves
Improvement for upstream lib regarding NcChip: nextcloud-libraries/nextcloud-vue#7652
variantprop values to showcase success, warningm error state like we have for other components🖌️ UI Checklist
🖼️ Screenshots / Screencasts
🏁 Checklist