random fixes

This commit is contained in:
Sendou
2020-03-09 15:44:26 +02:00
parent 011f75a785
commit 31248336f7
4 changed files with 83 additions and 71 deletions

View File

@@ -20,11 +20,7 @@ const Posts: React.FC<PostsAccordionProps> = ({ posts }) => {
}
return (
<>
<Grid
gridGap="1em"
gridTemplateColumns="repeat(auto-fit, minmax(260px, 1fr))"
mt="1em"
>
<Grid gridTemplateColumns="repeat(auto-fit, minmax(260px, 1fr))" mt="1em">
<InfiniteScroll
pageStart={1}
loadMore={page => setAgentsToShow(page * 10)}
@@ -33,7 +29,9 @@ const Posts: React.FC<PostsAccordionProps> = ({ posts }) => {
{posts
.filter((post, index) => index < agentsToShow)
.map(post => (
<FreeAgentCard key={post.id} post={post} />
<Box my="1em">
<FreeAgentCard key={post.id} post={post} />
</Box>
))}
</InfiniteScroll>
</Grid>

View File

@@ -267,26 +267,29 @@ const BuildFormModal: React.FC<BuildFormModalProps> = ({
)}
<Box asFlex mt="1em" justifyContent="space-between" flexWrap="wrap">
<Box asFlex flexDirection="column" alignItems="center">
<Select
label="Headgear"
options={headSelectOptions}
clearable
value={build.headgearItem}
setValue={(headgearItem: HeadGear) => {
if (
(!build.headgear ||
build.headgear.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(headgearItem)
) {
handleChange({
headgearItem,
headgear: existingGear[headgearItem],
})
} else {
handleChange({ headgearItem })
}
}}
/>
<Box minW="275px">
<Select
label="Headgear"
options={headSelectOptions}
clearable
isSearchable
value={build.headgearItem}
setValue={(headgearItem: HeadGear) => {
if (
(!build.headgear ||
build.headgear.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(headgearItem)
) {
handleChange({
headgearItem,
headgear: existingGear[headgearItem],
})
} else {
handleChange({ headgearItem })
}
}}
/>
</Box>
{build.headgearItem && (
<Box mt="0.5em">
<GearImage englishName={build.headgearItem} />
@@ -294,26 +297,29 @@ const BuildFormModal: React.FC<BuildFormModalProps> = ({
)}
</Box>
<Box asFlex flexDirection="column" alignItems="center">
<Select
label="Clothing"
options={clothingSelectOptions}
clearable
value={build.clothingItem}
setValue={(clothingItem: ClothingGear) => {
if (
(!build.clothing ||
build.clothing.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(clothingItem)
) {
handleChange({
clothingItem,
clothing: existingGear[clothingItem],
})
} else {
handleChange({ clothingItem })
}
}}
/>
<Box minW="275px">
<Select
label="Clothing"
options={clothingSelectOptions}
clearable
isSearchable
value={build.clothingItem}
setValue={(clothingItem: ClothingGear) => {
if (
(!build.clothing ||
build.clothing.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(clothingItem)
) {
handleChange({
clothingItem,
clothing: existingGear[clothingItem],
})
} else {
handleChange({ clothingItem })
}
}}
/>
</Box>
{build.clothingItem && (
<Box mt="0.5em">
<GearImage englishName={build.clothingItem} />
@@ -321,26 +327,29 @@ const BuildFormModal: React.FC<BuildFormModalProps> = ({
)}
</Box>
<Box asFlex flexDirection="column" alignItems="center">
<Select
label="Shoes"
options={shoesSelectOptions}
clearable
value={build.shoesItem}
setValue={(shoesItem: ShoesGear) => {
if (
(!build.shoes ||
build.shoes.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(shoesItem)
) {
handleChange({
shoesItem,
shoes: existingGear[shoesItem],
})
} else {
handleChange({ shoesItem })
}
}}
/>
<Box minW="275px">
<Select
label="Shoes"
options={shoesSelectOptions}
clearable
isSearchable
value={build.shoesItem}
setValue={(shoesItem: ShoesGear) => {
if (
(!build.shoes ||
build.shoes.every(ability => ability === "UNKNOWN")) &&
existingGear.hasOwnProperty(shoesItem)
) {
handleChange({
shoesItem,
shoes: existingGear[shoesItem],
})
} else {
handleChange({ shoesItem })
}
}}
/>
</Box>
{build.shoesItem && (
<Box mt="0.5em">
<GearImage englishName={build.shoesItem} />

View File

@@ -39,7 +39,11 @@ const ProfileModal: React.FC<ProfileModalProps> = ({
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<ProfileModalProps> = ({
<Box mt="1em">
<Select
label="Country"
isSearchable
value={
profile.country
? {

View File

@@ -141,14 +141,14 @@ const resolvers = {
Mutation: {
addBuild: async (root, args, ctx) => {
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)