Skip to content

Commit

Permalink
in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Nov 3, 2023
1 parent 5ca53d1 commit 01507da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ export class CustomTemplatesService {
newMessagesIndicatorTemplate$ = new BehaviorSubject<
TemplateRef<void> | undefined
>(undefined);
emptyChannelPlaceholder$ = new BehaviorSubject<TemplateRef<void> | undefined>(
undefined
);
emptyChannelPlaceholder$ = new BehaviorSubject<
TemplateRef<{ mode: 'main' | 'thread' }> | undefined
>(undefined);

constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
"
></stream-loading-indicator>
<ng-container *ngIf="messages$ | async as messages">
<ng-container *ngIf="messages.length > 0; else noMessages">
<ng-container
*ngIf="
messages.length > 0 || !emptyChannelPlaceholderTemplate;
else noMessages
"
>
<ng-container
*ngFor="
let message of messages;
Expand Down Expand Up @@ -111,7 +116,8 @@
<ng-template #noMessages>
<ng-container
*ngTemplateOutlet="
emptyChannelPlaceholderTemplate || defaultTemplate
emptyChannelPlaceholderTemplate;
context: { mode: mode }
"
></ng-container>
<ng-template #defaultTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export class MessageListComponent
messageTemplate: TemplateRef<MessageContext> | undefined;
customDateSeparatorTemplate: TemplateRef<DateSeparatorContext> | undefined;
customnewMessagesIndicatorTemplate: TemplateRef<void> | undefined;
emptyChannelPlaceholderTemplate: TemplateRef<void> | undefined;
emptyChannelPlaceholderTemplate: TemplateRef<{
mode: 'main' | 'thread';
}> | null = null;
messages$!: Observable<StreamMessage[]>;
enabledMessageActions: string[] = [];
@HostBinding('class') private class =
Expand Down Expand Up @@ -222,7 +224,7 @@ export class MessageListComponent
);
this.subscriptions.push(
this.customTemplatesService.emptyChannelPlaceholder$.subscribe(
(template) => (this.emptyChannelPlaceholderTemplate = template)
(template) => (this.emptyChannelPlaceholderTemplate = template || null)
)
);
this.usersTypingInChannel$ = this.channelService.usersTypingInChannel$;
Expand Down

0 comments on commit 01507da

Please sign in to comment.