From 31248336f7ec0ed3edd366c01a24c946d7cef647 Mon Sep 17 00:00:00 2001 From: Sendou Date: Mon, 9 Mar 2020 15:44:26 +0200 Subject: [PATCH] random fixes --- .../src/components/freeagents/Posts.tsx | 10 +- .../src/components/user/BuildFormModal.tsx | 129 ++++++++++-------- .../src/components/user/ProfileModal.tsx | 7 +- graphql-schemas/build.js | 8 +- 4 files changed, 83 insertions(+), 71 deletions(-) diff --git a/frontend-react/src/components/freeagents/Posts.tsx b/frontend-react/src/components/freeagents/Posts.tsx index 00a97dfc4..d35dca664 100644 --- a/frontend-react/src/components/freeagents/Posts.tsx +++ b/frontend-react/src/components/freeagents/Posts.tsx @@ -20,11 +20,7 @@ const Posts: React.FC = ({ posts }) => { } return ( <> - + setAgentsToShow(page * 10)} @@ -33,7 +29,9 @@ const Posts: React.FC = ({ posts }) => { {posts .filter((post, index) => index < agentsToShow) .map(post => ( - + + + ))} diff --git a/frontend-react/src/components/user/BuildFormModal.tsx b/frontend-react/src/components/user/BuildFormModal.tsx index a983d8d7e..af1ffd291 100644 --- a/frontend-react/src/components/user/BuildFormModal.tsx +++ b/frontend-react/src/components/user/BuildFormModal.tsx @@ -267,26 +267,29 @@ const BuildFormModal: React.FC = ({ )} - { + if ( + (!build.headgear || + build.headgear.every(ability => ability === "UNKNOWN")) && + existingGear.hasOwnProperty(headgearItem) + ) { + handleChange({ + headgearItem, + headgear: existingGear[headgearItem], + }) + } else { + handleChange({ headgearItem }) + } + }} + /> + {build.headgearItem && ( @@ -294,26 +297,29 @@ const BuildFormModal: React.FC = ({ )} - { + if ( + (!build.clothing || + build.clothing.every(ability => ability === "UNKNOWN")) && + existingGear.hasOwnProperty(clothingItem) + ) { + handleChange({ + clothingItem, + clothing: existingGear[clothingItem], + }) + } else { + handleChange({ clothingItem }) + } + }} + /> + {build.clothingItem && ( @@ -321,26 +327,29 @@ const BuildFormModal: React.FC = ({ )} - { + if ( + (!build.shoes || + build.shoes.every(ability => ability === "UNKNOWN")) && + existingGear.hasOwnProperty(shoesItem) + ) { + handleChange({ + shoesItem, + shoes: existingGear[shoesItem], + }) + } else { + handleChange({ shoesItem }) + } + }} + /> + {build.shoesItem && ( diff --git a/frontend-react/src/components/user/ProfileModal.tsx b/frontend-react/src/components/user/ProfileModal.tsx index b085a43a3..77a296307 100644 --- a/frontend-react/src/components/user/ProfileModal.tsx +++ b/frontend-react/src/components/user/ProfileModal.tsx @@ -39,7 +39,11 @@ const ProfileModal: React.FC = ({ const toast = useToast() useEffect(() => { - if (profile.motion_sens !== null && !profile.stick_sens) { + if ( + profile.motion_sens !== null && + !profile.stick_sens && + profile.stick_sens !== 0 + ) { setError("Motion sensitivity entered without stick sensitivity") } else if (profile.custom_url && profile.custom_url.length < 2) { setError("Custom URL has to be over 2 characters long") @@ -110,6 +114,7 @@ const ProfileModal: React.FC = ({