{"action":"created","comment":{"url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/comments/202174723","pull_request_review_id":136816002,"id":202174723,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjE3NDcyMw==","diff_hunk":"@@ -38,27 +38,113 @@ class ProductRecommendationsDisplayMain extends React.Component {\n             this.setState({ categoryModel: nextProps.productData });\n         }\n     }\n-    renderProducts() {\n+    renderRecommendations(){\n+        var product = this.state.productData['_recommendations'][0]['_crosssell'][0].links;\n+        var length = this.state.productData['_recommendations'][0]['_crosssell'][0].links.length;\n+        return this.renderProducts(product, length);\n+    }\n+    renderReplacement(){\n+        var product = this.state.productData['_recommendations'][0]['_replacement'][0].links;\n+        var length = this.state.productData['_recommendations'][0]['_replacement'][0].links.length;\n+        return this.renderProducts(product, length);\n+    }\n+    renderUpsell(){\n+        var product = this.state.productData['_recommendations'][0]['_upsell'][0].links;\n+        var length = this.state.productData['_recommendations'][0]['_upsell'][0].links.length;\n+        return this.renderProducts(product, length);\n+    }\n+    renderProducts(product,length) {\n         // Need to do this for all possible recommendations. Crosssell, Recommendation, Replacement, Upsell, Warranty.\n-        return this.state.productData['_recommendations'][0]['_crosssell'][0].links.map(product => {\n-            if (product.rel === \"element\") {\n-                return (\n-                    <li key={'_' + Math.random().toString(36).substr(2, 9)} className=\"category-item-container\">\n-                        <ProductListItemMain productUrl={product.uri} />\n-                    </li>\n+        const totalCount = length;\n+        const MaxItemsInOneCarouselView = 2;\n+        console.log(\"Total items to render: \" + totalCount );\n+        const maxViews = Math.ceil(totalCount / MaxItemsInOneCarouselView);\n+        console.log(\"Total Views created: \" + maxViews );\n+        var data = [];\n+        for(var CurrentView = 0, CurrentItem = 0; CurrentView < maxViews ; CurrentView ++, CurrentItem = CurrentItem + MaxItemsInOneCarouselView ){\n+            if(CurrentView == 0){\n+            data.push(<div className=\"carousel-item active\" key = {(CurrentItem)}> <div className=\"row\">{this.renderCarouselView(CurrentItem, totalCount,product,MaxItemsInOneCarouselView)}</div> </div>);\n+            }\n+            else {\n+                data.push(<div className=\"carousel-item \" key = {(CurrentItem + 1)}> <div className=\"row\">{this.renderCarouselView(CurrentItem, totalCount,product,MaxItemsInOneCarouselView)}</div> </div>);\n+                }\n+        }\n+    \n+        return <div>{data}</div>;\n+    }\n+    renderCarouselView(currentItem, totalCount, product, MaxItemsInOneCarouselView) {\n+        /* Renders Each View in Carousel*/\n+        var some = MaxItemsInOneCarouselView;\n+        var data = [];\n+        if ( currentItem < totalCount  && product[currentItem].rel === \"element\"){\n+            console.log(\"renderView: \" + currentItem);\n+            data.push(  \n+                    <div className=\"col-md-6 col-sm-6 col-6\" key ={'_' + Math.random().toString(36).substr(2, 9)}  >\n+                        <ProductListItemMain productUrl={product[currentItem].uri} />\n+                    </div>    \n                 );\n+        }\n+        for (var i = 1 ; i<MaxItemsInOneCarouselView;i++){\n+            /* Copy this section to add more items in the same carousel view*/\n+            currentItem++;\n+            if ((currentItem) < totalCount && product[(currentItem)].rel === \"element\"){\n+                console.log(\"renderView: \" + (currentItem));\n+                data.push(\n+                        <div className=\"col-md-6 col-sm-6 col-6\" key = {'_' + Math.random().toString(36).substr(2, 9)} >\n+                            <ProductListItemMain productUrl={product[(currentItem)].uri} />\n+                        </div>    \n+                    );\n             }\n-        })\n+        }\n+        \n+        return data;\n+\n     }\n     render() {","path":"src/components/productrecommendations.main.jsx","position":74,"original_position":74,"commit_id":"86699e2636235549aec6d1b69114d340042b6a18","original_commit_id":"86699e2636235549aec6d1b69114d340042b6a18","user":{"login":"shaunmaharaj","id":39800563,"node_id":"MDQ6VXNlcjM5ODAwNTYz","avatar_url":"https://avatars3.githubusercontent.com/u/39800563?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunmaharaj","html_url":"https://github.com/shaunmaharaj","followers_url":"https://api.github.com/users/shaunmaharaj/followers","following_url":"https://api.github.com/users/shaunmaharaj/following{/other_user}","gists_url":"https://api.github.com/users/shaunmaharaj/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunmaharaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunmaharaj/subscriptions","organizations_url":"https://api.github.com/users/shaunmaharaj/orgs","repos_url":"https://api.github.com/users/shaunmaharaj/repos","events_url":"https://api.github.com/users/shaunmaharaj/events{/privacy}","received_events_url":"https://api.github.com/users/shaunmaharaj/received_events","type":"User","site_admin":false},"body":"What happens if a product doesn't have any recommendations?","created_at":"2018-07-12T20:50:36Z","updated_at":"2018-07-12T20:55:27Z","html_url":"https://github.com/shaunmaharaj/ep-store/pull/39#discussion_r202174723","pull_request_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/comments/202174723"},"html":{"href":"https://github.com/shaunmaharaj/ep-store/pull/39#discussion_r202174723"},"pull_request":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39","id":201115985,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxMTE1OTg1","html_url":"https://github.com/shaunmaharaj/ep-store/pull/39","diff_url":"https://github.com/shaunmaharaj/ep-store/pull/39.diff","patch_url":"https://github.com/shaunmaharaj/ep-store/pull/39.patch","issue_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/39","number":39,"state":"open","locked":false,"title":"add carousel to the product details page","user":{"login":"jatinbehlEP","id":41068897,"node_id":"MDQ6VXNlcjQxMDY4ODk3","avatar_url":"https://avatars3.githubusercontent.com/u/41068897?v=4","gravatar_id":"","url":"https://api.github.com/users/jatinbehlEP","html_url":"https://github.com/jatinbehlEP","followers_url":"https://api.github.com/users/jatinbehlEP/followers","following_url":"https://api.github.com/users/jatinbehlEP/following{/other_user}","gists_url":"https://api.github.com/users/jatinbehlEP/gists{/gist_id}","starred_url":"https://api.github.com/users/jatinbehlEP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jatinbehlEP/subscriptions","organizations_url":"https://api.github.com/users/jatinbehlEP/orgs","repos_url":"https://api.github.com/users/jatinbehlEP/repos","events_url":"https://api.github.com/users/jatinbehlEP/events{/privacy}","received_events_url":"https://api.github.com/users/jatinbehlEP/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-12T20:26:30Z","updated_at":"2018-07-12T20:55:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eea6e3b086311c2f71c54ab4363a11c7ad9e9708","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39/commits","review_comments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39/comments","review_comment_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/39/comments","statuses_url":"https://api.github.com/repos/shaunmaharaj/ep-store/statuses/86699e2636235549aec6d1b69114d340042b6a18","head":{"label":"shaunmaharaj:carousel","ref":"carousel","sha":"86699e2636235549aec6d1b69114d340042b6a18","user":{"login":"shaunmaharaj","id":39800563,"node_id":"MDQ6VXNlcjM5ODAwNTYz","avatar_url":"https://avatars3.githubusercontent.com/u/39800563?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunmaharaj","html_url":"https://github.com/shaunmaharaj","followers_url":"https://api.github.com/users/shaunmaharaj/followers","following_url":"https://api.github.com/users/shaunmaharaj/following{/other_user}","gists_url":"https://api.github.com/users/shaunmaharaj/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunmaharaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunmaharaj/subscriptions","organizations_url":"https://api.github.com/users/shaunmaharaj/orgs","repos_url":"https://api.github.com/users/shaunmaharaj/repos","events_url":"https://api.github.com/users/shaunmaharaj/events{/privacy}","received_events_url":"https://api.github.com/users/shaunmaharaj/received_events","type":"User","site_admin":false},"repo":{"id":136932269,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY5MzIyNjk=","name":"ep-store","full_name":"shaunmaharaj/ep-store","owner":{"login":"shaunmaharaj","id":39800563,"node_id":"MDQ6VXNlcjM5ODAwNTYz","avatar_url":"https://avatars3.githubusercontent.com/u/39800563?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunmaharaj","html_url":"https://github.com/shaunmaharaj","followers_url":"https://api.github.com/users/shaunmaharaj/followers","following_url":"https://api.github.com/users/shaunmaharaj/following{/other_user}","gists_url":"https://api.github.com/users/shaunmaharaj/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunmaharaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunmaharaj/subscriptions","organizations_url":"https://api.github.com/users/shaunmaharaj/orgs","repos_url":"https://api.github.com/users/shaunmaharaj/repos","events_url":"https://api.github.com/users/shaunmaharaj/events{/privacy}","received_events_url":"https://api.github.com/users/shaunmaharaj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shaunmaharaj/ep-store","description":"Reference store in React","fork":false,"url":"https://api.github.com/repos/shaunmaharaj/ep-store","forks_url":"https://api.github.com/repos/shaunmaharaj/ep-store/forks","keys_url":"https://api.github.com/repos/shaunmaharaj/ep-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shaunmaharaj/ep-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shaunmaharaj/ep-store/teams","hooks_url":"https://api.github.com/repos/shaunmaharaj/ep-store/hooks","issue_events_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/events{/number}","events_url":"https://api.github.com/repos/shaunmaharaj/ep-store/events","assignees_url":"https://api.github.com/repos/shaunmaharaj/ep-store/assignees{/user}","branches_url":"https://api.github.com/repos/shaunmaharaj/ep-store/branches{/branch}","tags_url":"https://api.github.com/repos/shaunmaharaj/ep-store/tags","blobs_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shaunmaharaj/ep-store/statuses/{sha}","languages_url":"https://api.github.com/repos/shaunmaharaj/ep-store/languages","stargazers_url":"https://api.github.com/repos/shaunmaharaj/ep-store/stargazers","contributors_url":"https://api.github.com/repos/shaunmaharaj/ep-store/contributors","subscribers_url":"https://api.github.com/repos/shaunmaharaj/ep-store/subscribers","subscription_url":"https://api.github.com/repos/shaunmaharaj/ep-store/subscription","commits_url":"https://api.github.com/repos/shaunmaharaj/ep-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/shaunmaharaj/ep-store/contents/{+path}","compare_url":"https://api.github.com/repos/shaunmaharaj/ep-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shaunmaharaj/ep-store/merges","archive_url":"https://api.github.com/repos/shaunmaharaj/ep-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shaunmaharaj/ep-store/downloads","issues_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues{/number}","pulls_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls{/number}","milestones_url":"https://api.github.com/repos/shaunmaharaj/ep-store/milestones{/number}","notifications_url":"https://api.github.com/repos/shaunmaharaj/ep-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shaunmaharaj/ep-store/labels{/name}","releases_url":"https://api.github.com/repos/shaunmaharaj/ep-store/releases{/id}","deployments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/deployments","created_at":"2018-06-11T13:45:06Z","updated_at":"2018-07-12T16:16:25Z","pushed_at":"2018-07-12T20:26:30Z","git_url":"git://github.com/shaunmaharaj/ep-store.git","ssh_url":"git@github.com:shaunmaharaj/ep-store.git","clone_url":"https://github.com/shaunmaharaj/ep-store.git","svn_url":"https://github.com/shaunmaharaj/ep-store","homepage":null,"size":3881,"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":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"shaunmaharaj:master","ref":"master","sha":"a32a852f573df4f5ea424a5449156ac4cd4abde7","user":{"login":"shaunmaharaj","id":39800563,"node_id":"MDQ6VXNlcjM5ODAwNTYz","avatar_url":"https://avatars3.githubusercontent.com/u/39800563?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunmaharaj","html_url":"https://github.com/shaunmaharaj","followers_url":"https://api.github.com/users/shaunmaharaj/followers","following_url":"https://api.github.com/users/shaunmaharaj/following{/other_user}","gists_url":"https://api.github.com/users/shaunmaharaj/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunmaharaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunmaharaj/subscriptions","organizations_url":"https://api.github.com/users/shaunmaharaj/orgs","repos_url":"https://api.github.com/users/shaunmaharaj/repos","events_url":"https://api.github.com/users/shaunmaharaj/events{/privacy}","received_events_url":"https://api.github.com/users/shaunmaharaj/received_events","type":"User","site_admin":false},"repo":{"id":136932269,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY5MzIyNjk=","name":"ep-store","full_name":"shaunmaharaj/ep-store","owner":{"login":"shaunmaharaj","id":39800563,"node_id":"MDQ6VXNlcjM5ODAwNTYz","avatar_url":"https://avatars3.githubusercontent.com/u/39800563?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunmaharaj","html_url":"https://github.com/shaunmaharaj","followers_url":"https://api.github.com/users/shaunmaharaj/followers","following_url":"https://api.github.com/users/shaunmaharaj/following{/other_user}","gists_url":"https://api.github.com/users/shaunmaharaj/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunmaharaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunmaharaj/subscriptions","organizations_url":"https://api.github.com/users/shaunmaharaj/orgs","repos_url":"https://api.github.com/users/shaunmaharaj/repos","events_url":"https://api.github.com/users/shaunmaharaj/events{/privacy}","received_events_url":"https://api.github.com/users/shaunmaharaj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shaunmaharaj/ep-store","description":"Reference store in React","fork":false,"url":"https://api.github.com/repos/shaunmaharaj/ep-store","forks_url":"https://api.github.com/repos/shaunmaharaj/ep-store/forks","keys_url":"https://api.github.com/repos/shaunmaharaj/ep-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shaunmaharaj/ep-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shaunmaharaj/ep-store/teams","hooks_url":"https://api.github.com/repos/shaunmaharaj/ep-store/hooks","issue_events_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/events{/number}","events_url":"https://api.github.com/repos/shaunmaharaj/ep-store/events","assignees_url":"https://api.github.com/repos/shaunmaharaj/ep-store/assignees{/user}","branches_url":"https://api.github.com/repos/shaunmaharaj/ep-store/branches{/branch}","tags_url":"https://api.github.com/repos/shaunmaharaj/ep-store/tags","blobs_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shaunmaharaj/ep-store/statuses/{sha}","languages_url":"https://api.github.com/repos/shaunmaharaj/ep-store/languages","stargazers_url":"https://api.github.com/repos/shaunmaharaj/ep-store/stargazers","contributors_url":"https://api.github.com/repos/shaunmaharaj/ep-store/contributors","subscribers_url":"https://api.github.com/repos/shaunmaharaj/ep-store/subscribers","subscription_url":"https://api.github.com/repos/shaunmaharaj/ep-store/subscription","commits_url":"https://api.github.com/repos/shaunmaharaj/ep-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/shaunmaharaj/ep-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/shaunmaharaj/ep-store/contents/{+path}","compare_url":"https://api.github.com/repos/shaunmaharaj/ep-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shaunmaharaj/ep-store/merges","archive_url":"https://api.github.com/repos/shaunmaharaj/ep-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shaunmaharaj/ep-store/downloads","issues_url":"https://api.github.com/repos/shaunmaharaj/ep-store/issues{/number}","pulls_url":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls{/number}","milestones_url":"https://api.github.com/repos/shaunmaharaj/ep-store/milestones{/number}","notifications_url":"https://api.github.com/repos/shaunmaharaj/ep-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shaunmaharaj/ep-store/labels{/name}","releases_url":"https://api.github.com/repos/shaunmaharaj/ep-store/releases{/id}","deployments_url":"https://api.github.com/repos/shaunmaharaj/ep-store/deployments","created_at":"2018-06-11T13:45:06Z","updated_at":"2018-07-12T16:16:25Z","pushed_at":"2018-07-12T20:26:30Z","git_url":"git://github.com/shaunmaharaj/ep-store.git","ssh_url":"git@github.com:shaunmaharaj/ep-store.git","clone_url":"https://github.com/shaunmaharaj/ep-store.git","svn_url":"https://github.com/shaunmaharaj/ep-store","homepage":null,"size":3881,"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":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39"},"html":{"href":"https://github.com/shaunmaharaj/ep-store/pull/39"},"issue":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/39"},"comments":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/shaunmaharaj/ep-store/statuses/86699e2636235549aec6d1b69114d340042b6a18"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"shaunmaharaj"}}