From 7bc17d0b19328254244731c11e8562d45c1720f5 Mon Sep 17 00:00:00 2001 From: Lucas Malta Date: Sun, 15 Apr 2018 18:40:43 -0300 Subject: [PATCH 1/3] configures come-add component in default theme --- src/app/app.module.ts | 3 ++- src/app/home/home.component.html | 2 ++ .../theme-come-add.component.ts | 21 +++++++++++++++++++ themes/theme-default/index.ts | 8 ++++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/app/hotspots/components/theme-come-add/theme-come-add.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 652ae79..a5a4923 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -69,7 +69,7 @@ import { ThemeFooterComponent } from './hotspots/components/theme-footer/theme-f import { ThemeHeaderComponent } from './hotspots/components/theme-header/theme-header.component'; import { ThemeTopHeaderComponent } from './hotspots/components/theme-top-header/theme-top-header.component'; import { ThemeMenuComponent } from './hotspots/components/theme-menu/theme-menu.component'; - +import { ThemeComeAddComponent } from './hotspots/components/theme-come-add/theme-come-add.component'; // Gamification Tour components import { TourInterceptor } from './gamification/shared/tour.interceptor'; @@ -138,6 +138,7 @@ export function HttpLoaderFactory(http: HttpClient) { ThemeMenuComponent, HomeComponent, HowItWorksComponent, + ThemeComeAddComponent, theme.hotspots ], imports: [ diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index dd3a6a5..184804a 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -10,3 +10,5 @@

{{ pageSubtitle }}

+ + diff --git a/src/app/hotspots/components/theme-come-add/theme-come-add.component.ts b/src/app/hotspots/components/theme-come-add/theme-come-add.component.ts new file mode 100644 index 0000000..7d171c1 --- /dev/null +++ b/src/app/hotspots/components/theme-come-add/theme-come-add.component.ts @@ -0,0 +1,21 @@ +import { Component, ComponentFactoryResolver, ViewContainerRef } from '@angular/core'; +import { PluginHotspot } from '../../plugin-hotspot'; + +@Component({ + selector: 'app-theme-come-add', + template: '' +}) +export class ThemeComeAddComponent extends PluginHotspot { + + constructor(private viewContainerRef: ViewContainerRef, private factory: ComponentFactoryResolver, ) { + super('theme_come_add'); + } + + addHotspot(component: any) { + const compFactory = this.factory.resolveComponentFactory(component); + this.viewContainerRef.clear(); + const componentRef = this.viewContainerRef.createComponent(compFactory); + componentRef.changeDetectorRef.detectChanges(); + } + +} diff --git a/themes/theme-default/index.ts b/themes/theme-default/index.ts index 60889b7..5d4f0f1 100644 --- a/themes/theme-default/index.ts +++ b/themes/theme-default/index.ts @@ -1,7 +1,13 @@ import { HeaderComponent } from './header/header.component'; import { TopHeaderComponent } from './top-header/top-header.component'; import { FooterComponent } from './footer/footer.component'; +import { ComeAddComponent } from './come-add/come-add.component'; export let name = 'default'; export let components: any = []; -export let hotspots: any = [ HeaderComponent, TopHeaderComponent, FooterComponent ]; +export let hotspots: any = [ + HeaderComponent, + TopHeaderComponent, + FooterComponent, + ComeAddComponent + ]; From 57b1204d3dd9444d97b0e4fbdec0ae28d56d1db0 Mon Sep 17 00:00:00 2001 From: Lucas Malta Date: Sun, 15 Apr 2018 18:41:21 -0300 Subject: [PATCH 2/3] creates come-add component --- .../come-add/come-add.component.html | 11 ++++ .../come-add/come-add.component.scss | 52 +++++++++++++++++++ .../come-add/come-add.component.spec.ts | 0 .../come-add/come-add.component.ts | 15 ++++++ 4 files changed, 78 insertions(+) create mode 100644 themes/theme-default/come-add/come-add.component.html create mode 100644 themes/theme-default/come-add/come-add.component.scss create mode 100644 themes/theme-default/come-add/come-add.component.spec.ts create mode 100644 themes/theme-default/come-add/come-add.component.ts diff --git a/themes/theme-default/come-add/come-add.component.html b/themes/theme-default/come-add/come-add.component.html new file mode 100644 index 0000000..e51b818 --- /dev/null +++ b/themes/theme-default/come-add/come-add.component.html @@ -0,0 +1,11 @@ +
+
+

VENHA SOMAR SUAS OPINIÕES À NOSSA REDE!

+

Quanto mais opiniões, mais ricas serão nossas discussões

