From 667c9c29276385ce5e20113b1406c232bcead377 Mon Sep 17 00:00:00 2001 From: Sendou Date: Fri, 28 Feb 2020 14:34:15 +0200 Subject: [PATCH] unused removed --- .../src/components/common/UserSelector.tsx | 2 - .../src/components/elements/Select.tsx | 2 - .../src/components/plus/SuggestionForm.js | 242 ------------------ .../src/components/plus/VotingHistoryPage.tsx | 7 +- 4 files changed, 2 insertions(+), 251 deletions(-) delete mode 100644 frontend-react/src/components/plus/SuggestionForm.js diff --git a/frontend-react/src/components/common/UserSelector.tsx b/frontend-react/src/components/common/UserSelector.tsx index 6d0c8491d..f051e5dd2 100644 --- a/frontend-react/src/components/common/UserSelector.tsx +++ b/frontend-react/src/components/common/UserSelector.tsx @@ -42,8 +42,6 @@ const UserSelector: React.FC = ({ setValue }) => { /> ) - - return null } export default UserSelector diff --git a/frontend-react/src/components/elements/Select.tsx b/frontend-react/src/components/elements/Select.tsx index 5c13a5289..40aed9549 100644 --- a/frontend-react/src/components/elements/Select.tsx +++ b/frontend-react/src/components/elements/Select.tsx @@ -4,8 +4,6 @@ import MyThemeContext from "../../themeContext" import { SelectComponents } from "react-select/src/components" import Box from "./Box" import Label from "./Label" -import { Flex } from "@chakra-ui/core" -import Button from "./Button" interface SelectProps { options?: diff --git a/frontend-react/src/components/plus/SuggestionForm.js b/frontend-react/src/components/plus/SuggestionForm.js deleted file mode 100644 index 2aa2ff6b0..000000000 --- a/frontend-react/src/components/plus/SuggestionForm.js +++ /dev/null @@ -1,242 +0,0 @@ -import React, { useState } from "react" -import { Message, Image, Icon, Radio, Form, Button } from "semantic-ui-react" -import { Link } from "react-router-dom" -import { useMutation } from "@apollo/react-hooks" - -import UserSearch from "../common/UserSearch" -import TextAreaWithLimit from "../common/TextAreaWithLimit" -import { addSuggestion } from "../../graphql/mutations/addSuggestion" -import { suggestions } from "../../graphql/queries/suggestions" -import { vouches } from "../../graphql/queries/vouches" -import { addVouch } from "../../graphql/mutations/addVouch" -import { userLean } from "../../graphql/queries/userLean" - -const SuggestionForm = ({ - plusServer, - hideForm, - handleSuccess, - handleError, - canSuggest, - canVouch, - canVouchFor, -}) => { - const [selectedUser, setSelectedUser] = useState(null) - const [form, setForm] = useState({ type: !canSuggest ? "VOUCH" : "SUGGEST" }) - - const [addSuggestionMutation] = useMutation(addSuggestion, { - onError: handleError, - onCompleted: () => handleSuccess("Suggestion successfully added."), - refetchQueries: [ - { - query: suggestions, - }, - ], - }) - - const [addVouchMutation] = useMutation(addVouch, { - onError: handleError, - onCompleted: () => - handleSuccess( - "Vouch successfully added. Let them know and send them an invite link to the server!" - ), - refetchQueries: [ - { - query: vouches, - }, - { - query: userLean, - }, - { - query: suggestions, - }, - ], - }) - - const handleSubmit = async event => { - event.preventDefault() - if (form.type === "SUGGEST") { - await addSuggestionMutation({ - variables: { ...form, discord_id: selectedUser.id }, - }) - } else { - await addVouchMutation({ - variables: { ...form, discord_id: selectedUser.id }, - }) - } - } - - return ( - <> - {selectedUser ? ( -
- - - setForm({ type: "SUGGEST" })} - /> - - - setForm({ type: "VOUCH" })} - /> - - - - {form.type === "SUGGEST" &&

Suggesting

} - {form.type === "VOUCH" &&

Vouching

} -
- -
- {selectedUser.image && } - - {selectedUser.title} - - {selectedUser.description && ( - - )} -
-
- - - - setForm({ ...form, server: "ONE" })} - /> - - - setForm({ ...form, server: "TWO" })} - /> - - - - - - If the player doesn't live in either Europe or The Americas you - can choose the region based on who they are playing more often - with. - - - setForm({ ...form, region: "EU" })} - /> - - - setForm({ ...form, region: "NA" })} - /> - - - {form.type === "SUGGEST" && ( - - - - setForm({ ...form, description: value })} - limit={1000} - /> - - - )} - {form.type === "SUGGEST" ? ( - - - You can't edit or delete a suggestion after you have submitted - it. One suggestion per month. - - - ) : ( - - - You can't change or delete a vouch after you have submitted it. - One vouch per player active at any given time. If your vouch - gets kicked in their first voting you may not vouch for the next - 6 months. - - - )} - - - - - - -
- ) : ( - <> - - Note that you can only search for people who have logged in to - sendou.ink at least once - -
- -
-
- -
-
- -
- - )} - - ) -} - -export default SuggestionForm diff --git a/frontend-react/src/components/plus/VotingHistoryPage.tsx b/frontend-react/src/components/plus/VotingHistoryPage.tsx index a27749ccb..15e6e9273 100644 --- a/frontend-react/src/components/plus/VotingHistoryPage.tsx +++ b/frontend-react/src/components/plus/VotingHistoryPage.tsx @@ -5,15 +5,12 @@ import Loading from "../common/Loading" import { USER } from "../../graphql/queries/user" import Error from "../common/Error" import { months } from "../../utils/lists" -//import SummaryLists from "./SummaryLists" -import { Redirect, RouteComponentProps, Link } from "@reach/router" -import { UserLean, UserData } from "../../types" +import { Redirect, RouteComponentProps } from "@reach/router" +import { UserData } from "../../types" import { Flex, Box } from "@chakra-ui/core" import Select from "../elements/Select" import Summaries from "./Summaries" import PageHeader from "../common/PageHeader" -import Button from "../elements/Button" -import { FaHistory } from "react-icons/fa" import { Helmet } from "react-helmet-async" export interface Summary {