8000 Added Landing page by gopalshimpi · Pull Request #94 · aviabird/angularspree · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added Landing page #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"immutable": "^3.8.1",
"ng2-ui-auth": "^8.0.1",
"ngx-bootstrap": "^2.0.4",
"ngx-drag-scroll": "^1.7.7",
"reselect": "^2.5.4",
"rxjs": "^5.5.6",
"zone.js": "^0.8.14"
Expand Down
9 changes: 6 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { myAuthConfig } from './oauth_config';
import { Ng2UiAuthModule} from 'ng2-ui-auth';
import { Ng2UiAuthModule } from 'ng2-ui-auth';
import { EffectsModule } from '@ngrx/effects';
import { environment } from './../environments/environment';
import { BrowserModule } from '@angular/platform-browser';
Expand All @@ -23,6 +23,7 @@ import { StoreModule } from '@ngrx/store';
import { reducers, metaReducers } from './app.reducers';
import { CheckoutHeaderComponent } from './layout/checkout-header/checkout-header.component';
import { CheckoutFooterComponent } from './layout/checkout-footer/checkout-footer.component';
import { DragScrollModule } from 'ngx-drag-scroll';

// adding rx operators
import 'rxjs/add/operator/map';
Expand All @@ -37,7 +38,8 @@ import 'rxjs/add/observable/of';
declarations: [
AppComponent,
CheckoutHeaderComponent,
CheckoutFooterComponent
CheckoutFooterComponent,

],
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }),
Expand Down Expand Up @@ -71,7 +73,8 @@ import 'rxjs/add/observable/of';
LayoutModule,
CoreModule,
SharedModule,
Ng2UiAuthModule.forRoot(myAuthConfig)
Ng2UiAuthModule.forRoot(myAuthConfig),
DragScrollModule

],
providers: [],
Expand Down
5 changes: 4 additions & 1 deletion src/app/home/home.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LandingComponent } from './landing/landing.component';
import { HomeComponent } from './home.component';

export const HomeRoutes = [
{ path: '', component: HomeComponent },

{ path: '', component: LandingComponent },
{ path: 'products', component: HomeComponent}
];
27 changes: 25 additions & 2 deletions src/app/home/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { LpPromoComponent } from './landing/lp-promo/lp-promo.component';
import { PlFavItemComponent } from './landing/lp-favorites/pl-fav-item/pl-fav-item.component';
import { PlItemComponent } from './landing/lp-product-list/pl-item/pl-item.component';
import { LpVideosComponent } from './landing/lp-videos/lp-videos.component';
import { LpBrandsComponent } from './landing/lp-brands/lp-brands.component';
import { LpFavoritesComponent } from './landing/lp-favorites/lp-favorites.component';
import { LpProductListComponent } from './landing/lp-product-list/lp-product-list.component';
import { LpBannerComponent } from './landing/lp-banner/lp-banner.component';
import { LandingComponent } from './landing/landing.component';
import { ProductEffects } from './../product/effects/product.effects';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
Expand All @@ -6,6 +15,8 @@ import { NgModule } from '@angular/core';
import { ProductActions } from './../product/actions/product-actions';
import { SearchActions } from './reducers/search.actions';
import { SharedModule } from './../shared/index';
import { CarouselModule } from 'ngx-bootstrap';


// Components
import { HomeComponent } from './home.component';
Expand All @@ -27,7 +38,7 @@ import { HomeRoutes as routes } from './home.routes';

import { FilterPipe } from './content/product-list/product-filter.pipe';
import { reducers } from "./reducers/index";

