<!-- 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" [showBrowserWarning]="false">
        </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 *ngIf="loaded && isOnline" [priority]="700" [content]="'core.refresh' | translate"
            (action)="doRefresh(null, $event)" [iconAction]="refreshIcon" [closeOnClick]="false">
        </core-context-menu-item>
        <core-context-menu-item *ngIf="loaded && hasOffline && isOnline" [priority]="600"
            [content]="'core.settings.synchronizenow' | translate" (action)="doRefresh(null, $event, true)" [iconAction]="syncIcon"
            [closeOnClick]="false">
        </core-context-menu-item>
        <core-context-menu-item *ngIf="prefetchStatusIcon" [priority]="500" [content]="prefetchText" (action)="prefetch($event)"
            [iconAction]="prefetchStatusIcon" [closeOnClick]="false">
        </core-context-menu-item>
    </core-context-menu>
</core-navbar-buttons>

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

    <!-- Activity info. -->
    <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
        [component]="component" [componentId]="componentId" [courseId]="courseId">
    </core-course-module-info>

    <ion-card *ngIf="chatInfo" class="core-info-card">
        <ion-item>
            <ion-icon name="fas-clock" slot="start" aria-hidden="true"></ion-icon>
            <ion-label>{{ 'addon.mod_chat.sessionstart' | translate:{$a: chatInfo} }}</ion-label>
        </ion-item>
    </ion-card>

    <ng-container *ngIf="chat">
        <ion-button class="ion-margin ion-text-wrap" expand="block" color="primary" (click)="enterChat()">
            {{ 'addon.mod_chat.enterchat' | translate }}
        </ion-button>
        <ion-button class="ion-margin ion-text-wrap" expand="block" color="light" (click)="viewSessions()">
            {{ 'addon.mod_chat.viewreport' | translate }}
        </ion-button>
    </ng-container>
</core-loading>

<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id">
</core-course-module-navigation>