Skip to content
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

Example app #1

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b967206
feat(app): add new root component with assets
Hotell Feb 23, 2018
d21c055
feat(store): add ng-redux setup
Hotell Feb 23, 2018
060145d
feat(app,state): add router sync with store and refactor store
Hotell Feb 23, 2018
774bd4e
feat(products): add services
Hotell Feb 23, 2018
07a489e
feat(products): add stateles components
Hotell Feb 23, 2018
dffb4f6
feat(products): add guards
Hotell Feb 23, 2018
8f6f242
feat(products/store): add dux
Hotell Feb 23, 2018
7d4dae7
feat(products): add models
Hotell Feb 23, 2018
392b6d9
feat(products): add product-item
Hotell Feb 23, 2018
c3b2b03
feat(products): conncect products-component to store
Hotell Feb 23, 2018
d86dad3
feat(products): register entities to module
Hotell Feb 23, 2018
1580a7d
fix(store): resolve store non working drama !
Hotell Feb 23, 2018
4490e28
fix(routes): resolve router config feature module drama !
Hotell Feb 23, 2018
4e6ddee
fix(products): resolve selector correctly within product-item
Hotell Feb 23, 2018
8143729
feat(store): add router epics and register them
Hotell Feb 23, 2018
9cf7639
refactor(store): introduce epics module pattern
Hotell Feb 24, 2018
5254d33
feat(products): load pizzas via guard and epic
Hotell Feb 24, 2018
5b8fca0
feat(products/store): add other pizzas epic
Hotell Feb 24, 2018
2337d24
feat(products/store): add toppings epics and routes guards
Hotell Feb 24, 2018
f214845
feat(modules): add axios module for http
Hotell Feb 24, 2018
df8a639
refactor(products): replace httpClient with axios
Hotell Feb 24, 2018
7c881c4
style: make lines only 100 chars long
Hotell Feb 24, 2018
175c783
test: make test pass
Hotell Feb 24, 2018
0f639d7
fix: ts errors
Hotell Feb 25, 2018
0c337f3
chore: bump desp and make test run in watch mode
Hotell Feb 25, 2018
335935a
test(products): add component tests
Hotell Feb 25, 2018
f50de64
feat(products): add data-test attribute
Hotell Feb 26, 2018
712648f
e2e: add few scenarios
Hotell Feb 26, 2018
9afcc4b
feat(npm-scripts): update tasks
Hotell Feb 27, 2018
839cd39
refactor(package): rename project
Hotell Feb 27, 2018
e69b8cf
refactor(demo): move counter to demo module
Hotell Feb 27, 2018
18aefc0
feat(storybook): add module-metadata helpers and additional config
Hotell Feb 27, 2018
29d195a
feat(storybook): add pizza-itemm story
Hotell Feb 27, 2018
d385e0a
feat(modules/testing): add testbed config utility
Hotell Feb 28, 2018
ba666f3
refactor(test): use custom config for testBed to provide nicer snapshots
Hotell Feb 28, 2018
a940d31
chore: create jest snapshots issue file
Hotell Feb 28, 2018
8a8b664
ci(jest): add module mapping to @modules
Hotell Feb 28, 2018
a02d3f4
chore: bump to latest deps jest-ng prettier
Hotell Feb 28, 2018
83d01dd
chore(npm-scripts): use jest bail on verify
Hotell Mar 1, 2018
68a6d69
fix(app): exclude whole stories from app tsconfig
Hotell Mar 1, 2018
31989a5
fix(test): update jest issue test to reflect changes properly to snap…
Hotell Mar 2, 2018
9c38da0
feat(modules/testing): add possibility to override configureTest com…
Hotell Mar 2, 2018
f935903
test(demo/button): format test component template
Hotell Mar 4, 2018
40a75d4
fix(tslint): properly extends tslint with config prettier
Hotell Mar 5, 2018
df19591
feart(storybook): bump version and add addons type definitions
Hotell Mar 14, 2018
7b640cc
refactor(storybook): remove obsolete files
Hotell Mar 14, 2018
f782a91
chore: remove 3rd party example apps
Hotell Mar 14, 2018
debba7f
fix(storybook): add proper storysource webpack config
Hotell Mar 14, 2018
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
Prev Previous commit
Next Next commit
fix(products): resolve selector correctly within product-item
  • Loading branch information
Hotell committed Feb 23, 2018
commit 4e6ddee0d3bd91c8ee2ba843629dfcf78eae8d07
15 changes: 9 additions & 6 deletions src/app/products/product-item/product-item.component.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,8 @@ export class ProductItemComponent implements OnInit {
constructor(private store: NgRedux<fromStore.ProductsState>, private route: ActivatedRoute) {}

ngOnInit() {
// const getSelectedPizza = fromStore.getSelectedPizza(this.route.snapshot);
const { pizzaId } = this.route.snapshot.params;
console.log({ pizzaId });

const getSelectedPizza = createSelector(
fromStore.getPizzasEntities,
@@ -50,7 +51,7 @@ export class ProductItemComponent implements OnInit {
);

const getPizzaVisualised = createSelector(
getSelectedPizza as any,
getSelectedPizza,
fromStore.getToppingEntities,
fromStore.getSelectedToppings,
(pizza, toppingEntities, selectedToppings) => {
@@ -59,16 +60,18 @@ export class ProductItemComponent implements OnInit {
}
);

this.pizza$ = this.store.select(getSelectedPizza).pipe(
this.pizza$ = this.store.select(getSelectedPizza);
this.toppings$ = this.store.select(fromStore.getAllToppings);
this.visualise$ = this.store.select(getPizzaVisualised);

this.pizza$.pipe(
tap((pizza: Pizza = null as any) => {
const pizzaExists = Boolean(pizza && pizza.toppings);
// tslint:disable-next-line:no-non-null-assertion
const toppings = pizzaExists ? pizza.toppings!.map((topping) => topping.id!) : [];
this.store.dispatch(new fromStore.VisualiseToppings(toppings));
})
) as Observable<Pizza>;
this.toppings$ = this.store.select(fromStore.getAllToppings);
this.visualise$ = this.store.select(getPizzaVisualised);
);
}

onSelect(event: number[]) {
2 changes: 1 addition & 1 deletion src/app/products/store/selectors/pizzas.selectors.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import * as fromPizzas from '../reducers/pizzas.reducer';
import * as fromToppings from './toppings.selectors';

export const getPizzaState = createSelector(
fromFeature.getProductsState,
fromFeature.selectProductsState,
(state: fromFeature.ProductsState) => state.pizzas
);