{"action":"created","comment":{"url":"https://api.github.com/repos/alexdpars/partfinder/pulls/comments/226153889","pull_request_review_id":165906808,"id":226153889,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjE1Mzg4OQ==","diff_hunk":"@@ -10,106 +13,82 @@ class partDetail extends Component {\n     this.setState({ hideDisponibilities: !this.state.hideDisponibilities });\n   };\n \n-  renderToggle() {\n-    if (\n-      this.props.part.InventoryDetail !== null &&\n-      this.props.part.InventoryDetail.length !== 0\n-    ) {\n-      return (\n-        <div className=\"d-inline\">\n-          <button\n-            onClick={this.toggleDisponibilities}\n-            className=\"btn btn-light\"\n-          >\n-            See more\n-          </button>\n-        </div>\n-      );\n-    }\n-    return \"\";\n-  }\n+  renderToggle = () => (\n+    <div className=\"d-inline\">\n+      <button onClick={this.toggleDisponibilities} className=\"btn btn-light\">\n+        See more\n+      </button>\n+    </div>\n+  );\n \n-  RenderDetail() {\n-    if (!this.state.hideDisponibilities) {\n-      return (\n-        <table>\n-          <thead>\n-            <tr>\n-              <th>Location</th>\n-              <th>Qty</th>\n-            </tr>\n-          </thead>\n-          <tbody>\n-            {this.props.part.InventoryDetail.map((i, index) => (\n-              <tr key={index}>\n-                <td>{i.Location}</td>\n-                <td>{i.Qty}</td>\n-              </tr>\n-            ))}\n-          </tbody>\n-        </table>\n-      );\n-    }\n-    return \"\";\n-  }\n-  renderCost() {\n-    if (this.props.costVisibility) {\n-      console.log(\"costvisibility\", this.props.costVisibility);\n-      return (\n-        <CurrencyFormat\n-          value={this.props.part.cost.toFixed(2)}\n-          displayType={\"text\"}\n-          prefix={\"$\"}\n-        />\n-      );\n-    }\n-    return \"\";\n-  }\n-  renderAlternates() {\n-    if (\n-      this.props.part.Alternates !== null &&\n-      typeof this.props.part.Alternates !== \"undefined\"\n-    ) {\n-      return (\n+  RenderDetail = () => (\n+    <table>\n+      <thead>\n         <tr>\n-          <td colSpan=\"6\">\n-            <div className=\"col-12\">\n-              <PartGrid\n-                isAlternate={true}\n-                detail={this.props.part.Alternates}\n-                costVisibility={this.props.costVisibility}\n-              />\n-            </div>\n-          </td>\n+          <th>Location</th>\n+          <th>Qty</th>\n         </tr>\n-      );\n-    }\n+      </thead>\n+      <tbody>\n+      {/* constante 'i' designe normalement index, si 'i' === inventory tu devrais ecrire inventory */}\n+        {this.props.part.InventoryDetail.map((inventory, index) => ( \n+          <tr key={index}>\n+            <td>{inventory.Location}</td>\n+            <td>{inventory.Qty}</td>\n+          </tr>\n+        ))}\n+      </tbody>\n+    </table>\n+  );\n+  \n+  renderAlternates = () => (\n+    <tr>\n+      <td colSpan=\"6\">\n+        <div className=\"col-12\">\n+          <PartGrid\n+      // un prop positif on le met, un negatif on le met juste pas,\n+      // c'est pour ca que le prop default est toujours a false\n+            isAlternate\n+            detail={this.props.part.Alternates}\n+            costVisibility={this.props.costVisibility}\n+          />\n+        </div>\n+      </td>\n+    </tr>\n+  );\n+\n+  hasInventory = () => {\n+    const { InventoryDetail} = this.props.part;\n+    return !!InventoryDetail && InventoryDetail.length !== 0;\n+  }\n+\n+  toMoney = value => {\n+    return new Intl.NumberFormat('fr-CA', { style: 'currency', currency: 'CAD' }).format(value)\n   }\n+\n+\n   render() {\n+    const { lineCode, productCode, description, qty, core, Alternates } = this.props.part;","path":"src/components/partDetail.jsx","position":140,"original_position":140,"commit_id":"c14571416b3ac32b00d291aebeaff90c39004c50","original_commit_id":"c14571416b3ac32b00d291aebeaff90c39004c50","user":{"login":"jwallet","id":23088305,"node_id":"MDQ6VXNlcjIzMDg4MzA1","avatar_url":"https://avatars2.githubusercontent.com/u/23088305?v=4","gravatar_id":"","url":"https://api.github.com/users/jwallet","html_url":"https://github.com/jwallet","followers_url":"https://api.github.com/users/jwallet/followers","following_url":"https://api.github.com/users/jwallet/following{/other_user}","gists_url":"https://api.github.com/users/jwallet/gists{/gist_id}","starred_url":"https://api.github.com/users/jwallet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwallet/subscriptions","organizations_url":"https://api.github.com/users/jwallet/orgs","repos_url":"https://api.github.com/users/jwallet/repos","events_url":"https://api.github.com/users/jwallet/events{/privacy}","received_events_url":"https://api.github.com/users/jwallet/received_events","type":"User","site_admin":false},"body":"on explose l'objet vu que son path est utilise partout dans le rende,r , plus facile d'acces","created_at":"2018-10-18T02:47:00Z","updated_at":"2018-10-18T02:50:32Z","html_url":"https://github.com/alexdpars/partfinder/pull/1#discussion_r226153889","pull_request_url":"https://api.github.com/repos/alexdpars/partfinder/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/comments/226153889"},"html":{"href":"https://github.com/alexdpars/partfinder/pull/1#discussion_r226153889"},"pull_request":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/alexdpars/partfinder/pulls/1","id":223808738,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzODA4NzM4","html_url":"https://github.com/alexdpars/partfinder/pull/1","diff_url":"https://github.com/alexdpars/partfinder/pull/1.diff","patch_url":"https://github.com/alexdpars/partfinder/pull/1.patch","issue_url":"https://api.github.com/repos/alexdpars/partfinder/issues/1","number":1,"state":"open","locked":false,"title":"suggestion, approche et review","user":{"login":"jwallet","id":23088305,"node_id":"MDQ6VXNlcjIzMDg4MzA1","avatar_url":"https://avatars2.githubusercontent.com/u/23088305?v=4","gravatar_id":"","url":"https://api.github.com/users/jwallet","html_url":"https://github.com/jwallet","followers_url":"https://api.github.com/users/jwallet/followers","following_url":"https://api.github.com/users/jwallet/following{/other_user}","gists_url":"https://api.github.com/users/jwallet/gists{/gist_id}","starred_url":"https://api.github.com/users/jwallet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwallet/subscriptions","organizations_url":"https://api.github.com/users/jwallet/orgs","repos_url":"https://api.github.com/users/jwallet/repos","events_url":"https://api.github.com/users/jwallet/events{/privacy}","received_events_url":"https://api.github.com/users/jwallet/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-18T02:42:11Z","updated_at":"2018-10-18T02:50:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a97170e55f484fafcf9ed64603df8d57b36313ef","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alexdpars/partfinder/pulls/1/commits","review_comments_url":"https://api.github.com/repos/alexdpars/partfinder/pulls/1/comments","review_comment_url":"https://api.github.com/repos/alexdpars/partfinder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexdpars/partfinder/issues/1/comments","statuses_url":"https://api.github.com/repos/alexdpars/partfinder/statuses/c14571416b3ac32b00d291aebeaff90c39004c50","head":{"label":"jwallet:master","ref":"master","sha":"c14571416b3ac32b00d291aebeaff90c39004c50","user":{"login":"jwallet","id":23088305,"node_id":"MDQ6VXNlcjIzMDg4MzA1","avatar_url":"https://avatars2.githubusercontent.com/u/23088305?v=4","gravatar_id":"","url":"https://api.github.com/users/jwallet","html_url":"https://github.com/jwallet","followers_url":"https://api.github.com/users/jwallet/followers","following_url":"https://api.github.com/users/jwallet/following{/other_user}","gists_url":"https://api.github.com/users/jwallet/gists{/gist_id}","starred_url":"https://api.github.com/users/jwallet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwallet/subscriptions","organizations_url":"https://api.github.com/users/jwallet/orgs","repos_url":"https://api.github.com/users/jwallet/repos","events_url":"https://api.github.com/users/jwallet/events{/privacy}","received_events_url":"https://api.github.com/users/jwallet/received_events","type":"User","site_admin":false},"repo":{"id":153542908,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM1NDI5MDg=","name":"partfinder","full_name":"jwallet/partfinder","private":false,"owner":{"login":"jwallet","id":23088305,"node_id":"MDQ6VXNlcjIzMDg4MzA1","avatar_url":"https://avatars2.githubusercontent.com/u/23088305?v=4","gravatar_id":"","url":"https://api.github.com/users/jwallet","html_url":"https://github.com/jwallet","followers_url":"https://api.github.com/users/jwallet/followers","following_url":"https://api.github.com/users/jwallet/following{/other_user}","gists_url":"https://api.github.com/users/jwallet/gists{/gist_id}","starred_url":"https://api.github.com/users/jwallet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwallet/subscriptions","organizations_url":"https://api.github.com/users/jwallet/orgs","repos_url":"https://api.github.com/users/jwallet/repos","events_url":"https://api.github.com/users/jwallet/events{/privacy}","received_events_url":"https://api.github.com/users/jwallet/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jwallet/partfinder","description":"First react app","fork":true,"url":"https://api.github.com/repos/jwallet/partfinder","forks_url":"https://api.github.com/repos/jwallet/partfinder/forks","keys_url":"https://api.github.com/repos/jwallet/partfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwallet/partfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwallet/partfinder/teams","hooks_url":"https://api.github.com/repos/jwallet/partfinder/hooks","issue_events_url":"https://api.github.com/repos/jwallet/partfinder/issues/events{/number}","events_url":"https://api.github.com/repos/jwallet/partfinder/events","assignees_url":"https://api.github.com/repos/jwallet/partfinder/assignees{/user}","branches_url":"https://api.github.com/repos/jwallet/partfinder/branches{/branch}","tags_url":"https://api.github.com/repos/jwallet/partfinder/tags","blobs_url":"https://api.github.com/repos/jwallet/partfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwallet/partfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwallet/partfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwallet/partfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwallet/partfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/jwallet/partfinder/languages","stargazers_url":"https://api.github.com/repos/jwallet/partfinder/stargazers","contributors_url":"https://api.github.com/repos/jwallet/partfinder/contributors","subscribers_url":"https://api.github.com/repos/jwallet/partfinder/subscribers","subscription_url":"https://api.github.com/repos/jwallet/partfinder/subscription","commits_url":"https://api.github.com/repos/jwallet/partfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwallet/partfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwallet/partfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwallet/partfinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwallet/partfinder/contents/{+path}","compare_url":"https://api.github.com/repos/jwallet/partfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwallet/partfinder/merges","archive_url":"https://api.github.com/repos/jwallet/partfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwallet/partfinder/downloads","issues_url":"https://api.github.com/repos/jwallet/partfinder/issues{/number}","pulls_url":"https://api.github.com/repos/jwallet/partfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/jwallet/partfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/jwallet/partfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwallet/partfinder/labels{/name}","releases_url":"https://api.github.com/repos/jwallet/partfinder/releases{/id}","deployments_url":"https://api.github.com/repos/jwallet/partfinder/deployments","created_at":"2018-10-18T00:57:50Z","updated_at":"2018-10-18T02:41:31Z","pushed_at":"2018-10-18T02:41:30Z","git_url":"git://github.com/jwallet/partfinder.git","ssh_url":"git@github.com:jwallet/partfinder.git","clone_url":"https://github.com/jwallet/partfinder.git","svn_url":"https://github.com/jwallet/partfinder","homepage":null,"size":202,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"alexdpars:master","ref":"master","sha":"9af68914347f2f1e22434732d5c2da86b8f56a78","user":{"login":"alexdpars","id":22840402,"node_id":"MDQ6VXNlcjIyODQwNDAy","avatar_url":"https://avatars1.githubusercontent.com/u/22840402?v=4","gravatar_id":"","url":"https://api.github.com/users/alexdpars","html_url":"https://github.com/alexdpars","followers_url":"https://api.github.com/users/alexdpars/followers","following_url":"https://api.github.com/users/alexdpars/following{/other_user}","gists_url":"https://api.github.com/users/alexdpars/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdpars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdpars/subscriptions","organizations_url":"https://api.github.com/users/alexdpars/orgs","repos_url":"https://api.github.com/users/alexdpars/repos","events_url":"https://api.github.com/users/alexdpars/events{/privacy}","received_events_url":"https://api.github.com/users/alexdpars/received_events","type":"User","site_admin":false},"repo":{"id":153482297,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM0ODIyOTc=","name":"partfinder","full_name":"alexdpars/partfinder","private":false,"owner":{"login":"alexdpars","id":22840402,"node_id":"MDQ6VXNlcjIyODQwNDAy","avatar_url":"https://avatars1.githubusercontent.com/u/22840402?v=4","gravatar_id":"","url":"https://api.github.com/users/alexdpars","html_url":"https://github.com/alexdpars","followers_url":"https://api.github.com/users/alexdpars/followers","following_url":"https://api.github.com/users/alexdpars/following{/other_user}","gists_url":"https://api.github.com/users/alexdpars/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdpars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdpars/subscriptions","organizations_url":"https://api.github.com/users/alexdpars/orgs","repos_url":"https://api.github.com/users/alexdpars/repos","events_url":"https://api.github.com/users/alexdpars/events{/privacy}","received_events_url":"https://api.github.com/users/alexdpars/received_events","type":"User","site_admin":false},"html_url":"https://github.com/alexdpars/partfinder","description":"First react app","fork":false,"url":"https://api.github.com/repos/alexdpars/partfinder","forks_url":"https://api.github.com/repos/alexdpars/partfinder/forks","keys_url":"https://api.github.com/repos/alexdpars/partfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexdpars/partfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexdpars/partfinder/teams","hooks_url":"https://api.github.com/repos/alexdpars/partfinder/hooks","issue_events_url":"https://api.github.com/repos/alexdpars/partfinder/issues/events{/number}","events_url":"https://api.github.com/repos/alexdpars/partfinder/events","assignees_url":"https://api.github.com/repos/alexdpars/partfinder/assignees{/user}","branches_url":"https://api.github.com/repos/alexdpars/partfinder/branches{/branch}","tags_url":"https://api.github.com/repos/alexdpars/partfinder/tags","blobs_url":"https://api.github.com/repos/alexdpars/partfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexdpars/partfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexdpars/partfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexdpars/partfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexdpars/partfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/alexdpars/partfinder/languages","stargazers_url":"https://api.github.com/repos/alexdpars/partfinder/stargazers","contributors_url":"https://api.github.com/repos/alexdpars/partfinder/contributors","subscribers_url":"https://api.github.com/repos/alexdpars/partfinder/subscribers","subscription_url":"https://api.github.com/repos/alexdpars/partfinder/subscription","commits_url":"https://api.github.com/repos/alexdpars/partfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexdpars/partfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexdpars/partfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexdpars/partfinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexdpars/partfinder/contents/{+path}","compare_url":"https://api.github.com/repos/alexdpars/partfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexdpars/partfinder/merges","archive_url":"https://api.github.com/repos/alexdpars/partfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexdpars/partfinder/downloads","issues_url":"https://api.github.com/repos/alexdpars/partfinder/issues{/number}","pulls_url":"https://api.github.com/repos/alexdpars/partfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/alexdpars/partfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/alexdpars/partfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexdpars/partfinder/labels{/name}","releases_url":"https://api.github.com/repos/alexdpars/partfinder/releases{/id}","deployments_url":"https://api.github.com/repos/alexdpars/partfinder/deployments","created_at":"2018-10-17T15:41:00Z","updated_at":"2018-10-17T21:05:15Z","pushed_at":"2018-10-18T02:42:12Z","git_url":"git://github.com/alexdpars/partfinder.git","ssh_url":"git@github.com:alexdpars/partfinder.git","clone_url":"https://github.com/alexdpars/partfinder.git","svn_url":"https://github.com/alexdpars/partfinder","homepage":null,"size":202,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/1"},"html":{"href":"https://github.com/alexdpars/partfinder/pull/1"},"issue":{"href":"https://api.github.com/repos/alexdpars/partfinder/issues/1"},"comments":{"href":"https://api.github.com/repos/alexdpars/partfinder/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexdpars/partfinder/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/alexdpars/partfinder/statuses/c14571416b3ac32b00d291aebeaff90c39004c50"}},"author_association":"NONE"}}
{"actor":{"display_login":"jwallet"}}