+
+
+ +
+
\ No newline at end of file diff --git a/themes/theme-default/come-add/come-add.component.scss b/themes/theme-default/come-add/come-add.component.scss new file mode 100644 index 0000000..6aaf07d --- /dev/null +++ b/themes/theme-default/come-add/come-add.component.scss @@ -0,0 +1,52 @@ +@import '../../../node_modules/bootstrap/scss/bootstrap'; +.main-content { + display: flex; + min-height: 300px; + background-color: #EDEDEE; + text-align: center; + align-items: center; + margin: 0 auto 0 auto; + justify-content: space-between; + width: 85vw; + @media screen and (max-width: 900px) { + flex-direction: column; + } +} + +.left-content { + color: #757575; + text-align: left; + margin-left: 3vw; + .main-text { + font-size: 2em; + margin: 0; + } + .secondary-text { + margin: 0; + } + max-width: 40%; + @media screen and (max-width: 900px) { + text-align: center; + margin: 30px 0 30px 0; + max-width: 80%; + } +} + +.right-content { + margin-right: 3vw; + width: 100%; + .start-now-button { + background-color: #5F5F5F; + color: white; + border-radius: 3px; + width: 30vw; + height: 100px; + border: none; + } + @media screen and (max-width: 900px) { + margin: 0 0 50px 0; + .start-now-button { + width: 80%; + } + } +} \ No newline at end of file diff --git a/themes/theme-default/come-add/come-add.component.spec.ts b/themes/theme-default/come-add/come-add.component.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/themes/theme-default/come-add/come-add.component.ts b/themes/theme-default/come-add/come-add.component.ts new file mode 100644 index 0000000..0a309f3 --- /dev/null +++ b/themes/theme-default/come-add/come-add.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { Hotspot } from '../../../src/app/hotspots/hotspot.decorator'; + + +@Component({ + selector: 'app-come-add', + templateUrl: './come-add.component.html', + styleUrls: ['./come-add.component.scss'] +}) +@Hotspot('theme_come_add') +export class ComeAddComponent { + + constructor() {} + +} From 8be3762c8f2ce0eaaf61822b47eb54b5a33a0941 Mon Sep 17 00:00:00 2001 From: Lucas Malta Date: Sun, 15 Apr 2018 18:50:09 -0300 Subject: [PATCH 3/3] makes start now button work --- .../come-add/come-add.component.html | 4 +-- .../come-add/come-add.component.scss | 1 + .../come-add/come-add.component.ts | 27 ++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/themes/theme-default/come-add/come-add.component.html b/themes/theme-default/come-add/come-add.component.html index e51b818..8e6bded 100644 --- a/themes/theme-default/come-add/come-add.component.html +++ b/themes/theme-default/come-add/come-add.component.html @@ -1,10 +1,10 @@ -
+

VENHA SOMAR SUAS OPINIÕES À NOSSA REDE!

Quanto mais opiniões, mais ricas serão nossas discussões

-
diff --git a/themes/theme-default/come-add/come-add.component.scss b/themes/theme-default/come-add/come-add.component.scss index 6aaf07d..895637b 100644 --- a/themes/theme-default/come-add/come-add.component.scss +++ b/themes/theme-default/come-add/come-add.component.scss @@ -36,6 +36,7 @@ margin-right: 3vw; width: 100%; .start-now-button { + cursor: pointer; background-color: #5F5F5F; color: white; border-radius: 3px; diff --git a/themes/theme-default/come-add/come-add.component.ts b/themes/theme-default/come-add/come-add.component.ts index 0a309f3..057a6dd 100644 --- a/themes/theme-default/come-add/come-add.component.ts +++ b/themes/theme-default/come-add/come-add.component.ts @@ -1,5 +1,10 @@ import { Component } from '@angular/core'; import { Hotspot } from '../../../src/app/hotspots/hotspot.decorator'; +import { Profile } from '../../../src/app/models/profile'; +import { ProfileService } from '../../../src/app/services/profile.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { RegistrationComponent } from '../../../src/app/registration/registration.component'; +import * as _ from 'lodash'; @Component({ @@ -10,6 +15,26 @@ import { Hotspot } from '../../../src/app/hotspots/hotspot.decorator'; @Hotspot('theme_come_add') export class ComeAddComponent { - constructor() {} + profile: Profile; + constructor(private profileService: ProfileService, private modalService: NgbModal) { + this.profile = {}; + this.profile = Object.assign(this.profile, this.profileService.getProfile()); + this.profileService.profileChangeEvent.subscribe(profile => { + this.profile = profile; + }); + } + + isLogged() { + return (_.isObject(this.profile) && _.isNumber(this.profile.id)); + } + + openRegistration() { + const bsModalRef = this.modalService.open(RegistrationComponent); + bsModalRef.componentInstance.loggedIn.subscribe(() => { + this.profile = this.profileService.getProfile(); + this.profileService.profileChangeEvent.emit(this.profile); + window.location.reload(); + }); + } }