{"action":"created","comment":{"url":"https://api.github.com/repos/Talend/ui/pulls/comments/197169044","pull_request_review_id":130860377,"id":197169044,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzE2OTA0NA==","diff_hunk":"@@ -1,20 +1,81 @@\n import React from 'react';\n import PropTypes from 'prop-types';\n+import Immutable from 'immutable';\n import theme from './DateTimePicker.scss';\n import DateTimeView from '../views/DateTimeView';\n import MonthYearView from '../views/MonthYearView';\n \n-function DateTimePicker(props) {\n-\tconst isCalendarView = true;\n-\tconst viewComponent = isCalendarView\n-\t\t? <DateTimeView />\n-\t\t: <MonthYearView />;\n-\n-\treturn (\n-\t\t<div className={theme.container}>\n-\t\t\t{viewComponent}\n-\t\t</div>\n-\t);\n+class DateTimePicker extends React.Component {\n+\n+\tconstructor(props) {\n+\t\tsuper(props);\n+\n+\t\tconst now = new Date();\n+\n+\t\tthis.state = {\n+\t\t\tisDateTimeView: true,\n+\t\t\tcurrentCalendar: Immutable.Map({\n+\t\t\t\tmonthIndex: now.getMonth(),\n+\t\t\t\tyear: now.getFullYear(),\n+\t\t\t}),\n+\t\t};\n+\n+\t\tthis.setDateTimeView = this.setView.bind(this, true);\n+\t\tthis.setMonthYearView = this.setView.bind(this, false);\n+\t\tthis.onMonthSelected = this.onMonthSelected.bind(this);\n+\t\tthis.onYearSelected = this.onYearSelected.bind(this);\n+\t}\n+\n+\tonMonthSelected(monthIndex) {\n+\t\tthis.setState(previousState => ({\n+\t\t\tcurrentCalendar: previousState.currentCalendar.merge({ monthIndex }),\n+\t\t}));\n+\t}\n+\n+\tonYearSelected(year) {\n+\t\tthis.setState(previousState => ({\n+\t\t\tcurrentCalendar: previousState.currentCalendar.merge({ year }),\n+\t\t}));\n+\t}\n+\n+\tsetView(isDateTime) {\n+\t\tthis.setState({\n+\t\t\tisDateTimeView: isDateTime,\n+\t\t});\n+\t}\n+\n+\trender() {\n+\t\tconst dateTimeView = (\n+\t\t\t<DateTimeView\n+\t\t\t\tonTitleClick={this.setMonthYearView}\n+\t\t\t\tmonthIndexSelected={this.state.currentCalendar.get('monthIndex')}\n+\t\t\t\tyearSelected={this.state.currentCalendar.get('year')}\n+\t\t\t\tonMonthSelected={this.onMonthSelected}\n+\t\t\t\tonYearSelected={this.onYearSelected}","path":"packages/components/src/DateTimePickers/DateTimePicker/DateTimePicker.component.js","position":65,"original_position":65,"commit_id":"e336cfa9477b4be4a91c97406794c2a43ae58ff6","original_commit_id":"1a0e9ed34249178925657e1b26b5d724a12c5934","user":{"login":"jdescottes-talend","id":38074242,"node_id":"MDQ6VXNlcjM4MDc0MjQy","avatar_url":"https://avatars1.githubusercontent.com/u/38074242?v=4","gravatar_id":"","url":"https://api.github.com/users/jdescottes-talend","html_url":"https://github.com/jdescottes-talend","followers_url":"https://api.github.com/users/jdescottes-talend/followers","following_url":"https://api.github.com/users/jdescottes-talend/following{/other_user}","gists_url":"https://api.github.com/users/jdescottes-talend/gists{/gist_id}","starred_url":"https://api.github.com/users/jdescottes-talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdescottes-talend/subscriptions","organizations_url":"https://api.github.com/users/jdescottes-talend/orgs","repos_url":"https://api.github.com/users/jdescottes-talend/repos","events_url":"https://api.github.com/users/jdescottes-talend/events{/privacy}","received_events_url":"https://api.github.com/users/jdescottes-talend/received_events","type":"User","site_admin":false},"body":"✓","created_at":"2018-06-21T15:06:01Z","updated_at":"2018-06-21T15:06:01Z","html_url":"https://github.com/Talend/ui/pull/1470#discussion_r197169044","pull_request_url":"https://api.github.com/repos/Talend/ui/pulls/1470","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Talend/ui/pulls/comments/197169044"},"html":{"href":"https://github.com/Talend/ui/pull/1470#discussion_r197169044"},"pull_request":{"href":"https://api.github.com/repos/Talend/ui/pulls/1470"}},"in_reply_to_id":196744828},"pull_request":{"url":"https://api.github.com/repos/Talend/ui/pulls/1470","id":195875878,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1ODc1ODc4","html_url":"https://github.com/Talend/ui/pull/1470","diff_url":"https://github.com/Talend/ui/pull/1470.diff","patch_url":"https://github.com/Talend/ui/pull/1470.patch","issue_url":"https://api.github.com/repos/Talend/ui/issues/1470","number":1470,"state":"open","locked":false,"title":"feat(components/date picker): calendar selection","user":{"login":"jdescottes-talend","id":38074242,"node_id":"MDQ6VXNlcjM4MDc0MjQy","avatar_url":"https://avatars1.githubusercontent.com/u/38074242?v=4","gravatar_id":"","url":"https://api.github.com/users/jdescottes-talend","html_url":"https://github.com/jdescottes-talend","followers_url":"https://api.github.com/users/jdescottes-talend/followers","following_url":"https://api.github.com/users/jdescottes-talend/following{/other_user}","gists_url":"https://api.github.com/users/jdescottes-talend/gists{/gist_id}","starred_url":"https://api.github.com/users/jdescottes-talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdescottes-talend/subscriptions","organizations_url":"https://api.github.com/users/jdescottes-talend/orgs","repos_url":"https://api.github.com/users/jdescottes-talend/repos","events_url":"https://api.github.com/users/jdescottes-talend/events{/privacy}","received_events_url":"https://api.github.com/users/jdescottes-talend/received_events","type":"User","site_admin":false},"body":"**What is the problem this PR is trying to solve?**\r\nWidget interaction to get the month and year on which the calendar (final date picker) will be based.\r\n\r\n**What is the chosen solution to this problem?**\r\nDOING IT !\r\n\r\n**Please check if the PR fulfills these requirements**\r\n\r\n* [x] The PR commit message follows our [guidelines](https://github.com/talend/tools/blob/master/tools-root-github/CONTRIBUTING.md)\r\n* [x] Tests for the changes have been added (for bug fixes / features) And [non reg](./screenshots.md) done before need review\r\n* [ ] Docs have been added / updated (for bug fixes / features)\r\n* [ ] Related design / discussions / pages (not in jira), if any, are all linked or available in the PR\r\n\r\n<!-- You can add more checkboxes here -->\r\n\r\n**[ ] This PR introduces a breaking change**\r\n\r\n<!-- if the PR introduces a breaking change, add the description here. So when you merge this PR, add this description into the [breaking change wiki](https://github.com/Talend/ui/wiki/BREAKING-CHANGE) in the next version -->\r\n\r\n<!-- **Original Template** -->\r\n\r\n<!-- https://github.com/Talend/tools/blob/master/tools-root-github/.github/PULL_REQUEST_TEMPLATE.md -->\r\n","created_at":"2018-06-19T15:52:59Z","updated_at":"2018-06-21T15:06:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b3c35281109ecd3dba1c123932e81a6e02235b8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Talend/ui/pulls/1470/commits","review_comments_url":"https://api.github.com/repos/Talend/ui/pulls/1470/comments","review_comment_url":"https://api.github.com/repos/Talend/ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Talend/ui/issues/1470/comments","statuses_url":"https://api.github.com/repos/Talend/ui/statuses/e336cfa9477b4be4a91c97406794c2a43ae58ff6","head":{"label":"Talend:jdescottes/feat/date-picker_calendar-selection","ref":"jdescottes/feat/date-picker_calendar-selection","sha":"e336cfa9477b4be4a91c97406794c2a43ae58ff6","user":{"login":"Talend","id":459687,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1OTY4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"repo":{"id":79343946,"node_id":"MDEwOlJlcG9zaXRvcnk3OTM0Mzk0Ng==","name":"ui","full_name":"Talend/ui","owner":{"login":"Talend","id":459687,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1OTY4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Talend/ui","description":"Talend's unified web UI repository.","fork":false,"url":"https://api.github.com/repos/Talend/ui","forks_url":"https://api.github.com/repos/Talend/ui/forks","keys_url":"https://api.github.com/repos/Talend/ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Talend/ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Talend/ui/teams","hooks_url":"https://api.github.com/repos/Talend/ui/hooks","issue_events_url":"https://api.github.com/repos/Talend/ui/issues/events{/number}","events_url":"https://api.github.com/repos/Talend/ui/events","assignees_url":"https://api.github.com/repos/Talend/ui/assignees{/user}","branches_url":"https://api.github.com/repos/Talend/ui/branches{/branch}","tags_url":"https://api.github.com/repos/Talend/ui/tags","blobs_url":"https://api.github.com/repos/Talend/ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Talend/ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Talend/ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/Talend/ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Talend/ui/statuses/{sha}","languages_url":"https://api.github.com/repos/Talend/ui/languages","stargazers_url":"https://api.github.com/repos/Talend/ui/stargazers","contributors_url":"https://api.github.com/repos/Talend/ui/contributors","subscribers_url":"https://api.github.com/repos/Talend/ui/subscribers","subscription_url":"https://api.github.com/repos/Talend/ui/subscription","commits_url":"https://api.github.com/repos/Talend/ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/Talend/ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/Talend/ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/Talend/ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/Talend/ui/contents/{+path}","compare_url":"https://api.github.com/repos/Talend/ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Talend/ui/merges","archive_url":"https://api.github.com/repos/Talend/ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Talend/ui/downloads","issues_url":"https://api.github.com/repos/Talend/ui/issues{/number}","pulls_url":"https://api.github.com/repos/Talend/ui/pulls{/number}","milestones_url":"https://api.github.com/repos/Talend/ui/milestones{/number}","notifications_url":"https://api.github.com/repos/Talend/ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Talend/ui/labels{/name}","releases_url":"https://api.github.com/repos/Talend/ui/releases{/id}","deployments_url":"https://api.github.com/repos/Talend/ui/deployments","created_at":"2017-01-18T13:45:58Z","updated_at":"2018-06-21T14:51:26Z","pushed_at":"2018-06-21T15:03:09Z","git_url":"git://github.com/Talend/ui.git","ssh_url":"git@github.com:Talend/ui.git","clone_url":"https://github.com/Talend/ui.git","svn_url":"https://github.com/Talend/ui","homepage":"http://talend.surge.sh","size":30055,"stargazers_count":55,"watchers_count":55,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":60,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":18,"open_issues":60,"watchers":55,"default_branch":"master"}},"base":{"label":"Talend:jdescottes/feat/date-picker","ref":"jdescottes/feat/date-picker","sha":"62a744c25988bdf5e0ec5f0f9611051caac31592","user":{"login":"Talend","id":459687,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1OTY4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"repo":{"id":79343946,"node_id":"MDEwOlJlcG9zaXRvcnk3OTM0Mzk0Ng==","name":"ui","full_name":"Talend/ui","owner":{"login":"Talend","id":459687,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1OTY4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/459687?v=4","gravatar_id":"","url":"https://api.github.com/users/Talend","html_url":"https://github.com/Talend","followers_url":"https://api.github.com/users/Talend/followers","following_url":"https://api.github.com/users/Talend/following{/other_user}","gists_url":"https://api.github.com/users/Talend/gists{/gist_id}","starred_url":"https://api.github.com/users/Talend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Talend/subscriptions","organizations_url":"https://api.github.com/users/Talend/orgs","repos_url":"https://api.github.com/users/Talend/repos","events_url":"https://api.github.com/users/Talend/events{/privacy}","received_events_url":"https://api.github.com/users/Talend/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Talend/ui","description":"Talend's unified web UI repository.","fork":false,"url":"https://api.github.com/repos/Talend/ui","forks_url":"https://api.github.com/repos/Talend/ui/forks","keys_url":"https://api.github.com/repos/Talend/ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Talend/ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Talend/ui/teams","hooks_url":"https://api.github.com/repos/Talend/ui/hooks","issue_events_url":"https://api.github.com/repos/Talend/ui/issues/events{/number}","events_url":"https://api.github.com/repos/Talend/ui/events","assignees_url":"https://api.github.com/repos/Talend/ui/assignees{/user}","branches_url":"https://api.github.com/repos/Talend/ui/branches{/branch}","tags_url":"https://api.github.com/repos/Talend/ui/tags","blobs_url":"https://api.github.com/repos/Talend/ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Talend/ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Talend/ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/Talend/ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Talend/ui/statuses/{sha}","languages_url":"https://api.github.com/repos/Talend/ui/languages","stargazers_url":"https://api.github.com/repos/Talend/ui/stargazers","contributors_url":"https://api.github.com/repos/Talend/ui/contributors","subscribers_url":"https://api.github.com/repos/Talend/ui/subscribers","subscription_url":"https://api.github.com/repos/Talend/ui/subscription","commits_url":"https://api.github.com/repos/Talend/ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/Talend/ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/Talend/ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/Talend/ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/Talend/ui/contents/{+path}","compare_url":"https://api.github.com/repos/Talend/ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Talend/ui/merges","archive_url":"https://api.github.com/repos/Talend/ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Talend/ui/downloads","issues_url":"https://api.github.com/repos/Talend/ui/issues{/number}","pulls_url":"https://api.github.com/repos/Talend/ui/pulls{/number}","milestones_url":"https://api.github.com/repos/Talend/ui/milestones{/number}","notifications_url":"https://api.github.com/repos/Talend/ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Talend/ui/labels{/name}","releases_url":"https://api.github.com/repos/Talend/ui/releases{/id}","deployments_url":"https://api.github.com/repos/Talend/ui/deployments","created_at":"2017-01-18T13:45:58Z","updated_at":"2018-06-21T14:51:26Z","pushed_at":"2018-06-21T15:03:09Z","git_url":"git://github.com/Talend/ui.git","ssh_url":"git@github.com:Talend/ui.git","clone_url":"https://github.com/Talend/ui.git","svn_url":"https://github.com/Talend/ui","homepage":"http://talend.surge.sh","size":30055,"stargazers_count":55,"watchers_count":55,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":60,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":18,"open_issues":60,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Talend/ui/pulls/1470"},"html":{"href":"https://github.com/Talend/ui/pull/1470"},"issue":{"href":"https://api.github.com/repos/Talend/ui/issues/1470"},"comments":{"href":"https://api.github.com/repos/Talend/ui/issues/1470/comments"},"review_comments":{"href":"https://api.github.com/repos/Talend/ui/pulls/1470/comments"},"review_comment":{"href":"https://api.github.com/repos/Talend/ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Talend/ui/pulls/1470/commits"},"statuses":{"href":"https://api.github.com/repos/Talend/ui/statuses/e336cfa9477b4be4a91c97406794c2a43ae58ff6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jdescottes-talend"}}