Skip to content

Favorite products#100

Merged
pkrawat1 merged 1 commit into
developfrom
favorite_products
Apr 25, 2018
Merged

Favorite products#100
pkrawat1 merged 1 commit into
developfrom
favorite_products

Conversation

@chandradot99
Copy link
Copy Markdown
Member

  • mark a product as favorite from the product page.
  • It gives user the ability to see all products marked as favorite by him/her
  • Admin can view which products have been marked as favorite, and by which users, on the Admin end.

@chandradot99 chandradot99 changed the base branch from master to develop April 24, 2018 14:27
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add return types for http methods here too markAsFavorite(id: number): <Return Type> { return this.http.post(/spree/favorite_products, {id: id}) }`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use bootstrap classes only here for modularity purposes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove after PR is ready.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a default value here as an empty array. So that we don't do length check here.
Just *ngIf="products$ | async; let products; else elseBlock" would be enough.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkrawat1 if we use this, then empty array would always return true and else block will never run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div *ngIf="products$ | async; let products">
  <table class="table" *ngIf="products.length; else elseBlock">
    <thead class="thead-light">
      <tr>
        <th scope="col">Product Image</th>
        <th scope="col">Product Name</th>
        <th scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
      <app-favorite-product-list-item *ngFor="let product of products" [product]="product"></app-favorite-product-list-item>
    </tbody>
  </table>

  <ng-template #elseBlock>
    <div>You have'nt favorited anything yet.</div>
  </ng-template>
</div>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why async twice 🤨 here. use *ngIf="products$ | async; let products; else elseBlock"

Comment thread src/app/user/effects/user.effects.ts Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation or autocorrect please

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div *ngIf="products$ | async; let products">
  <table class="table" *ngIf="products.length; else elseBlock">
    <thead class="thead-light">
      <tr>
        <th scope="col">Product Image</th>
        <th scope="col">Product Name</th>
        <th scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
      <app-favorite-product-list-item *ngFor="let product of products" [product]="product"></app-favorite-product-list-item>
    </tbody>
  </table>

  <ng-template #elseBlock>
    <div>You have'nt favorited anything yet.</div>
  </ng-template>
</div>

add favorite product functionality

remove from favorite functionality

remove unmark as favorite option from product detail page

indentation and bug fixes

use async pipe in view only once
@pkrawat1 pkrawat1 merged commit a3c1e61 into develop Apr 25, 2018
@pkrawat1 pkrawat1 deleted the favorite_products branch April 25, 2018 09:46
pkrawat1 pushed a commit that referenced this pull request Jun 13, 2018
add favorite product functionality

remove from favorite functionality

remove unmark as favorite option from product detail page

indentation and bug fixes

use async pipe in view only once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants