ov-components: refactor leave button implementation for improved template handling

master
Carlos Santos 2025-09-19 14:52:01 +02:00
parent 6da901e7bb
commit 4654c48f22
2 changed files with 16 additions and 17 deletions

View File

@ -199,17 +199,17 @@
<!-- Leave session button --> <!-- Leave session button -->
@if (showLeaveButtonDirect()) { @if (showLeaveButtonDirect()) {
@if (toolbarLeaveButtonTemplate) { <button
<ng-container *ngTemplateOutlet="toolbarLeaveButtonTemplate"></ng-container> mat-icon-button
} @else { (click)="onLeaveClick()"
<button id="leave-btn"
mat-icon-button [class.mobile-btn]="isMobileView()"
(click)="onLeaveClick()" matTooltip="{{ 'TOOLBAR.LEAVE' | translate }}"
id="leave-btn" >
[class.mobile-btn]="isMobileView()" <mat-icon>call_end</mat-icon>
matTooltip="{{ 'TOOLBAR.LEAVE' | translate }}" </button>
> }
<mat-icon>call_end</mat-icon>
</button> @if (toolbarLeaveButtonTemplate) {
} <ng-container *ngTemplateOutlet="toolbarLeaveButtonTemplate"></ng-container>
} }

View File

@ -223,13 +223,12 @@ export class ParticipantPanelAfterLocalParticipantDirective {
} }
/** /**
* The ***ovLeaveButton** directive allows you to replace the default leave button with a custom template. * The ***ovLeaveButton** directive allows you to inject a custom leave button template. You can use the toolbarLeaveButton = false for
* Use this directive to provide your own button, confirm dialogs, or any custom leave logic while keeping * replacing the default leave button with your custom one.
* the internal leave flow intact.
* *
* Usage example: * Usage example:
* ```html * ```html
* <ov-videoconference> * <ov-videoconference [toolbarLeaveButton]="false">
* <ng-container *ovLeaveButton> * <ng-container *ovLeaveButton>
* <button class="my-leave-button" (click)="customLeave()"> * <button class="my-leave-button" (click)="customLeave()">
* Leave meeting * Leave meeting