<!-- Buttons to add to the header. -->
<core-navbar-buttons slot="end">
    <core-context-menu>
        <core-context-menu-item *ngIf="externalUrl" [priority]="900" [content]="'core.openinbrowser' | translate"
            [href]="externalUrl" iconAction="fas-external-link-alt"></core-context-menu-item>
        <core-context-menu-item *ngIf="description" [priority]="800" [content]="'core.moduleintro' | translate"
            (action)="expandDescription()" iconAction="fas-arrow-right"></core-context-menu-item>
        <core-context-menu-item *ngIf="blog" [priority]="750" content="{{'addon.blog.blog' | translate}}"
            iconAction="far-newspaper" (action)="gotoBlog()"></core-context-menu-item>
        <core-context-menu-item [priority]="700" [content]="'core.refresh' | translate" (action)="doRefresh(null, $event)"
            [iconAction]="refreshIcon" [closeOnClick]="false"></core-context-menu-item>
        <core-context-menu-item *ngIf="prefetchStatusIcon" [priority]="600" [content]="prefetchText" (action)="prefetch($event)"
            [iconAction]="prefetchStatusIcon" [closeOnClick]="false"></core-context-menu-item>
        <core-context-menu-item *ngIf="size" [priority]="500" [content]="'core.clearstoreddata' | translate:{$a: size}"
            iconDescription="fas-archive" (action)="removeFiles($event)" iconAction="fas-trash" [closeOnClick]="false">
        </core-context-menu-item>
    </core-context-menu>
</core-navbar-buttons>

<!-- Content. -->
<core-loading [hideUntil]="loaded" class="safe-area-page core-loading-fullheight">

    <!-- Activity info. -->
    <core-course-module-info *ngIf="showCompletion" [module]="module" [showManualCompletion]="true"
        (completionChanged)="onCompletionChange()">
    </core-course-module-info>

    <core-course-module-description *ngIf="mode != 'iframe' && (mode != 'embedded' || displayDescription)"
        [description]="description" [component]="component" [componentId]="componentId" contextLevel="module"
        [contextInstanceId]="module.id" [courseId]="courseId">
    </core-course-module-description>

    <ion-card class="core-warning-card" *ngIf="warning">
        <ion-item>
            <ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
            <ion-label><span [innerHTML]="warning"></span></ion-label>
        </ion-item>
    </ion-card>

    <ng-container *ngIf="mode == 'iframe'">
        <core-iframe [src]="src"></core-iframe>
    </ng-container>

    <div *ngIf="mode == 'embedded'">
        <core-format-text [text]="contentText" [filter]="false"></core-format-text>
    </div>

    <ng-container *ngIf="mode == 'external'">
        <ion-button expand="block" class="ion-margin" (click)="open(openFileAction.OPEN)">
            <ng-container *ngIf="isStreamedFile">
                <ion-icon name="fas-play" slot="start" aria-hidden="true"></ion-icon>
                {{ 'core.play' | translate }}
            </ng-container>
            <ng-container *ngIf="!isStreamedFile">
                <ion-icon name="far-file" slot="start" aria-hidden="true"></ion-icon>
                {{ 'addon.mod_resource.openthefile' | translate }}
            </ng-container>
        </ion-button>

        <ion-button *ngIf="isIOS && (!shouldOpenInBrowser || !isOnline)" expand="block" class="ion-margin"
            (click)="open(openFileAction.OPEN_WITH)">
            <ion-icon name="far-share-square" slot="start" aria-hidden="true"></ion-icon>
            {{ 'core.openwith' | translate }}
        </ion-button>
    </ng-container>

</core-loading>