From 671287be89ddff1ef8c255899559c0f8445c9b84 Mon Sep 17 00:00:00 2001 From: Sendou Date: Sat, 7 Mar 2020 17:37:12 +0200 Subject: [PATCH 1/4] tournaments progress --- frontend-react/package-lock.json | 24 ++-- frontend-react/package.json | 4 +- .../src/components/elements/Input.tsx | 4 +- .../src/components/elements/Select.tsx | 2 +- .../tournaments/TournamentDetailsPage.tsx | 2 +- .../tournaments/TournamentFilters.tsx | 115 ++++++++++++++++-- .../tournaments/TournamentsPage.tsx | 114 +++++++++++++---- .../src/components/xsearch/Top500Forms.tsx | 6 +- .../graphql/queries/searchForTournaments.ts | 4 + frontend-react/src/utils/lists.ts | 26 ++++ graphql-schemas/tournament.js | 20 ++- package-lock.json | 6 +- package.json | 2 +- 13 files changed, 267 insertions(+), 62 deletions(-) diff --git a/frontend-react/package-lock.json b/frontend-react/package-lock.json index 697b173ef..ffd20da99 100644 --- a/frontend-react/package-lock.json +++ b/frontend-react/package-lock.json @@ -2100,9 +2100,9 @@ } }, "@types/jest": { - "version": "25.1.3", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz", - "integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==", + "version": "25.1.4", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.4.tgz", + "integrity": "sha512-QDDY2uNAhCV7TMCITrxz+MRk1EizcsevzfeS6LykIlq2V1E5oO4wXG8V2ZEd9w7Snxeeagk46YbMgZ8ESHx3sw==", "requires": { "jest-diff": "^25.1.0", "pretty-format": "^25.1.0" @@ -2120,9 +2120,9 @@ } }, "@types/yargs": { - "version": "15.0.3", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.3.tgz", - "integrity": "sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ==", + "version": "15.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz", + "integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==", "requires": { "@types/yargs-parser": "*" } @@ -2216,9 +2216,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "13.7.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.7.tgz", - "integrity": "sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==" + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz", + "integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==" }, "@types/parse-json": { "version": "4.0.0", @@ -2624,9 +2624,9 @@ } }, "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==" }, "acorn-globals": { "version": "4.3.4", diff --git a/frontend-react/package.json b/frontend-react/package.json index bfdc97d51..d4fc6f75f 100644 --- a/frontend-react/package.json +++ b/frontend-react/package.json @@ -13,8 +13,8 @@ "@testing-library/jest-dom": "^5.1.1", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^10.0.0", - "@types/jest": "^25.1.3", - "@types/node": "^13.7.7", + "@types/jest": "^25.1.4", + "@types/node": "^13.9.0", "@types/reach__router": "^1.3.0", "@types/react": "^16.9.23", "@types/react-color": "^3.0.1", diff --git a/frontend-react/src/components/elements/Input.tsx b/frontend-react/src/components/elements/Input.tsx index 00e7c6719..1da36a573 100644 --- a/frontend-react/src/components/elements/Input.tsx +++ b/frontend-react/src/components/elements/Input.tsx @@ -35,7 +35,7 @@ const Input: React.FC = ({ setValue(event.target.value) return ( - <> + {label && } {textLeft && {textLeft}} @@ -57,7 +57,7 @@ const Input: React.FC = ({ {(value ?? "").length}/{limit} )} - + ) } diff --git a/frontend-react/src/components/elements/Select.tsx b/frontend-react/src/components/elements/Select.tsx index b14bfb330..d50821144 100644 --- a/frontend-react/src/components/elements/Select.tsx +++ b/frontend-react/src/components/elements/Select.tsx @@ -90,7 +90,7 @@ const Select: React.FC = ({ } return ( - + {label && } void + handleClear: () => void + onSubmit: () => void +} -const TournamentFilters: React.FC = ({}) => { +const TournamentFilters: React.FC = ({ + forms, + handleChange, + handleClear, + onSubmit, +}) => { + const { themeColor } = useContext(MyThemeContext) const [show, setShow] = useState(true) return ( <> @@ -12,9 +38,84 @@ const TournamentFilters: React.FC = ({}) => { {show ? "Hide filters" : "Show filters"} - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus - terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer - labore wes anderson cred nesciunt sapiente ea proident. + + + handleChange({ tournament_name: value }) + } + /> + handleChange({ team_name: value })} + /> + handleChange({ player_name: value })} + /> + handleChange({ comp: value })} + isMulti + /> + = () => { /> )} - + { - if ( - (!build.headgear || - build.headgear.every(ability => ability === "UNKNOWN")) && - existingGear.hasOwnProperty(headgearItem) - ) { - handleChange({ - headgearItem, - headgear: existingGear[headgearItem], - }) - } else { - handleChange({ headgearItem }) - } - }} - /> + + { - if ( - (!build.clothing || - build.clothing.every(ability => ability === "UNKNOWN")) && - existingGear.hasOwnProperty(clothingItem) - ) { - handleChange({ - clothingItem, - clothing: existingGear[clothingItem], - }) - } else { - handleChange({ clothingItem }) - } - }} - /> + + { - if ( - (!build.shoes || - build.shoes.every(ability => ability === "UNKNOWN")) && - existingGear.hasOwnProperty(shoesItem) - ) { - handleChange({ - shoesItem, - shoes: existingGear[shoesItem], - }) - } else { - handleChange({ shoesItem }) - } - }} - /> + + { if (!ctx.user) throw new AuthenticationError("Not logged in.") - if (args.title) + if (args.title) { if (args.title.length > 100) throw new UserInputError("Title too long.", { invalidArgs: args, }) - else { - args.title = undefined - } + } else { + args.title = undefined + } if (args.description) { if (args.description.length > 1000)