import { DragScrollModule } from 'ngx-drag-scroll';
@NgModule({
declarations: [
// components
Expand All @@ -41,13 +52,25 @@ import { reducers } from "./reducers/index";
CustomizeComponent,
FilterSummaryComponent,
ContentComponent,
LandingComponent,
LpBannerComponent,
LpProductListComponent,
LpFavoritesComponent,
LpBrandsComponent,
LpVideosComponent,
PlItemComponent,
PlFavItemComponent,
LpPromoComponent,

// pipes
FilterPipe,
FilterPipe
],
exports: [
],
imports: [
RouterModule.forChild(routes),
CarouselModule,
DragScrollModule,

/**
* StoreModule.forFeature is used for composing state
Expand Down
11 changes: 11 additions & 0 deletions src/app/home/landing/landing.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<app-lp-banner>Loading...</app-lp-banner>
<br>
<app-lp-product-list [products]="products$ | async"> </app-lp-product-list>
<hr>
<app-lp-favorites [products]="products$ | async"></app-lp-favorites>
<hr>
<app-lp-promo> </app-lp-promo>
<hr>
<app-lp-brands [products]="products$ | async"></app-lp-brands>
<hr>
<app-lp-videos></app-lp-videos>
Empty file.
25 changes: 25 additions & 0 deletions src/app/home/landing/landing.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LandingComponent } from './landing.component';

describe('LandingComponent', () => {
let component: LandingComponent;
let fixture: ComponentFixture<LandingComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LandingComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LandingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
31 changes: 31 additions & 0 deletions src/app/home/landing/landing.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { LpPromoComponent } from './lp-promo/lp-promo.component';
import { LpVideosComponent } from './lp-videos/lp-videos.component';
import { LpBrandsComponent } from './lp-brands/lp-brands.component';
import { LpFavoritesComponent } from './lp-favorites/lp-favorites.component';
import { LpProductListComponent } from './lp-product-list/lp-product-list.component';
import { Observable } from 'rxjs/Observable';
import { getProducts, getTaxonomies } from './../../product/reducers/selectors';
import { ProductActions } from './../../product/actions/product-actions';
import { Store } from '@ngrx/store';
import { AppState } from './../../interfaces';
import { Product } from './../../core/models/product';
import { Component, OnInit, ViewChild, Input } from '@angular/core';
import { DragScrollDirective } from 'ngx-drag-scroll';

@Component({
selector: 'app-landing',
templateUrl: './landing.component.html',
styleUrls: ['./landing.component.scss']
})
export class LandingComponent implements OnInit {
products$: Observable<any>;

constructor(private store: Store<AppState>, private actions: ProductActions) {
this.store.dispatch(this.actions.getAllProducts());
this.products$ = this.store.select(getProducts);
}

ngOnInit() {

}
}
9 changes: 9 additions & 0 deletions src/app/home/landing/lp-banner/lp-banner.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<section class="row">
<carousel>
<slide *ngFor="let banner of banners">
<a href="{{banner.link_url}}">
<img src={{banner.image_link}} alt="" style="display: block; width: 100%;">
</a>
</slide>
</carousel>
</section>
Empty file.
25 changes: 25 additions & 0 deletions src/app/home/landing/lp-banner/lp-banner.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LpBannerComponent } from './lp-banner.component';

describe('LpBannerComponent', () => {
let component: LpBannerComponent;
let fixture: ComponentFixture<LpBannerComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LpBannerComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LpBannerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
16 changes: 16 additions & 0 deletions src/app/home/landing/lp-banner/lp-banner.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { APP_DATA } from './../../../shared/data/app-data';
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-lp-banner',
templateUrl: './lp-banner.component.html',
styleUrls: ['./lp-banner.component.scss']
})
export class LpBannerComponent implements OnInit {
banners = APP_DATA.landing_page_banner;
constructor() { }

ngOnInit() {
}

}
13 changes: 13 additions & 0 deletions src/app/home/landing/lp-brands/lp-brands.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h3>
<a href=#>Top Brands</a>
<p *ngIf="products.length === 0">No Products found for this category</p>
</h3>
<div class="row">
<div class="col-md-2" *ngFor="let product of products | slice:0:12">
<div class="card">
<a [routerLink]="['/product/', product.slug]">
<img class="card-img-top" [src]="getProductImageUrl(product.master.images[0]?.large_url)" width="150px" height="150px">
</a>
</div>
</div>
</div>
Empty file.
25 changes: 25 additions & 0 deletions src/app/home/landing/lp-brands/lp-brands.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LpBrandsComponent } from './lp-brands.component';

describe('LpBrandsComponent', () => {
let component: LpBrandsComponent;
let fixture: ComponentFixture<LpBrandsComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LpBrandsComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LpBrandsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
20 changes: 20 additions & 0 deletions src/app/home/landing/lp-brands/lp-brands.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { environment } from './../../../../environments/environment';
import { Component, OnInit, Input } from '@angular/core';

@Component({
selector: 'app-lp-brands',
templateUrl: './lp-brands.component.html',
styleUrls: ['./lp-brands.component.scss']
})
export class LpBrandsComponent implements OnInit {
@Input() products;
constructor() { }

ngOnInit() {
}

getProductImageUrl(url) {
return environment.apiEndpoint + url;
}

}
15 changes: 15 additions & 0 deletions src/app/home/landing/lp-favorites/lp-favorites.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="content">
<div class="row">
<h3>
<a href=#>Customer Favorites</a>
<p *ngIf="products.length === 0">No Products found for this category</p>
</h3>
<button button color="primary " (click)="moveLeft() ">left</button>
<button button color="primary " (click)="moveRight() ">right</button>
</div>
<div class="row" dragScroll drag-scroll-y-disabled="true" #nav>
<div class="col-md-3" *ngFor="let product of products | slice:0:10">
<app-pl-fav-item [product]="product"></app-pl-fav-item>
</div>
</div>
</div>
Empty file.
25 changes: 25 additions & 0 deletions src/app/home/landing/lp-favorites/lp-favorites.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LpFavoritesComponent } from './lp-favorites.component';

describe('LpFavoritesComponent', () => {
let component: LpFavoritesComponent;
let fixture: ComponentFixture<LpFavoritesComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LpFavoritesComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LpFavoritesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/home/landing/lp-favorites/lp-favorites.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { DragScrollDirective } from 'ngx-drag-scroll';
import { environment } from './../../../../environments/environment';
import { Component, OnInit, Input, ViewChild } from '@angular/core';

@Component({
selector: 'app-lp-favorites',
templateUrl: './lp-favorites.component.html',
styleUrls: ['./lp-favorites.component.scss']
})
export class LpFavoritesComponent implements OnInit {
@Input() products;
constructor() { }

ngOnInit() {
}
getProductImageUrl(url) {
return environment.apiEndpoint + url;
}
@ViewChild('nav', { read: DragScrollDirective }) ds: DragScrollDirective;

moveLeft() {
this.ds.moveLeft();
}

moveRight() {
this.ds.moveRight();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="product-tile">
<a [routerLink]="['/product/', product.slug]">
<img [src]="getProductImageUrl(product.master.images[0]?.large_url)" width="150px" height="150px">
<p> {{ product.name }} </p>
</a>
</div>
Empty file.
Loading
0