Skip to content

Commit f664cfb

Browse files
committed
fix: avatar context typing issue
1 parent fa7b2ac commit f664cfb

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

projects/customizations-example/src/app/app.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@
146146
let-location="location"
147147
let-user="user"
148148
let-channel="channel"
149+
let-initialsType="initialsType"
150+
let-showOnlineIndicator="showOnlineIndicator"
149151
>
150152
<stream-avatar
151153
[name]="name"
@@ -155,6 +157,8 @@
155157
[location]="location"
156158
[user]="user"
157159
[channel]="channel"
160+
[initialsType]="initialsType"
161+
[showOnlineIndicator]="showOnlineIndicator"
158162
></stream-avatar>
159163
</ng-template>
160164

projects/stream-chat-angular/src/lib/avatar-placeholder/avatar-placeholder.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
let-user="user"
99
let-location="location"
1010
let-initialsType="initialsType"
11+
let-showOnlineIndicator="showOnlineIndicator"
1112
>
1213
<stream-avatar
1314
[name]="name"
@@ -18,6 +19,7 @@
1819
[user]="user"
1920
[location]="location"
2021
[initialsType]="initialsType"
22+
[showOnlineIndicator]="showOnlineIndicator"
2123
></stream-avatar>
2224
</ng-template>
2325
<ng-container *ngIf="isVisible; else emptyPlaceholder">

projects/stream-chat-angular/src/lib/avatar-placeholder/avatar-placeholder.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export class AvatarPlaceholderComponent
6161
@Input() initialsType:
6262
| 'first-letter-of-first-word'
6363
| 'first-letter-of-each-word' = 'first-letter-of-first-word';
64+
/**
65+
* If a channel avatar is displayed, and if the channel has exactly two members a green dot is displayed if the other member is online. Set this flag to `false` to turn off this behavior.
66+
*/
67+
@Input() showOnlineIndicator = true;
6468
context: AvatarContext = {
6569
name: undefined,
6670
imageUrl: undefined,
@@ -70,6 +74,7 @@ export class AvatarPlaceholderComponent
7074
user: undefined,
7175
type: undefined,
7276
initialsType: undefined,
77+
showOnlineIndicator: undefined,
7378
};
7479
isVisible = true;
7580
private mutationObserver?: MutationObserver;
@@ -110,6 +115,7 @@ export class AvatarPlaceholderComponent
110115
user: this.user,
111116
channel: this.channel,
112117
initialsType: this.initialsType,
118+
showOnlineIndicator: this.showOnlineIndicator,
113119
};
114120
}
115121

projects/stream-chat-angular/src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export type AvatarContext = {
192192
channel?: Channel<DefaultStreamChatGenerics>;
193193
user?: User<DefaultStreamChatGenerics>;
194194
initialsType?: 'first-letter-of-first-word' | 'first-letter-of-each-word';
195+
showOnlineIndicator?: boolean;
195196
};
196197

197198
export type AttachmentPreviewListContext = {

0 commit comments

Comments
 (0)