From 2291d7e307fea03008ec499f7bf839c24d4b6457 Mon Sep 17 00:00:00 2001 From: Bharath Kumar Date: Sat, 6 Jul 2024 20:05:58 +0530 Subject: [PATCH] changes in the home page for the strips --- .../certificate-dialog.component.html | 4 +- .../certificate-dialog.component.scss | 33 +++++++++++++ package.json | 2 +- .../service/karma-program-data.service.ts | 2 +- .../see-all-home/see-all-home.component.ts | 32 +++++++----- src/app/home/home.module.ts | 3 +- .../home/feed-list/feed-list.component.html | 18 ++++++- .../home/feed-list/feed-list.component.ts | 49 ++++++++++++++++++- src/app/home/home/home.component.html | 2 +- src/app/home/home/home.component.ts | 2 +- 10 files changed, 124 insertions(+), 23 deletions(-) diff --git a/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.html b/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.html index 705a14f7a..3f1096e1c 100644 --- a/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.html +++ b/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.html @@ -10,11 +10,11 @@ - + share Share - + cloud_download {{'certificatedialog.download' | translate}} diff --git a/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.scss b/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.scss index d2491382b..c1cae38b7 100644 --- a/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.scss +++ b/library/ws-widget/collection/src/lib/_common/certificate-dialog/certificate-dialog.component.scss @@ -68,6 +68,9 @@ a.download_btn { float: right; top: -52px; right: -52px; + position: absolute; + top: 19px; + right: 18px; } ::ng-deep .icon-outside .mat-dialog-container { overflow: unset; @@ -95,3 +98,33 @@ a.download_btn { } } } +.btn-custom{ + box-sizing: border-box; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + outline: 0; + border: none; + -webkit-tap-highlight-color: transparent; + display: inline-block; + white-space: nowrap; + text-decoration: none; + vertical-align: baseline; + text-align: center; + margin: 0; + min-width: 64px; + line-height: 36px; + padding: 0 16px; + border-radius: 4px; + overflow: visible; +} + + +.close-button { + position: absolute !important; + top: 19px !important; + right: 18px !important; +} \ No newline at end of file diff --git a/package.json b/package.json index f2fda539e..eba4f30de 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@project-sunbird/sb-styles": "0.0.7", "@project-sunbird/sunbird-quml-player": "0.0.6", "@project-sunbird/telemetry-sdk": "0.0.26", - "@sunbird-cb/consumption": "0.0.45", + "@sunbird-cb/consumption": "0.0.46", "@sunbird-cb/design-system": "0.0.2", "@sunbird-cb/discussions-ui-v8": "2.1.3", "@sunbird-cb/micro-surveys": "^2.0.17", diff --git a/project/ws/app/src/lib/routes/karma-programs/service/karma-program-data.service.ts b/project/ws/app/src/lib/routes/karma-programs/service/karma-program-data.service.ts index 7c2d49758..ccbd944fb 100644 --- a/project/ws/app/src/lib/routes/karma-programs/service/karma-program-data.service.ts +++ b/project/ws/app/src/lib/routes/karma-programs/service/karma-program-data.service.ts @@ -26,7 +26,7 @@ resolve( 'pageSize': 100, 'orderBy': 'createdOn', 'orderDirection': 'ASC', - 'facets': ['category', 'orgId'] + 'facets': ['category', 'orgId'], } return this.http.post(requestUrl, requestData).pipe( map((rData: any) => ({ data: rData, error: null })), diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts b/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts index ac30308db..4baf0bd7a 100644 --- a/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts @@ -62,15 +62,17 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy { } }) if (!this.seeAllPageConfig) { - configData && configData.assessmentData.forEach((ele: any) => { - if (ele && ele.strips && ele.strips.length > 0) { - ele.strips.forEach((subEle: any) => { - if (subEle.key === this.keyData) { - this.seeAllPageConfig = subEle - } - }) - } - }) + if (configData) { + configData.assessmentData.forEach((ele: any) => { + if (ele && ele.strips && ele.strips.length > 0) { + ele.strips.forEach((subEle: any) => { + if (subEle.key === this.keyData) { + this.seeAllPageConfig = subEle + } + }) + } + }) + } } if ( this.tabSelected && @@ -301,8 +303,10 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy { if (firstTab.requestRequired) { if (this.seeAllPageConfig.tabs) { const allTabs = this.seeAllPageConfig.tabs - const currentTabFromMap = (allTabs && allTabs.length && allTabs[this.dynamicTabIndex]) as NsContentStripWithTabs.IContentStripTab - this.getTabDataByNewReqSearchV6(strip, this.dynamicTabIndex, currentTabFromMap, calculateParentStatus) + const currentTabFromMap = (allTabs && allTabs.length && + allTabs[this.dynamicTabIndex]) as NsContentStripWithTabs.IContentStripTab + this.getTabDataByNewReqSearchV6(strip, this.dynamicTabIndex, + currentTabFromMap, calculateParentStatus) } } @@ -385,8 +389,10 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy { if (firstTab.requestRequired) { if (this.seeAllPageConfig.tabs) { const allTabs = this.seeAllPageConfig.tabs - const currentTabFromMap = (allTabs && allTabs.length && allTabs[this.dynamicTabIndex]) as NsContentStripWithTabs.IContentStripTab - this.getTabDataByNewReqTrending(strip, this.dynamicTabIndex, currentTabFromMap, calculateParentStatus) + const currentTabFromMap = (allTabs && allTabs.length && + allTabs[this.dynamicTabIndex]) as NsContentStripWithTabs.IContentStripTab + this.getTabDataByNewReqTrending(strip, this.dynamicTabIndex, currentTabFromMap, + calculateParentStatus) } } diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index ceee16ee8..e9b50ed48 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -39,7 +39,7 @@ import { HttpLoaderFactory } from '../app.module' import { HttpClient } from '@angular/common/http' import { UserLeaderboardModule } from '@sunbird-cb/collection/src/lib/_common/user-leaderboard/user-leaderboard.module' import { MatTooltipModule } from '@angular/material' -import { ContentStripWithTabsLibModule } from '@sunbird-cb/consumption' +import { ContentStripWithTabsLibModule, ContentStripWithTabsPillsModule } from '@sunbird-cb/consumption' @NgModule({ declarations: [ @@ -71,6 +71,7 @@ import { ContentStripWithTabsLibModule } from '@sunbird-cb/consumption' AvatarPhotoModule, PendingRequestModule, ContentStripWithTabsLibModule, + ContentStripWithTabsPillsModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, diff --git a/src/app/home/home/feed-list/feed-list.component.html b/src/app/home/home/feed-list/feed-list.component.html index b9d9ed5c5..f417cb6ee 100644 --- a/src/app/home/home/feed-list/feed-list.component.html +++ b/src/app/home/home/feed-list/feed-list.component.html @@ -9,5 +9,19 @@ --> - - + + + + + + + + + + + + diff --git a/src/app/home/home/feed-list/feed-list.component.ts b/src/app/home/home/feed-list/feed-list.component.ts index b98c8c0eb..440f57994 100644 --- a/src/app/home/home/feed-list/feed-list.component.ts +++ b/src/app/home/home/feed-list/feed-list.component.ts @@ -1,6 +1,10 @@ import { Component, Input, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' +import { UtilityService, EventService, WsEvents } from '@sunbird-cb/utils-v2' +/* tslint:disable */ +import _ from 'lodash' +/* tslint:enable */ @Component({ selector: 'ws-feed-list', templateUrl: './feed-list.component.html', @@ -8,12 +12,55 @@ import { ActivatedRoute } from '@angular/router' }) export class FeedListComponent implements OnInit { contentStripData = {} + isMobile = false @Input() widgetData: any - constructor(private activatedRoute: ActivatedRoute) { } + isTelemetryRaised = false + constructor(private activatedRoute: ActivatedRoute, + private events: EventService, private utilitySvc: UtilityService) { } ngOnInit() { if (this.activatedRoute.snapshot.data.pageData && this.activatedRoute.snapshot.data.pageData.data) { this.contentStripData = this.activatedRoute.snapshot.data.pageData.data || [] } + this.isMobile = this.utilitySvc.isMobile + } + + raiseTelemetryInteratEvent(event: any) { + if (event && event.viewMoreUrl) { + this.raiseTelemetry(`${event.stripTitle} ${event.viewMoreUrl.viewMoreText}`, event.typeOfTelemetry) + } + if (!this.isTelemetryRaised && event && !event.viewMoreUrl) { + const id = event.typeOfTelemetry === 'mdo-channel' ? event.identifier : event.orgId + const type = event.typeOfTelemetry === 'mdo-channel' ? event.orgName : event.title + this.events.raiseInteractTelemetry( + { + type: 'click', + subType: event.typeOfTelemetry, + id: 'content-card', + }, + { + id, + type, + }, + { + module: WsEvents.EnumTelemetrymodules.HOME, + } + ) + } + this.isTelemetryRaised = true + } + + raiseTelemetry(name: string, subtype: string) { + this.events.raiseInteractTelemetry( + { + type: 'click', + subType: subtype, + id: `${_.kebabCase(name).toLocaleLowerCase()}`, + }, + {}, + { + module: WsEvents.EnumTelemetrymodules.HOME, + } + ) } } diff --git a/src/app/home/home/home.component.html b/src/app/home/home/home.component.html index 0782ffdea..eae1b0e9d 100644 --- a/src/app/home/home/home.component.html +++ b/src/app/home/home/home.component.html @@ -47,7 +47,7 @@ - +
diff --git a/src/app/home/home/home.component.ts b/src/app/home/home/home.component.ts index 426067bea..ecb7f41cd 100644 --- a/src/app/home/home/home.component.ts +++ b/src/app/home/home/home.component.ts @@ -98,7 +98,7 @@ export class HomeComponent implements OnInit, AfterViewInit { if (this.activatedRoute.snapshot.data.pageData && this.activatedRoute.snapshot.data.pageData.data) { this.contentStripData = this.activatedRoute.snapshot.data.pageData.data || [] // tslint:disable-next-line: prefer-template - this.contentStripData = (this.contentStripData.homeStrips || []).sort((a: any, b: any) => a.order - b.order) + this.contentStripData = (this.contentStripData.newHomeStrip || []).sort((a: any, b: any) => a.order - b.order) // tslint:disable-next-line for (let i = 0; i < this.contentStripData.length; i++) { if (this.contentStripData[i] &&