From 113bf4efa62aa8c4abf753a99af2e576a086028e Mon Sep 17 00:00:00 2001 From: Afzal84 Date: Thu, 8 Aug 2024 13:23:55 +0530 Subject: [PATCH 1/7] Fixed:- Survey popup changes --- .../survey-form/survey-form.component.html | 20 ++++ .../survey-form/survey-form.component.scss | 100 ++++++++++++++++++ .../survey-form/survey-form.component.spec.ts | 25 +++++ .../survey-form/survey-form.component.ts | 52 +++++++++ src/app/home/home.module.ts | 6 +- src/app/home/home/home.component.html | 1 + src/app/services/init.service.ts | 1 + 7 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 src/app/component/app-survey/survey-form/survey-form.component.html create mode 100644 src/app/component/app-survey/survey-form/survey-form.component.scss create mode 100644 src/app/component/app-survey/survey-form/survey-form.component.spec.ts create mode 100644 src/app/component/app-survey/survey-form/survey-form.component.ts diff --git a/src/app/component/app-survey/survey-form/survey-form.component.html b/src/app/component/app-survey/survey-form/survey-form.component.html new file mode 100644 index 000000000..c42bf90c3 --- /dev/null +++ b/src/app/component/app-survey/survey-form/survey-form.component.html @@ -0,0 +1,20 @@ +
+ +
\ No newline at end of file diff --git a/src/app/component/app-survey/survey-form/survey-form.component.scss b/src/app/component/app-survey/survey-form/survey-form.component.scss new file mode 100644 index 000000000..aac6f3d30 --- /dev/null +++ b/src/app/component/app-survey/survey-form/survey-form.component.scss @@ -0,0 +1,100 @@ +.main-survey { + background-color: rgba(0, 0, 0, 0.4); + position: relative; + height: 100vh; + width: 100%; + z-index: 9999; + position: fixed; + top: 0px; + bottom: 0px; + left: 0px; + right: 0px; + margin: 0px; + box-sizing: border-box; + @media screen and (max-width:768px) { + // overflow-y: auto; + // overflow-x: hidden; + } +} +.survey-img { + // width: 400px; + height: 400px; + +} +.survey-img-link { + cursor: pointer; +} +.close-button { + cursor: pointer; + vertical-align: top; + color: #000000; + font-size: 20px; + position: absolute; + top: 0px; + right: 0px; + margin-top: 40px; + margin-right: 40px; + background-color: #FFFFFF; + border-radius: 50%; + padding: 4px 4px; + } + + .desktop-img { + display: flex !important; + @media screen and (max-width:768px) { + display: none !important; + } + } + .mobile-img-box { + display: none !important; + border: 2px solid red; + // @media screen and (max-width:768px) { + @media (min-width: 425px) and (max-width: 768px) { + display: flex !important; + margin-top: 0px; + width: 90% !important; + height: 90% !important; + margin-left: 5% !important; + } + @media screen and (max-width:475) { + display: flex !important; + margin-top: 0px; + width: 90% !important; + height: 90% !important; + margin-left: 5% !important; + } + @media (min-width: 300px) and (max-width: 424px) { + display: flex !important; + margin-top: 0px; + width: 90% !important; + height: 90% !important; + margin-left: 5% !important; + } + } + .mobile-survey-link { + background-color: #F3962F; + text-align: center; + color: #fff !important; + width: 360px; + height: 32px; + border-radius: 16px; + margin-bottom: 16px; + line-height: 30px; + @media (min-width: 425px) and (max-width: 768px) { + width: 339px !important; + } + @media (min-width: 300px) and (max-width: 424px) { + width: 339px !important; + } + + + } +// .surver-inner { +// box-sizing: border-box; +// padding: 16px 16px; +// position: relative; +// width: 100%; +// } + + + diff --git a/src/app/component/app-survey/survey-form/survey-form.component.spec.ts b/src/app/component/app-survey/survey-form/survey-form.component.spec.ts new file mode 100644 index 000000000..b579f1633 --- /dev/null +++ b/src/app/component/app-survey/survey-form/survey-form.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SurveyFormComponent } from './survey-form.component'; + +describe('SurveyFormComponent', () => { + let component: SurveyFormComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SurveyFormComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SurveyFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/component/app-survey/survey-form/survey-form.component.ts b/src/app/component/app-survey/survey-form/survey-form.component.ts new file mode 100644 index 000000000..1fb033007 --- /dev/null +++ b/src/app/component/app-survey/survey-form/survey-form.component.ts @@ -0,0 +1,52 @@ +import { Component, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { ConfigurationsService } from '@sunbird-cb/utils-v2' + +@Component({ + selector: 'ws-survey-form', + templateUrl: './survey-form.component.html', + styleUrls: ['./survey-form.component.scss'], +}) +export class SurveyFormComponent implements OnInit { + surveyPopupData: any + surveyPopup: any + IsSurveyPopup = true + widgetData: any + userRead: any + isTourDone: any + localStorageFlag: any + constructor( + private activatedRoute: ActivatedRoute, + private configSvc: ConfigurationsService, + ) { } + + ngOnInit() { + if (this.activatedRoute.snapshot.data.pageData && this.activatedRoute.snapshot.data.pageData.data) { + this.surveyPopupData = this.activatedRoute.snapshot.data.pageData.data.surveyPopup.banners + this.surveyPopup = this.activatedRoute.snapshot.data.pageData.data.surveyPopup + this.widgetData = this.activatedRoute.snapshot.data.pageData.data.surveyPopup + } + this.userRead = this.configSvc.unMappedUser + if (this.userRead && this.userRead.profileDetails && this.userRead.profileDetails.get_started_tour) { + if (this.userRead.profileDetails.get_started_tour.skipped || this.userRead.profileDetails.get_started_tour.visited) { + this.isTourDone = true + } else { + this.isTourDone = false + } + } + const localFlag = localStorage.getItem('surveyPopup') + if (localFlag === 'true') { + this.localStorageFlag = true + } else if (localFlag === 'false') { + this.localStorageFlag = false + } + } + + closeCard() { + this.IsSurveyPopup = false + if (this.localStorageFlag) { + localStorage.setItem('surveyPopup', 'false') + this.localStorageFlag = false + } + } +} diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 0fdf41bab..0f8260982 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -13,7 +13,7 @@ import { } from '@sunbird-cb/collection' import { SkeletonLoaderModule } from '@sunbird-cb/collection/src/lib/_common/skeleton-loader/skeleton-loader.module' import { ProfileCardStatsModule } from '@sunbird-cb/collection/src/lib/_common/profile-card-stats/profile-card-stats.module' -import { PipeRelativeTimeModule } from '@sunbird-cb/utils-v2' +import { PipeRelativeTimeModule, ImageResponsiveModule } from '@sunbird-cb/utils-v2' import { WeeklyClapsModule } from '@sunbird-cb/collection/src/lib/_common/weekly-claps/weekly-claps.module' import { TipsForLearnerModule } from '@sunbird-cb/collection/src/lib/_common/tips-for-learner/tips-for-learner.module' import { UpdatePostsModule } from '@sunbird-cb/collection/src/lib/_common/update-posts/update-posts.module' @@ -42,13 +42,14 @@ import { UserLeaderboardModule } from '@sunbird-cb/collection/src/lib/_common/us import { MatTooltipModule } from '@angular/material' import { ContentStripWithTabsLibModule, ContentStripWithTabsPillsModule } from '@sunbird-cb/consumption' import { SurveyFormModule } from '@sunbird-cb/collection/src/lib/_common/survey-form-left-section/survey-form/survey-form.module' +import { SurveyFormComponent } from '../component/app-survey/survey-form/survey-form.component' @NgModule({ declarations: [ HomeComponent, FeedListComponent, InsightSideBarComponent, PageContainerComponent, DiscussionInfoComponent, ClientSliderComponent, HomeOtherPortalComponent, HomeContainerComponent, DiscussHubComponent, - NetworkHubComponent, NotificationComponent], + NetworkHubComponent, NotificationComponent, SurveyFormComponent], imports: [ CommonModule, RouterModule, @@ -71,6 +72,7 @@ import { SurveyFormModule } from '@sunbird-cb/collection/src/lib/_common/survey- RecentRequestsModule, SkeletonLoaderModule, PipeRelativeTimeModule, + ImageResponsiveModule, AvatarPhotoModule, PendingRequestModule, ContentStripWithTabsLibModule, diff --git a/src/app/home/home/home.component.html b/src/app/home/home/home.component.html index 82e247468..357aee14e 100644 --- a/src/app/home/home/home.component.html +++ b/src/app/home/home/home.component.html @@ -1,3 +1,4 @@ +

{{'appKarmapointsPanel.earn' |translate}} KarmaPoints diff --git a/src/app/services/init.service.ts b/src/app/services/init.service.ts index c679e19b2..13bbe40b3 100755 --- a/src/app/services/init.service.ts +++ b/src/app/services/init.service.ts @@ -858,6 +858,7 @@ export class InitService { }) } }) + localStorage.setItem('surveyPopup', 'true') } // get default url From 4abde0712ecd01db365dd312ad47a7621aef8d8b Mon Sep 17 00:00:00 2001 From: nitinraj-tarento Date: Thu, 8 Aug 2024 14:22:55 +0530 Subject: [PATCH 2/7] survey form ui fix --- .../survey-form/survey-form.component.html | 6 +- .../survey-form/survey-form.component.scss | 67 ++++++++----------- 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/src/app/component/app-survey/survey-form/survey-form.component.html b/src/app/component/app-survey/survey-form/survey-form.component.html index c42bf90c3..3dfe3bbac 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.html +++ b/src/app/component/app-survey/survey-form/survey-form.component.html @@ -5,13 +5,13 @@ -

