Skip to content

Commit

Permalink
example: empty message placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Nov 9, 2023
1 parent 92845a2 commit e6793c3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions projects/customizations-example/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,11 @@
<ng-template #dateSeparator let-date="date" let-parsedDate="parsedDate">
{{ date }} - {{ parsedDate }}
</ng-template>

<ng-template #emptyMainMessageList>
<div class="empty-list"><div>No messages yet</div></div>
</ng-template>

<ng-template #emptyThreadMessageList>
<div class="empty-list"><div>No thread replies yet</div></div>
</ng-template>
7 changes: 7 additions & 0 deletions projects/customizations-example/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.empty-list {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
}
10 changes: 10 additions & 0 deletions projects/customizations-example/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class AppComponent implements AfterViewInit {
private customAttachmentUploadTemplate!: TemplateRef<CustomAttachmentUploadContext>;
@ViewChild('dateSeparator')
private dateSeparatorTemplate!: TemplateRef<DateSeparatorContext>;
@ViewChild('emptyMainMessageList')
private emptyMainMessageListTemplate!: TemplateRef<void>;
@ViewChild('emptyThreadMessageList')
private emptyThreadMessageListTemplate!: TemplateRef<void>;

constructor(
private chatService: ChatClientService,
Expand Down Expand Up @@ -170,6 +174,12 @@ export class AppComponent implements AfterViewInit {
this.customTemplatesService.dateSeparatorTemplate$.next(
this.dateSeparatorTemplate
);
this.customTemplatesService.emptyMainMessageListPlaceholder$.next(
this.emptyMainMessageListTemplate
);
this.customTemplatesService.emptyThreadMessageListPlaceholder$.next(
this.emptyThreadMessageListTemplate
);
}

inviteClicked(channel: Channel) {
Expand Down
5 changes: 5 additions & 0 deletions projects/customizations-example/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ body {
.material-icons {
font-family: "Material Icons" !important;
}

.str-chat__thread
.str-chat__main-panel-inner.str-chat-angular__message-list-host--empty {
height: 100%;
}

0 comments on commit e6793c3

Please sign in to comment.