diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css index 78fd0e5..3ef1d97 100644 --- a/src/app/home/home.component.css +++ b/src/app/home/home.component.css @@ -163,46 +163,62 @@ width: 100%; } -.stakeholder-section ul { +.stakeholder-section .tabs > ul { list-style: none; display: flex; - flex-wrap: wrap; + flex-wrap: nowrap; margin-bottom: 0; font-size: 16px; + overflow-x: auto; } -.stakeholder-section ul li { +.stakeholder-section .tabs > ul > li { display: inline-block; color: #707070; padding: 5px 15px; cursor: pointer; - margin-left: 25px; user-select: none; + white-space: nowrap; + margin-left: 25px; } -.stakeholder-section ul li:hover { +.stakeholder-section .tabs > ul > li:hover { color: #1a1a1a; } -.stakeholder-section ul li.uk-active { - color: #1a1a1a; - border: #E3E3E3 solid 1px; - border-bottom: #F9F9F9 solid 1px;; -} - .stakeholder-section .stakeholders { - border-top: #E3E3E3 solid 1px; - margin-top: -1px; padding-top: 20px; min-height: 300px; } +@media (max-width: 639px) { + + .stakeholder-section .tabs > ul > li:nth-child(1) { + margin-left: 0; + } + + .stakeholder-section .tabs > ul > li.uk-active { + color: #1a1a1a; + border-bottom: var(--portal-main-color) solid 2px; + } + + .stakeholders.uk-grid-small > * { + padding-left: 2px; + } + + .stakeholders.uk-grid-small > .uk-grid-margin { + margin-top: 2px; + } +} + + .stakeholder-section .stakeholders .header { background-color: #00a0de; position: relative; + height: 150px; } -.stakeholder-section .stakeholders .header img{ +.stakeholder-section .stakeholders .header > img { max-width: 50%; max-height: 50%; position: absolute; @@ -211,6 +227,20 @@ transform: translate(-50%, -50%); } +.stakeholder-section .stakeholders .header > div { + width: 100%; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + text-align: center; +} + +.stakeholder-section .stakeholders .header > div > img { + max-width: 50%; + max-height: 50%; +} + .stakeholder-section .stakeholders .header.small { height: 150px; } @@ -222,3 +252,17 @@ .stakeholder-section .stakeholders .header.large { height: 300px; } + +@media (min-width: 640px) { + + .stakeholder-section .tabs > ul > li.uk-active { + color: #1a1a1a; + border: #E3E3E3 solid 1px; + border-bottom: #F9F9F9 solid 1px; + } + + .stakeholder-section .stakeholders { + border-top: #E3E3E3 solid 1px; + margin-top: -1px; + } +} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 6598de7..78e794e 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -53,7 +53,8 @@ -
+
@@ -128,25 +129,77 @@
-
+ +
+
-
+
    -
  • All
  • -
  • Funders
  • -
  • Research Initiatives
  • - -
  • Organizations
  • +
  • All
  • +
  • Funders
  • +
  • Research Initiatives
  • + +
  • Organizations
+
+ Nothing here yet. +
+
+
+
+
+
    +
  • All
  • +
  • Funders
  • +
  • Research Initiatives
  • + +
  • Organizations
  • +
+
+
@@ -172,3 +225,8 @@
+ +
+ You will be navigated to a new tab. Are you sure that you want to proceed? +
+
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index efc9183..f6a8f29 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -14,8 +14,9 @@ import {NumberUtils} from "../openaireLibrary/utils/number-utils.class"; import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service"; import {animate, state, style, transition, trigger} from "@angular/animations"; import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service"; -import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder"; import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; +import {LocalStorageService} from "../openaireLibrary/services/localStorage.service"; +import {Stakeholder, StakeholderInfo} from "../openaireLibrary/monitor/entities/stakeholder"; @Component({ selector: 'home', @@ -93,6 +94,7 @@ export class HomeComponent { public pageTitle = "OpenAIRE | Monitor"; public stakeholders: any[] = []; + public selected: Stakeholder = null; public pageContents = null; public divContents = null; // Message variables @@ -104,7 +106,7 @@ export class HomeComponent { properties: EnvProperties; public keyword: string = ""; - public type: string = "all"; + public type: string = null; public publicationsSize: any = null; public datasetsSize: any = null; @@ -117,6 +119,8 @@ export class HomeComponent { public observer: IntersectionObserver; public captains: boolean = false; @ViewChild('ref') ref: ElementRef; + @ViewChild('AlertModal') modal; + private directLink: boolean = true; constructor( private route: ActivatedRoute, @@ -125,6 +129,7 @@ export class HomeComponent { private _title: Title, private _piwikService: PiwikService, private _stakeholderService: StakeholderService, + private localStorageService: LocalStorageService, private helper: HelperService, private seoService: SEOService, private _refineFieldResultsService: RefineFieldResultsService, private _searchResearchResultsService: SearchResearchResultsService) { @@ -158,6 +163,9 @@ export class HomeComponent { // this.createGifs(); //this.getDivContents(); this.getPageContents(); + this.localStorageService.get().subscribe(value => { + this.directLink = value; + }) }); this.initAnimations(); this.startCaptainsAnimation(); @@ -176,7 +184,7 @@ export class HomeComponent { this.clearTimeouts(); this.state = state; this.timeouts.push(setTimeout(() => { - if(this.state < 3) { + if (this.state < 3) { this.startCaptainsAnimation(this.state + 1); } else { this.startCaptainsAnimation(); @@ -202,6 +210,15 @@ export class HomeComponent { }) } + public get stakeholdersNumber(): number { + if(this.type === null) { + return this.stakeholders.length; + } else { + console.log(this.stakeholders.filter(stakeholder => stakeholder.type === this.type).length); + return this.stakeholders.filter(stakeholder => stakeholder.type === this.type).length; + } + } + getNumbers() { this.numberSubs.push(this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"], "project", this.properties).subscribe( data => { @@ -303,16 +320,41 @@ export class HomeComponent { private setSizeOfStakeholder(index) { let mod = index % 9; - if(mod === 0 || mod === 4 || mod === 8) { + if (mod === 0 || mod === 4 || mod === 8) { this.stakeholders[index].size = 'large'; console.log(this.stakeholders[index]); - } else if(mod === 1 || mod === 5 || mod === 6) { + } else if (mod === 1 || mod === 5 || mod === 6) { this.stakeholders[index].size = 'small'; } else { this.stakeholders[index].size = 'medium'; } } + public confirmModalOpen(result: Stakeholder) { + this.selected = result; + this.modal.cancelButton = true; + this.modal.okButton = true; + this.modal.alertTitle = 'You are going to visit ' + result.name + ' Monitor Dashboard'; + this.modal.alertMessage = false; + this.modal.okButtonLeft = false; + this.modal.okButtonText = 'Yes'; + this.modal.cancelButtonText = 'No'; + this.modal.choice = true; + this.modal.open(); + } + + public getStakeholderPageUrl(stakeholder: Stakeholder) { + return this.properties.baseLink + '/dashboard/' + stakeholder.alias; + } + + public goToPage(data: any) { + if (data.value == true) { + let url = this.getStakeholderPageUrl(this.selected); + this.localStorageService.setCommunityDirectLink(data.choice); + window.open(url, '_blank'); + } + } + public quote(param: string): string { return StringUtils.quote(param); } @@ -322,7 +364,6 @@ export class HomeComponent { this.piwiksub.unsubscribe(); } this.clearTimeouts(); - this.observer.disconnect(); } private handleError(message: string, error): number { diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 5fc2987..de3fd51 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -17,12 +17,13 @@ import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOServi import {HomeRoutingModule} from "./home-routing.module"; import {RefineFieldResultsServiceModule} from "../openaireLibrary/services/refineFieldResultsService.module"; import {SearchResearchResultsServiceModule} from "../openaireLibrary/services/searchResearchResultsService.module"; +import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ErrorMessagesModule, OtherPortalsModule, HelperModule, Schema2jsonldModule, SEOServiceModule, HomeRoutingModule, SearchResearchResultsServiceModule, - RefineFieldResultsServiceModule + RefineFieldResultsServiceModule, AlertModalModule ], declarations: [ HomeComponent