Skip to content

Commit a79687f

Browse files
committed
Small fixes
1 parent d2da498 commit a79687f

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

projects/stream-chat-angular/src/lib/polls/poll-actions/poll-actions.component.html

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
<ng-container
33
*ngIf="maxOptionsDisplayed && options.length > maxOptionsDisplayed"
44
>
5-
<button
6-
class="str-chat__poll-action"
7-
(click)="selectedAction = 'allOptions'; isModalOpen = true"
8-
>
5+
<button class="str-chat__poll-action" (click)="modalOpened('allOptions')">
96
{{ "streamChat.See all options ({{count}})" | translate:{count:
107
options.length} }}
118
</button>
@@ -79,11 +76,23 @@
7976

8077
<!-- The modal components click outside logic can't identify clicks from subcomponents, so we stop event propagation -->
8178
<ng-template #allOptions>
82-
<stream-poll-options-list
79+
<div
80+
class="str-chat__modal__poll-option-list"
8381
(click)="$event.stopPropagation()"
84-
[pollId]="pollId"
85-
[messageId]="messageId"
86-
></stream-poll-options-list>
82+
>
83+
<div class="str-chat__modal-header">
84+
<div class="str-chat__modal-header__title" translate>Poll options</div>
85+
</div>
86+
<div class="str-chat__modal__poll-option-list__body">
87+
<div class="str-chat__modal__poll-option-list__title">{{ name }}</div>
88+
<stream-poll-options-list
89+
(click)="$event.stopPropagation()"
90+
[pollId]="pollId"
91+
[messageId]="messageId"
92+
[maxOptionsDisplayed]="undefined"
93+
></stream-poll-options-list>
94+
</div>
95+
</div>
8796
</ng-template>
8897
<ng-template #suggestOption>
8998
<div>TODO: Suggest option</div>

projects/stream-chat-angular/src/lib/polls/poll-actions/poll-actions.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ type Action =
3030
changeDetection: ChangeDetectionStrategy.OnPush,
3131
})
3232
export class PollActionsComponent extends BasePollComponent {
33-
@Input() maxOptionsDisplayed: number | undefined;
33+
@Input() maxOptionsDisplayed: number | undefined = 10;
3434
@Input() maxPollOptions = 100;
35+
name = '';
3536
options: PollOption[] = [];
3637
isClosed = false;
3738
allowUserSuggestions = false;
@@ -77,6 +78,7 @@ export class PollActionsComponent extends BasePollComponent {
7778
allow_answers: state.allow_answers,
7879
answer_count: state.answers_count,
7980
created_by: state.created_by,
81+
name: state.name,
8082
}),
8183
(state) => {
8284
this.options = state.options;
@@ -85,6 +87,7 @@ export class PollActionsComponent extends BasePollComponent {
8587
this.allowAnswers = state.allow_answers ?? false;
8688
this.answerCount = state.answer_count ?? 0;
8789
this.isOwnPoll = state.created_by?.id === this.currentUser?.id;
90+
this.name = state.name;
8891
markForCheck();
8992
}
9093
);

projects/stream-chat-angular/src/lib/polls/poll-option-selector/poll-option-selector.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
[user]="vote.user"
1919
[imageUrl]="vote.user?.image"
2020
[name]="vote.user?.name"
21+
type="user"
2122
></stream-avatar-placeholder>
2223
</div>
2324
</ng-container>

projects/stream-chat-angular/src/lib/polls/poll-options-list/poll-options-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div
22
class="str-chat__poll-option-list"
33
[class.str-chat__poll-option-list--full]="
4-
maxOptionsDisplayed && maxOptionsDisplayed === options.length
4+
!maxOptionsDisplayed || maxOptionsDisplayed === options.length
55
"
66
>
77
<ng-container

projects/stream-chat-angular/src/lib/polls/poll-options-list/poll-options-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Poll, PollOption } from 'stream-chat';
99
changeDetection: ChangeDetectionStrategy.OnPush,
1010
})
1111
export class PollOptionsListComponent extends BasePollComponent {
12-
@Input() maxOptionsDisplayed: number | undefined;
12+
@Input() maxOptionsDisplayed: number | undefined = 10;
1313
options: PollOption[] = [];
1414

1515
protected stateStoreSelector(

projects/stream-chat-angular/src/lib/polls/poll-results/poll-vote/poll-vote.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[user]="vote?.user"
66
[imageUrl]="vote?.user?.image"
77
[name]="vote?.user?.name ?? anonymousTranslation"
8+
type="user"
89
></stream-avatar-placeholder>
910
<div class="str-chat__poll-vote__author__name">
1011
{{ vote?.user?.name ?? anonymousTranslation }}

0 commit comments

Comments
 (0)