Skip to content

Commit

Permalink
update for public preview changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnubansaltarento committed Aug 11, 2024
1 parent 1f7a875 commit 3815dc4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,14 @@ export class AppTocContentCardV2Component implements OnInit {
if(localContentData.primaryCategory === NsContent.EPrimaryCategory.MODULE) {
this.hierarchyMapData[identifier]['duration'] = this.hierarchyMapData[identifier].leafNodes.reduce(
(sum: any, childID: any) => {
return sum + Number(this.hierarchyMapData[childID].duration || this.hierarchyMapData[childID].expectedDuration || 0)
if(this.hierarchyMapData && this.hierarchyMapData[childID]) {
return sum + Number(this.hierarchyMapData[childID].duration || this.hierarchyMapData[childID].expectedDuration || 0)
}

}, 0)
}
// tslint:disable
const completedItems = _.filter(this.hierarchyMapData[identifier].leafNodes, r => this.hierarchyMapData[r].completionStatus === 2 || this.hierarchyMapData[r].completionPercentage === 100)
const completedItems = _.filter(this.hierarchyMapData[identifier].leafNodes, r => (this.hierarchyMapData[r] && (this.hierarchyMapData[r].completionStatus === 2 || this.hierarchyMapData[r].completionPercentage === 100)))
const totalCount = _.toInteger(_.get(this.hierarchyMapData[identifier], 'leafNodesCount')) || 1
this.hierarchyMapData[identifier]['completionPercentage'] = Number(((completedItems.length / totalCount) * 100).toFixed())
this.hierarchyMapData[identifier]['completionStatus'] = (this.hierarchyMapData[identifier].completionPercentage >= 100) ? 2 : 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
<div class="text-xs font-bold text-white leading-3">{{ translateLabel(content?.primaryCategory, 'searchfilters') }}</div>
</ng-container>
</div>
<div (click)="onClickOfShare()" class="flex flex-row items-center justify-end gap-2 share-tag" *ngIf="canShare">
<div (click)="onClickOfShare()" class="flex flex-row items-center justify-end gap-2 share-tag" *ngIf="canShare && !forPreview">
<mat-icon>share</mat-icon>
<div>{{ 'apptocsinglepage.share' | translate }}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,12 @@ export class ViewerSecondaryTopBarComponent implements OnInit, OnDestroy {
})
}
} else {
this.router.navigateByUrl(`public/toc/${this.collectionId}/overview`)
if(window.location.href.includes('editMode=true')) {
this.router.navigateByUrl(`public/toc/${this.collectionId}/overview?editMode=true`)
} else {
this.router.navigateByUrl(`public/toc/${this.collectionId}/overview`)
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
</ng-container>

<div color="secondary" class="flex mat-body-2 flex-middle font-bold-imp px-2 cursor-pointer" (click)="openFeedbackDialog()">
<mat-icon
<mat-icon *ngIf="!forPreview"
class=" icon-margin mat-icon notranslate material-icons mat-icon-no-color mr-2 blue-color">star</mat-icon>
<ng-container *ngIf="!userRating">
<ng-container *ngIf="!userRating && !forPreview">
<span class="mr-1 blue-color">{{'apptocsinglepage.rateNow' | translate}}</span>
<!-- <span class="lowercase">
<ng-container *ngIf="content?.primaryCategory === primaryCategory.PROGRAM">
Expand All @@ -89,11 +89,11 @@
</ng-container>
</span> -->
</ng-container>
<ng-container *ngIf="userRating">
<ng-container *ngIf="userRating && !forPreview">
<span class="mr-1 blue-color"> {{'apptocsinglepage.editRating' | translate}} </span>
</ng-container>
</div>
<div (click)="onClickOfShare()" *ngIf="canShare"
<div (click)="onClickOfShare()" *ngIf="canShare && !forPreview"
class="flex flex-row cursor-pointer items-center justify-end gap-2 share-tag margin-left-l">
<mat-icon class="blue-color">share</mat-icon>
<span class="blue-color">{{'apptocsinglepage.share' | translate}}</span>
Expand Down Expand Up @@ -152,7 +152,7 @@
<div color="secondary" class="flex mat-body-2 flex-middle font-bold-imp px-2" (click)="openFeedbackDialog()">
<mat-icon
class=" icon-margin mat-icon notranslate material-icons mat-icon-no-color mr-2 blue-color">star</mat-icon>
<ng-container *ngIf="!userRating">
<ng-container *ngIf="!userRating && !forPreview">
<span class="mr-1 blue-color">{{'apptocsinglepage.rateNow' | translate}}</span>
<!-- <span class="lowercase">
<ng-container *ngIf="content?.primaryCategory === primaryCategory.PROGRAM">
Expand All @@ -164,7 +164,7 @@
</ng-container>
</span> -->
</ng-container>
<ng-container *ngIf="userRating">
<ng-container *ngIf="userRating && !forPreview">
<span> {{'apptocsinglepage.editRating' | translate}} </span>
</ng-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class ViewerTopBarComponent implements OnInit, OnDestroy, OnChanges {
ComputeCompletedNodesAndPercent(identifier: string) {
if(this.hierarchyMapData && this.hierarchyMapData[identifier]) {
// tslint:disable
const completedItems = _.filter(this.hierarchyMapData[identifier].leafNodes, r => this.hierarchyMapData[r].completionStatus === 2 || this.hierarchyMapData[r].completionPercentage === 100)
const completedItems = _.filter(this.hierarchyMapData[identifier].leafNodes, r => (this.hierarchyMapData[r] && (this.hierarchyMapData[r].completionStatus === 2 || this.hierarchyMapData[r].completionPercentage === 100)))
this.completedCount = completedItems.length
this.completedCountOutput.emit(this.completedCount)
this.overallLeafNodes = _.toInteger(_.get(this.hierarchyMapData[identifier], 'leafNodesCount')) || 1
Expand Down
15 changes: 10 additions & 5 deletions project/ws/viewer/src/lib/plugins/html/html.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ export class HtmlComponent implements OnInit, OnChanges, OnDestroy {
// this.fireRealTimeProgress(this.htmlContent)
// // this.store.clearAll()
// }
this.sub.unsubscribe()
if(this.sub) {
this.sub.unsubscribe()
}
}

private fireRealTimeProgress(htmlContent: any) {
Expand Down Expand Up @@ -250,7 +252,10 @@ export class HtmlComponent implements OnInit, OnChanges, OnDestroy {
// }
// call fireRealTimeProgress func for LMS data and non-LMS data also
this.fireRealTimeProgress(this.oldData)
this.sub.unsubscribe()
if(this.sub) {
this.sub.unsubscribe()
}

this.ticks = 0
this.timer = timer(1000, 1000)
// subscribing to a observable returns a subscription object
Expand Down Expand Up @@ -358,7 +363,7 @@ export class HtmlComponent implements OnInit, OnChanges, OnDestroy {
// `${this.htmlContent.streamingUrl}/${this.htmlContent.initFile}?timestamp='${new Date().getTime()}`)
this.iframeUrl = this.domSanitizer.bypassSecurityTrustResourceUrl(
// tslint:disable-next-line:max-line-length
`${this.generateUrl(this.htmlContent.streamingUrl)}/${this.htmlContent.initFile}?timestamp='${new Date().getTime()}`
`${this.generateUrl(this.htmlContent.streamingUrl)}?timestamp='${new Date().getTime()}`
)
}
} else {
Expand Down Expand Up @@ -536,7 +541,7 @@ export class HtmlComponent implements OnInit, OnChanges, OnDestroy {
newLink.push(chunk[i])
}
}
const newUrl = newLink.join('/')
return newUrl
// const newUrl = newLink.join('/')
return oldUrl
}
}
12 changes: 4 additions & 8 deletions project/ws/viewer/src/lib/viewer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@
<section *ngIf="status === 'pending'">
<mat-spinner></mat-spinner>
</section>
<div *ngIf="isPreview" class="flex flex-1 flex-column mb-3">
<div *ngIf="isPreview" class="flex flex-1 flex-column">
<div *ngIf="!viewerHeaderSideBarToggleFlag">
<a i18n-aria-label aria-label="Back" (click)="navigateToBack()" mat-icon-button>
<mat-icon>arrow_back</mat-icon>
</a>
</div>
<div class="display-none">
<div class="flex flex-1 flex-row-reverse">
<a *ngIf="show" class="padding-right-s padding-top-xs" role="button" (click)="show=false">
<mat-icon class="cursor-pointer ws-mat-default-text">close</mat-icon>
Expand All @@ -97,13 +98,7 @@
</div>
<div class="flex flex-1 flex-column" *ngIf="show">
<div class="flex flex-1 flex-row-c">
<!-- <div class="flex flex-1">
<a i18n (click)="show=false" mat-button
class="flex text-center margin-left-s flex-end ws-mat-accent-border ws-mat-primary-text">No,
continue viewing
<mat-icon>arrow_right_alt</mat-icon>
</a>
</div> -->

<div class="flex flex-1 flex-center">
<a i18n mat-button [href]="'/protected/v8/resource?redirect_uri=/app/toc/'+ collectionId +'/overview'"
class="flex text-center margin-right-s flex-end ws-mat-default-text ws-mat-accent-border-active">
Expand All @@ -115,6 +110,7 @@
</div>
</div>
</div>
</div>

<div class="viewer-player-container" [ngClass]="contentMIMEType == 'application/vnd.sunbird.questionset' && compatibilityLevel < 7 ? 'sidenavContent':'standaloneSidenavContent'">
<router-outlet (activate)="getContentData($event)"></router-outlet>
Expand Down
4 changes: 3 additions & 1 deletion project/ws/viewer/src/lib/viewer.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,6 @@

::ng-deep .mat-drawer.mat-drawer-side{
z-index: 0 !important;
}
}

.display-none {display: none !important;}

0 comments on commit 3815dc4

Please sign in to comment.