-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2404 from sunbird-cb/new-survey-popup-enhnc
New survey popup feature
- Loading branch information
Showing
7 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/app/component/app-survey/survey-form/survey-form.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="main-survey flex items-center justify-center" *ngIf="surveyPopup?.active && isTourDone && localStorageFlag"> | ||
<div class="surver-inner"> | ||
<a mat-icon-button class="close-button flex" (click)="closeCard()"> | ||
<mat-icon>close</mat-icon> | ||
</a> | ||
<a class="survey-img-link desktop-img" href={{surveyPopup?.surveyUrl}}> | ||
<!-- <img class="survey-img" src={{surveyPopupData.l}} /> --> | ||
<img i18n-alt alt="Page Banner" [src]="surveyPopup?.banners" | ||
wsUtilsImageResponsive class="banner-image-solo" /> | ||
</a> | ||
|
||
<div class="mobile-img-box flex flex-col items-center justify-center"> | ||
<img i18n-alt alt="Page Banner" [src]="surveyPopup?.banners" | ||
wsUtilsImageResponsive class="mobile-banner-image-solo" /> | ||
<a class="mobile-survey-link" href={{surveyPopup?.surveyUrl}}>{{surveyPopup?.buttonName}} </a> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> |
87 changes: 87 additions & 0 deletions
87
src/app/component/app-survey/survey-form/survey-form.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
.main-survey { | ||
background-color: rgba(0, 0, 0, 0.4); | ||
height: 100vh; | ||
width: 100%; | ||
z-index: 9999; | ||
position: fixed; | ||
top: 0px; | ||
bottom: 0px; | ||
left: 0px; | ||
right: 0px; | ||
margin: 0px; | ||
padding: 0; | ||
overflow: hidden; | ||
} | ||
|
||
.survey-img-link { | ||
cursor: pointer; | ||
width: 80%; | ||
margin: auto; | ||
} | ||
.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; | ||
margin:auto; | ||
@media (min-width: 476px) and (max-width: 768px) { | ||
display: flex !important; | ||
width: 45%; | ||
} | ||
@media screen and (max-width:475px) { | ||
display: flex !important; | ||
width: 85%; | ||
} | ||
} | ||
.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 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; | ||
} | ||
|
||
|
||
|
25 changes: 25 additions & 0 deletions
25
src/app/component/app-survey/survey-form/survey-form.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SurveyFormComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ SurveyFormComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(SurveyFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
52 changes: 52 additions & 0 deletions
52
src/app/component/app-survey/survey-form/survey-form.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters