diff --git a/client/src/common/services/companies.service.js b/client/src/common/services/companies.service.js index 196589e..3fc7dee 100644 --- a/client/src/common/services/companies.service.js +++ b/client/src/common/services/companies.service.js @@ -1,28 +1,83 @@ -import { Observable } from '@reactivex/rxjs'; -import { API_COMPANIES_PATH } from 'client/src/common/api/constants'; -import { FETCH_COMPANIES, FETCH_COMPANY } from './constants'; -import { Company } from 'client/src/common/models/company.model'; - -export class CompaniesService { - static $inject = [ - 'APIService', - '$ngRedux' - ]; - - constructor(api, $ngRedux) { - this.api = api; - this.$ngRedux = $ngRedux; - } - - fetchCompanies() { - Observable.fromPromise(this.api.fetch(API_COMPANIES_PATH)) - .map(payload => ({ type: FETCH_COMPANIES, payload })) - .subscribe(action => this.$ngRedux.dispatch(action)); - } - - fetchCompany(id) { - Observable.fromPromise(this.api.fetch(API_COMPANIES_PATH + '/' + id)) - .map(payload => ({ type: FETCH_COMPANY, payload })) - .subscribe(action => this.$ngRedux.dispatch(action)); - } -} \ No newline at end of file +import { + ajax +} +from 'rxjs/Rx'; + +import { + API_BASE_URL, + API_COMPANIES_PATH +} +from 'client/src/common/api/constants'; + +import { + FETCH_COMPANIES, + FETCH_COMPANIES_FULFILLED, + FETCH_COMPANY, + FETCH_COMPANY_FULFILLED +} +from './constants'; + +// import { Company } from 'client/src/common/models/company.model'; + +// Action Creators +const fetchCompanies = payload => ({ + type: FETCH_COMPANIES, + payload +}); +const fetchCompaniesFullfilled = payload => ({ + type: FETCH_COMPANIES_FULLFILLED, + payload +}); + +const fetchCompany = company_id => ({ + type: FETCH_COMPANY, + payload: company_id +}); +const fetchCompanyFullfilled = payload => ({ + type: FETCH_COMPANY_FULLFILLED, + payload +}); + +// Epics +export function fetchCompaniesEpic (action$) { + return action$ + .ofType(FETCH_COMPANIES) + .mergeMap(action => + ajax.getJSON(`${API_BASE_URL}${API_COMPANIES_PATH}`) + .map(fetchCompaniesFullfilled) + ); +} + +export function fetchCompanyEpic (action$) { + return action$ + .ofType(FETCH_COMPANY) + .mergeMap(action => + ajax.getJSON(`${API_BASE_URL}${API_COMPANIES_PATH}/${action.payload}`) + .map(fetchCompanyFullfilled) + ); +} + +// export class CompaniesService { +// static $inject = [ +// 'APIService', +// '$ngRedux' +// ]; + +// constructor(api, $ngRedux) { +// this.api = api; +// this.$ngRedux = $ngRedux; +// } + +// fetchCompanies() { +// // Observable.fromPromise(this.api.fetch(API_COMPANIES_PATH)) +// // .filter(r => r.name === "Axial") +// // .map(payload => ({ type: FETCH_COMPANIES, payload })) +// // .subscribe(action => this.$ngRedux.dispatch(action)); +// } + +// fetchCompany(id) { +// // Observable.fromPromise(this.api.fetch(API_COMPANIES_PATH + '/' + id)) +// // .map(payload => ({ type: FETCH_COMPANY, payload })) +// // .subscribe(action => this.$ngRedux.dispatch(action)); +// } +// } \ No newline at end of file diff --git a/client/src/common/services/constants.js b/client/src/common/services/constants.js index 422e220..981442d 100644 --- a/client/src/common/services/constants.js +++ b/client/src/common/services/constants.js @@ -1,6 +1,9 @@ // Companies export const FETCH_COMPANIES = 'FETCH_COMPANIES'; +export const FETCH_COMPANIES_FULFILLED = 'FETCH_COMPANIES_FULFILLED'; + export const FETCH_COMPANY = 'FETCH_COMPANY'; +export const FETCH_COMPANY_FULFILLED = 'FETCH_COMPANY_FULFILLED'; // Members export const FETCH_MEMBERS = 'FETCH_MEMBERS'; diff --git a/client/src/common/services/rootEpic.js b/client/src/common/services/rootEpic.js new file mode 100644 index 0000000..e2cc589 --- /dev/null +++ b/client/src/common/services/rootEpic.js @@ -0,0 +1,13 @@ +/** + * Combine all epics in this file and export the combined epic. + */ + +import { combineEpics } from 'redux-observable'; + +// our custom data reducer for the data points +import { fetchCompaniesEpic, fetchCompanyEpic } from './companies.service'; + +export default combineEpics( + fetchCompaniesEpic, + fetchCompanyEpic +); \ No newline at end of file diff --git a/client/src/components/companies/companies.component.js b/client/src/components/companies/companies.component.js index 8d9aa93..bc58c32 100644 --- a/client/src/components/companies/companies.component.js +++ b/client/src/components/companies/companies.component.js @@ -1,4 +1,3 @@ -import { Observable } from '@reactivex/rxjs'; import { Component } from 'client/src/utils'; import template from './companies.html'; @@ -13,38 +12,35 @@ import './companies.scss'; export class CompaniesComponent { static $inject = [ - '$ngRedux', - 'CompaniesService' + '$ngRedux' ]; - constructor($ngRedux, CompaniesService) { + constructor($ngRedux) { this.$ngRedux = $ngRedux; - this.companiesService = CompaniesService; - this.list = Observable.from([]); - this.currentCompany = Observable.of({}); + // this.companiesService = CompaniesService; } $onInit() { // Connect to the store - this.disconnect = this.$ngRedux.connect(state => ({ - companies: state.companies, - currentCompany: state.currentCompany - }))((state, actions) => { - this.actions = actions; - this.list = state.companies; - this.currentCompany = state.currentCompany; - }); + // this.disconnect = this.$ngRedux.connect(state => ({ + // companies: state.companies, + // currentCompany: state.currentCompany + // }))((state, actions) => { + // this.actions = actions; + // this.list = state.companies; + // this.currentCompany = state.currentCompany; + // }); // Fetch Companies - this.companies = this.companiesService.fetchCompanies(); + // this.companies = this.companiesService.fetchCompanies(); } $onDestroy() { // Disconnect from the store - this.disconnect(); + // this.disconnect(); } onCompanySelected(company) { - this.companiesService.fetchCompany(company.id); + // this.companiesService.fetchCompany(company.id); } } \ No newline at end of file diff --git a/client/src/components/styles/index.js b/client/src/components/styles/index.js new file mode 100644 index 0000000..3ac08b8 --- /dev/null +++ b/client/src/components/styles/index.js @@ -0,0 +1 @@ +export * from './styles.component'; \ No newline at end of file diff --git a/client/src/components/styles/styles.component.js b/client/src/components/styles/styles.component.js new file mode 100644 index 0000000..41d5dfb --- /dev/null +++ b/client/src/components/styles/styles.component.js @@ -0,0 +1,12 @@ +import { Component } from 'client/src/utils'; + +import template from './styles.html'; + +import './styles.scss'; + +@Component({ + template, + controllerAs: 'stylesCtrl' +}) + +export class StylesComponent {} diff --git a/client/src/components/styles/styles.html b/client/src/components/styles/styles.html new file mode 100644 index 0000000..fa18e45 --- /dev/null +++ b/client/src/components/styles/styles.html @@ -0,0 +1,428 @@ +
+
+ Paragraph Small: Opens Sans Regular 11px FS/ 16px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ ++ Paragraph Small: Opens Sans Regular 13px FS/ 18px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ ++ Paragraph Normal: Opens Sans Regular 14px FS/ 21px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ ++ Paragraph Large: Opens Sans Regular 16px FS/ 24px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ ++ Paragraph Large: Opens Sans Regular 16px FS/ 24px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ + ++ Paragraph Normal: Opens Sans Regular 14px FS/ 21px LH/ .2 LS / bottom-padding:8px; + Eg., Bacon ipsum dolor amet fugiat tri-tip magna meatball est aute. Culpa sausage magna tenderloin ham, do meatloaf veniam meatball frankfurter kielbasa. +
+ ++ Help text - Paragraph Small: Opens Sans Regular 13px FS/ 18px LH/ .2 LS / #828282 +
+ ++ Help text - Paragraph X Small: Opens Sans Regular 11px FS/ 16px LH/ .2 LS / #828282 +
+ ++ I'm the Header of the table + | + +|
---|---|
+ I'm trapped in this table cell + | ++ I'm trapped in this table cell + | +
+ Bacon ipsum dolor amet kevin pancetta tri-tip corned beef capicola rump tenderloin. Shoulder porchetta corned beef swine, alcatra landjaeger brisket meatloaf tongue bacon meatball picanha pork ball tip prosciutto. Chicken pancetta burgdoggen, pork chop salami corned beef turducken shank cow picanha. Pastrami kielbasa shank meatball rump drumstick sausage ham hock shankle tri-tip spare ribs brisket venison ribeye. Turkey cow brisket chicken tail chuck ribeye andouille shankle. Venison short ribs short loin, beef cupim corned beef pastrami brisket ham hock. +
++ Chuck shank andouille ball tip drumstick pancetta, leberkas porchetta ham hock brisket turkey. Rump pig sirloin beef ribs porchetta bresaola, meatloaf short loin kevin turkey swine ground round burgdoggen. Picanha prosciutto corned beef rump sausage pork belly. Short loin filet mignon boudin ribeye, meatball pork chop tail pork loin beef ribs porchetta. Drumstick prosciutto kevin chuck landjaeger. +
+Hey Hey Hey! Imma growler! BLAHRRRRRG!
+
+ We're no strangers to love. + You know the rules and so do I. + A full commitment's what I'm thinking of + You wouldn't get this from any other guy. +
+ ++ I just want to tell you how I'm feeling + Gotta make you understand +
+ ++ Never gonna give you up, never gonna let you down + Never gonna run around and desert you + Never gonna make you cry, never gonna say goodbye + Never gonna tell a lie and hurt you +
+ ++ We've known each other for so long + Your heart's been aching but you're too shy to say it + Inside we both know what's been going on + We know the game and we're gonna play it + And if you ask me how I'm feeling + Don't tell me you're too blind to see +
+ + +