diff --git a/components/common/SubTextCollapse.tsx b/components/common/SubTextCollapse.tsx index 5da193954..bbfea4d23 100644 --- a/components/common/SubTextCollapse.tsx +++ b/components/common/SubTextCollapse.tsx @@ -16,8 +16,8 @@ const SubTextCollapse: React.FC = ({ }) => { const [isOpen, setIsOpen] = useState(isOpenByDefault); return ( - <> - setIsOpen(!isOpen)} {...props} cursor="pointer"> + + setIsOpen(!isOpen)} cursor="pointer" mb={2}> {isOpen ? "▼" : "►"} @@ -26,7 +26,7 @@ const SubTextCollapse: React.FC = ({ {isOpen && <>{children}} - + ); }; diff --git a/pages/freeagents.tsx b/pages/freeagents.tsx index 9f5cd1489..4f0be84ef 100644 --- a/pages/freeagents.tsx +++ b/pages/freeagents.tsx @@ -1,15 +1,26 @@ -import { Box, Button, Divider } from "@chakra-ui/react"; +import { Box, Button, Divider, Flex } from "@chakra-ui/react"; import { t, Trans } from "@lingui/macro"; import Breadcrumbs from "components/common/Breadcrumbs"; import Markdown from "components/common/Markdown"; import MyContainer from "components/common/MyContainer"; +import MyLink from "components/common/MyLink"; +import SubText from "components/common/SubText"; import SubTextCollapse from "components/common/SubTextCollapse"; import UserAvatar from "components/common/UserAvatar"; +import WeaponImage from "components/common/WeaponImage"; import FAModal from "components/freeagents/FAModal"; +import { countries, getEmojiFlag } from "countries-list"; import { useFreeAgents } from "hooks/freeagents"; import { Unpacked } from "lib/types"; +import { useMyTheme } from "lib/useMyTheme"; import { GetAllFreeAgentPostsData } from "prisma/queries/getAllFreeAgentPosts"; import { useState } from "react"; +import { + RiAnchorLine, + RiMicFill, + RiPaintLine, + RiSwordLine, +} from "react-icons/ri"; const FreeAgentsPage = () => { const { data, usersPost } = useFreeAgents(); @@ -29,16 +40,87 @@ const FreeAgentsPage = () => { ); }; +const playstyleToEmoji = { + FRONTLINE: RiSwordLine, + MIDLINE: RiPaintLine, + BACKLINE: RiAnchorLine, +} as const; + const FreeAgentCard = ({ post, }: { post: Unpacked; }) => { + const { themeColorShade } = useMyTheme(); return ( <> - - - + + + + + {post.user.username}#{post.user.discriminator} + + + + {post.user.profile?.country && ( + + + {getEmojiFlag(post.user.profile.country)}{" "} + + { + Object.entries(countries).find( + ([key]) => key === post.user.profile?.country + )![1].name + } + + )} + + {post.user.profile?.weaponPool.length && ( + + {post.user.profile.weaponPool.map((wpn) => ( + + ))} + + )} + + + {post.playstyles.map((style) => ( + + ))} + + + {post.canVC !== "NO" && ( + + + + {post.canVC === "YES" ? ( + Can VC + ) : ( + Can VC sometimes + )} + + + )} + + {post.user.profile?.bio && ( diff --git a/prisma/queries/getAllFreeAgentPosts.ts b/prisma/queries/getAllFreeAgentPosts.ts index 817a50318..7d493b2cd 100644 --- a/prisma/queries/getAllFreeAgentPosts.ts +++ b/prisma/queries/getAllFreeAgentPosts.ts @@ -24,7 +24,6 @@ export const getAllFreeAgentPosts = async () => weaponPool: true, country: true, bio: true, - twitterName: true, }, }, }, diff --git a/prisma/scripts/seed/user.ts b/prisma/scripts/seed/user.ts index 0735ea980..d558c0844 100644 --- a/prisma/scripts/seed/user.ts +++ b/prisma/scripts/seed/user.ts @@ -6,7 +6,7 @@ const getUsers = (): Prisma.UserCreateArgs["data"][] => { username: "Sendou", discriminator: "4059", discordId: "79237403620945920", - discordAvatar: "f809176af93132c3db5f0a5019e96339", + discordAvatar: "59c321a21f73c18eda69359ccabdc38e", profile: { create: { bio: "My cool bio! Supports markdown too: **bolded**",