{"action":"created","comment":{"url":"https://api.github.com/repos/botify-labs/react-components/pulls/comments/29655711","id":29655711,"diff_hunk":"@@ -0,0 +1,104 @@\n+import React, { PropTypes } from 'react/addons';\n+\n+import CompoundFilter from './CompoundFilter';\n+import ButtonSelect from '../inputs/ButtonSelect';\n+\n+import InputMixin from '../../mixins/InputMixin';\n+\n+const OPERATOR_OPTIONS = [\n+  {\n+    id: 'and',\n+    label: 'AND',\n+  },\n+  {\n+    id: 'or',\n+    label: 'OR',\n+  },\n+];\n+\n+const defaultOperator = 'and';\n+\n+const TopCompoundFilter = React.createClass({\n+\n+  displayName: 'TopCompoundFilter',\n+\n+  mixins: [\n+    InputMixin(PropTypes.shape({\n+      // Id of the selected operator in `OPERATOR_OPTIONS`\n+      operatorId: PropTypes.oneOf(OPERATOR_OPTIONS.map((operator) => operator.id)),\n+      // List of the values of the `CompoundFilter` children\n+      compoundFilters: PropTypes.arrayOf(CompoundFilter.PropTypes.value),\n+    })),\n+  ],\n+\n+  propTypes: {\n+    filterInput: PropTypes.func,\n+  },\n+\n+  _handleCompoundFilterChange(idx, value) {\n+    this.requestChange({\n+      compoundFilters: {\n+        [idx]: { $set: value },\n+      },\n+    });\n+  },\n+\n+  _handleAddCompoundFilter() {\n+    this.requestChange({\n+      compoundFilters: {\n+        $push: [\n+          {\n+            operatorId: defaultOperator,\n+            filters: [],\n+          },\n+        ],\n+      },\n+    });\n+  },\n+\n+  _handleRemoveCompoundFilter(idx) {\n+    this.requestChange({\n+      compoundFilters: {\n+        $splice: [[idx, 1]],\n+      },\n+    });\n+  },\n+\n+  render() {\n+    let { filterInput } = this.props;\n+    let { compoundFilters } = this.getValue();\n+\n+    return (\n+      <div className=\"TopCompoundFilter\">\n+        <div className=\"TopCompoundFilter-filters\">\n+          {compoundFilters.map((compoundFilter, idx) => (\n+            <div key={idx} className=\"TopCompoundFilter-filter\">\n+              {/* The first compound filter shouldn't display the operator select, and isn't removable */}\n+              {idx > 0 &&\n+                <ButtonSelect\n+                  className=\"TopCompoundFilter-operatorSelect\"\n+                  options={OPERATOR_OPTIONS}\n+                  valueLink={this.linkValue('operatorId')}\n+                  />\n+              }\n+              <CompoundFilter\n+                filterInput={filterInput}\n+                onRemove={compoundFilters.length > 1 ? this._handleRemoveCompoundFilter.bind(null, idx) : null}","path":"src/components/filters/TopCompoundFilter.jsx","position":86,"original_position":86,"commit_id":"37eab93f4493db550440e2ec02a0d6da8a8fd2c3","original_commit_id":"37eab93f4493db550440e2ec02a0d6da8a8fd2c3","user":{"login":"Morhaus","id":1621758,"avatar_url":"https://avatars.githubusercontent.com/u/1621758?v=3","gravatar_id":"","url":"https://api.github.com/users/Morhaus","html_url":"https://github.com/Morhaus","followers_url":"https://api.github.com/users/Morhaus/followers","following_url":"https://api.github.com/users/Morhaus/following{/other_user}","gists_url":"https://api.github.com/users/Morhaus/gists{/gist_id}","starred_url":"https://api.github.com/users/Morhaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morhaus/subscriptions","organizations_url":"https://api.github.com/users/Morhaus/orgs","repos_url":"https://api.github.com/users/Morhaus/repos","events_url":"https://api.github.com/users/Morhaus/events{/privacy}","received_events_url":"https://api.github.com/users/Morhaus/received_events","type":"User","site_admin":false},"body":"This is what I tried first, the issue with that is that `onRemove`'s prop type is function, and when `compoundFilters.length > 1` is false, `onRemove` will be a boolean, so the proptype validation will fail!","created_at":"2015-05-05T09:54:39Z","updated_at":"2015-05-05T09:54:39Z","html_url":"https://github.com/botify-labs/react-components/pull/47#discussion_r29655711","pull_request_url":"https://api.github.com/repos/botify-labs/react-components/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/comments/29655711"},"html":{"href":"https://github.com/botify-labs/react-components/pull/47#discussion_r29655711"},"pull_request":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/botify-labs/react-components/pulls/47","id":33756084,"html_url":"https://github.com/botify-labs/react-components/pull/47","diff_url":"https://github.com/botify-labs/react-components/pull/47.diff","patch_url":"https://github.com/botify-labs/react-components/pull/47.patch","issue_url":"https://api.github.com/repos/botify-labs/react-components/issues/47","number":47,"state":"open","locked":false,"title":"Feature/filters/#48","user":{"login":"Morhaus","id":1621758,"avatar_url":"https://avatars.githubusercontent.com/u/1621758?v=3","gravatar_id":"","url":"https://api.github.com/users/Morhaus","html_url":"https://github.com/Morhaus","followers_url":"https://api.github.com/users/Morhaus/followers","following_url":"https://api.github.com/users/Morhaus/following{/other_user}","gists_url":"https://api.github.com/users/Morhaus/gists{/gist_id}","starred_url":"https://api.github.com/users/Morhaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morhaus/subscriptions","organizations_url":"https://api.github.com/users/Morhaus/orgs","repos_url":"https://api.github.com/users/Morhaus/repos","events_url":"https://api.github.com/users/Morhaus/events{/privacy}","received_events_url":"https://api.github.com/users/Morhaus/received_events","type":"User","site_admin":false},"body":"#48\r\n\r\nWIP","created_at":"2015-04-21T12:29:45Z","updated_at":"2015-05-05T09:54:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"332940ad5a0ae72364fb7bdf5c84a02ea66f834a","assignee":{"login":"Morhaus","id":1621758,"avatar_url":"https://avatars.githubusercontent.com/u/1621758?v=3","gravatar_id":"","url":"https://api.github.com/users/Morhaus","html_url":"https://github.com/Morhaus","followers_url":"https://api.github.com/users/Morhaus/followers","following_url":"https://api.github.com/users/Morhaus/following{/other_user}","gists_url":"https://api.github.com/users/Morhaus/gists{/gist_id}","starred_url":"https://api.github.com/users/Morhaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morhaus/subscriptions","organizations_url":"https://api.github.com/users/Morhaus/orgs","repos_url":"https://api.github.com/users/Morhaus/repos","events_url":"https://api.github.com/users/Morhaus/events{/privacy}","received_events_url":"https://api.github.com/users/Morhaus/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/botify-labs/react-components/pulls/47/commits","review_comments_url":"https://api.github.com/repos/botify-labs/react-components/pulls/47/comments","review_comment_url":"https://api.github.com/repos/botify-labs/react-components/pulls/comments{/number}","comments_url":"https://api.github.com/repos/botify-labs/react-components/issues/47/comments","statuses_url":"https://api.github.com/repos/botify-labs/react-components/statuses/37eab93f4493db550440e2ec02a0d6da8a8fd2c3","head":{"label":"botify-labs:feature/filters/#819","ref":"feature/filters/#819","sha":"37eab93f4493db550440e2ec02a0d6da8a8fd2c3","user":{"login":"botify-labs","id":2925517,"avatar_url":"https://avatars.githubusercontent.com/u/2925517?v=3","gravatar_id":"","url":"https://api.github.com/users/botify-labs","html_url":"https://github.com/botify-labs","followers_url":"https://api.github.com/users/botify-labs/followers","following_url":"https://api.github.com/users/botify-labs/following{/other_user}","gists_url":"https://api.github.com/users/botify-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/botify-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/botify-labs/subscriptions","organizations_url":"https://api.github.com/users/botify-labs/orgs","repos_url":"https://api.github.com/users/botify-labs/repos","events_url":"https://api.github.com/users/botify-labs/events{/privacy}","received_events_url":"https://api.github.com/users/botify-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":31208059,"name":"react-components","full_name":"botify-labs/react-components","owner":{"login":"botify-labs","id":2925517,"avatar_url":"https://avatars.githubusercontent.com/u/2925517?v=3","gravatar_id":"","url":"https://api.github.com/users/botify-labs","html_url":"https://github.com/botify-labs","followers_url":"https://api.github.com/users/botify-labs/followers","following_url":"https://api.github.com/users/botify-labs/following{/other_user}","gists_url":"https://api.github.com/users/botify-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/botify-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/botify-labs/subscriptions","organizations_url":"https://api.github.com/users/botify-labs/orgs","repos_url":"https://api.github.com/users/botify-labs/repos","events_url":"https://api.github.com/users/botify-labs/events{/privacy}","received_events_url":"https://api.github.com/users/botify-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/botify-labs/react-components","description":"","fork":false,"url":"https://api.github.com/repos/botify-labs/react-components","forks_url":"https://api.github.com/repos/botify-labs/react-components/forks","keys_url":"https://api.github.com/repos/botify-labs/react-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/botify-labs/react-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/botify-labs/react-components/teams","hooks_url":"https://api.github.com/repos/botify-labs/react-components/hooks","issue_events_url":"https://api.github.com/repos/botify-labs/react-components/issues/events{/number}","events_url":"https://api.github.com/repos/botify-labs/react-components/events","assignees_url":"https://api.github.com/repos/botify-labs/react-components/assignees{/user}","branches_url":"https://api.github.com/repos/botify-labs/react-components/branches{/branch}","tags_url":"https://api.github.com/repos/botify-labs/react-components/tags","blobs_url":"https://api.github.com/repos/botify-labs/react-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/botify-labs/react-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/botify-labs/react-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/botify-labs/react-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/botify-labs/react-components/statuses/{sha}","languages_url":"https://api.github.com/repos/botify-labs/react-components/languages","stargazers_url":"https://api.github.com/repos/botify-labs/react-components/stargazers","contributors_url":"https://api.github.com/repos/botify-labs/react-components/contributors","subscribers_url":"https://api.github.com/repos/botify-labs/react-components/subscribers","subscription_url":"https://api.github.com/repos/botify-labs/react-components/subscription","commits_url":"https://api.github.com/repos/botify-labs/react-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/botify-labs/react-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/botify-labs/react-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/botify-labs/react-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/botify-labs/react-components/contents/{+path}","compare_url":"https://api.github.com/repos/botify-labs/react-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/botify-labs/react-components/merges","archive_url":"https://api.github.com/repos/botify-labs/react-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/botify-labs/react-components/downloads","issues_url":"https://api.github.com/repos/botify-labs/react-components/issues{/number}","pulls_url":"https://api.github.com/repos/botify-labs/react-components/pulls{/number}","milestones_url":"https://api.github.com/repos/botify-labs/react-components/milestones{/number}","notifications_url":"https://api.github.com/repos/botify-labs/react-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/botify-labs/react-components/labels{/name}","releases_url":"https://api.github.com/repos/botify-labs/react-components/releases{/id}","created_at":"2015-02-23T12:58:10Z","updated_at":"2015-04-29T16:42:13Z","pushed_at":"2015-05-04T13:52:23Z","git_url":"git://github.com/botify-labs/react-components.git","ssh_url":"git@github.com:botify-labs/react-components.git","clone_url":"https://github.com/botify-labs/react-components.git","svn_url":"https://github.com/botify-labs/react-components","homepage":null,"size":2220,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":2,"default_branch":"devel"}},"base":{"label":"botify-labs:devel","ref":"devel","sha":"0e08cd14bc494229a9b4e258fe4a8af683d71a47","user":{"login":"botify-labs","id":2925517,"avatar_url":"https://avatars.githubusercontent.com/u/2925517?v=3","gravatar_id":"","url":"https://api.github.com/users/botify-labs","html_url":"https://github.com/botify-labs","followers_url":"https://api.github.com/users/botify-labs/followers","following_url":"https://api.github.com/users/botify-labs/following{/other_user}","gists_url":"https://api.github.com/users/botify-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/botify-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/botify-labs/subscriptions","organizations_url":"https://api.github.com/users/botify-labs/orgs","repos_url":"https://api.github.com/users/botify-labs/repos","events_url":"https://api.github.com/users/botify-labs/events{/privacy}","received_events_url":"https://api.github.com/users/botify-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":31208059,"name":"react-components","full_name":"botify-labs/react-components","owner":{"login":"botify-labs","id":2925517,"avatar_url":"https://avatars.githubusercontent.com/u/2925517?v=3","gravatar_id":"","url":"https://api.github.com/users/botify-labs","html_url":"https://github.com/botify-labs","followers_url":"https://api.github.com/users/botify-labs/followers","following_url":"https://api.github.com/users/botify-labs/following{/other_user}","gists_url":"https://api.github.com/users/botify-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/botify-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/botify-labs/subscriptions","organizations_url":"https://api.github.com/users/botify-labs/orgs","repos_url":"https://api.github.com/users/botify-labs/repos","events_url":"https://api.github.com/users/botify-labs/events{/privacy}","received_events_url":"https://api.github.com/users/botify-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/botify-labs/react-components","description":"","fork":false,"url":"https://api.github.com/repos/botify-labs/react-components","forks_url":"https://api.github.com/repos/botify-labs/react-components/forks","keys_url":"https://api.github.com/repos/botify-labs/react-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/botify-labs/react-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/botify-labs/react-components/teams","hooks_url":"https://api.github.com/repos/botify-labs/react-components/hooks","issue_events_url":"https://api.github.com/repos/botify-labs/react-components/issues/events{/number}","events_url":"https://api.github.com/repos/botify-labs/react-components/events","assignees_url":"https://api.github.com/repos/botify-labs/react-components/assignees{/user}","branches_url":"https://api.github.com/repos/botify-labs/react-components/branches{/branch}","tags_url":"https://api.github.com/repos/botify-labs/react-components/tags","blobs_url":"https://api.github.com/repos/botify-labs/react-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/botify-labs/react-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/botify-labs/react-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/botify-labs/react-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/botify-labs/react-components/statuses/{sha}","languages_url":"https://api.github.com/repos/botify-labs/react-components/languages","stargazers_url":"https://api.github.com/repos/botify-labs/react-components/stargazers","contributors_url":"https://api.github.com/repos/botify-labs/react-components/contributors","subscribers_url":"https://api.github.com/repos/botify-labs/react-components/subscribers","subscription_url":"https://api.github.com/repos/botify-labs/react-components/subscription","commits_url":"https://api.github.com/repos/botify-labs/react-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/botify-labs/react-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/botify-labs/react-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/botify-labs/react-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/botify-labs/react-components/contents/{+path}","compare_url":"https://api.github.com/repos/botify-labs/react-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/botify-labs/react-components/merges","archive_url":"https://api.github.com/repos/botify-labs/react-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/botify-labs/react-components/downloads","issues_url":"https://api.github.com/repos/botify-labs/react-components/issues{/number}","pulls_url":"https://api.github.com/repos/botify-labs/react-components/pulls{/number}","milestones_url":"https://api.github.com/repos/botify-labs/react-components/milestones{/number}","notifications_url":"https://api.github.com/repos/botify-labs/react-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/botify-labs/react-components/labels{/name}","releases_url":"https://api.github.com/repos/botify-labs/react-components/releases{/id}","created_at":"2015-02-23T12:58:10Z","updated_at":"2015-04-29T16:42:13Z","pushed_at":"2015-05-04T13:52:23Z","git_url":"git://github.com/botify-labs/react-components.git","ssh_url":"git@github.com:botify-labs/react-components.git","clone_url":"https://github.com/botify-labs/react-components.git","svn_url":"https://github.com/botify-labs/react-components","homepage":null,"size":2220,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":2,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/47"},"html":{"href":"https://github.com/botify-labs/react-components/pull/47"},"issue":{"href":"https://api.github.com/repos/botify-labs/react-components/issues/47"},"comments":{"href":"https://api.github.com/repos/botify-labs/react-components/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/botify-labs/react-components/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/botify-labs/react-components/statuses/37eab93f4493db550440e2ec02a0d6da8a8fd2c3"}}}}