diff --git a/src/app/component/app-survey/survey-form/survey-form.component.scss b/src/app/component/app-survey/survey-form/survey-form.component.scss index aac6f3d30..5f6c84928 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.scss +++ b/src/app/component/app-survey/survey-form/survey-form.component.scss @@ -1,6 +1,5 @@ .main-survey { background-color: rgba(0, 0, 0, 0.4); - position: relative; height: 100vh; width: 100%; z-index: 9999; @@ -10,19 +9,14 @@ left: 0px; right: 0px; margin: 0px; - box-sizing: border-box; - @media screen and (max-width:768px) { - // overflow-y: auto; - // overflow-x: hidden; - } + padding: 0; + overflow: hidden; } -.survey-img { - // width: 400px; - height: 400px; -} .survey-img-link { cursor: pointer; + width: 80%; + margin: auto; } .close-button { cursor: pointer; @@ -47,28 +41,14 @@ } .mobile-img-box { display: none !important; - border: 2px solid red; - // @media screen and (max-width:768px) { - @media (min-width: 425px) and (max-width: 768px) { - display: flex !important; - margin-top: 0px; - width: 90% !important; - height: 90% !important; - margin-left: 5% !important; - } - @media screen and (max-width:475) { + margin:auto; + @media (min-width: 476px) and (max-width: 768px) { display: flex !important; - margin-top: 0px; - width: 90% !important; - height: 90% !important; - margin-left: 5% !important; + width: 80%; } - @media (min-width: 300px) and (max-width: 424px) { + @media screen and (max-width:475px) { display: flex !important; - margin-top: 0px; - width: 90% !important; - height: 90% !important; - margin-left: 5% !important; + width: 90%; } } .mobile-survey-link { @@ -80,21 +60,28 @@ border-radius: 16px; margin-bottom: 16px; line-height: 30px; - @media (min-width: 425px) and (max-width: 768px) { - width: 339px !important; - } - @media (min-width: 300px) and (max-width: 424px) { - width: 339px !important; + + @media screen and (max-width:768px) { + width: 94%; + margin: auto; } + } + .surver-inner { + padding:0; + width: 100%; + overflow: hidden; + } + .banner-image-solo { + width: 100%; + height: auto; + } + + .mobile-banner-image-solo { + width: 100%; + height: auto; } -// .surver-inner { -// box-sizing: border-box; -// padding: 16px 16px; -// position: relative; -// width: 100%; -// } From 75d45583ee0a15866ef474fc6c74ab2fad9f49ee Mon Sep 17 00:00:00 2001 From: Afzal84 Date: Thu, 8 Aug 2024 15:37:13 +0530 Subject: [PATCH 3/7] Fixed:- Survey popup assets fix --- .../app-survey/survey-form/survey-form.component.html | 2 +- src/app/services/init.service.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/component/app-survey/survey-form/survey-form.component.html b/src/app/component/app-survey/survey-form/survey-form.component.html index c42bf90c3..c9f574e97 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.html +++ b/src/app/component/app-survey/survey-form/survey-form.component.html @@ -1,4 +1,4 @@ -
+
close diff --git a/src/app/services/init.service.ts b/src/app/services/init.service.ts index 13bbe40b3..15a6db7fe 100755 --- a/src/app/services/init.service.ts +++ b/src/app/services/init.service.ts @@ -858,7 +858,12 @@ export class InitService { }) } }) - localStorage.setItem('surveyPopup', 'true') + const checkSurvey = localStorage.getItem('surveyPopup') + if (checkSurvey && checkSurvey === 'false') { + localStorage.setItem('surveyPopup', 'false') + } else { + localStorage.setItem('surveyPopup', 'true') + } } // get default url From 7f6d1544576299b23ebeeb7d79ff7e905aa5bece Mon Sep 17 00:00:00 2001 From: Afzal84 Date: Thu, 8 Aug 2024 16:30:33 +0530 Subject: [PATCH 4/7] Fixed:- Survey popup assets fix --- .../app-survey/survey-form/survey-form.component.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/component/app-survey/survey-form/survey-form.component.scss b/src/app/component/app-survey/survey-form/survey-form.component.scss index 5f6c84928..87c3b966e 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.scss +++ b/src/app/component/app-survey/survey-form/survey-form.component.scss @@ -44,11 +44,11 @@ margin:auto; @media (min-width: 476px) and (max-width: 768px) { display: flex !important; - width: 80%; + width: 45%; } @media screen and (max-width:475px) { display: flex !important; - width: 90%; + width: 85%; } } .mobile-survey-link { From ecce75fc00a7bc3efd67c952179b102f96bff2a5 Mon Sep 17 00:00:00 2001 From: Afzal84 Date: Thu, 8 Aug 2024 20:40:48 +0530 Subject: [PATCH 5/7] Fixed:- lint error --- .../component/app-survey/survey-form/survey-form.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/component/app-survey/survey-form/survey-form.component.ts b/src/app/component/app-survey/survey-form/survey-form.component.ts index 1fb033007..7328e1e73 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.ts +++ b/src/app/component/app-survey/survey-form/survey-form.component.ts @@ -10,7 +10,7 @@ import { ConfigurationsService } from '@sunbird-cb/utils-v2' export class SurveyFormComponent implements OnInit { surveyPopupData: any surveyPopup: any - IsSurveyPopup = true + isSurveyPopup = true widgetData: any userRead: any isTourDone: any @@ -43,7 +43,7 @@ export class SurveyFormComponent implements OnInit { } closeCard() { - this.IsSurveyPopup = false + this.isSurveyPopup = false if (this.localStorageFlag) { localStorage.setItem('surveyPopup', 'false') this.localStorageFlag = false From 7d4973ccbaabce2089bd86de9c1215d777da5adb Mon Sep 17 00:00:00 2001 From: Afzal84 Date: Thu, 8 Aug 2024 21:35:02 +0530 Subject: [PATCH 6/7] Fixed:- optional check implemented in surveyPopup --- .../component/app-survey/survey-form/survey-form.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/component/app-survey/survey-form/survey-form.component.html b/src/app/component/app-survey/survey-form/survey-form.component.html index 9a94e95ba..65eddef2b 100644 --- a/src/app/component/app-survey/survey-form/survey-form.component.html +++ b/src/app/component/app-survey/survey-form/survey-form.component.html @@ -1,4 +1,4 @@ -