diff --git a/pages/users/[id].tsx b/pages/users/[id].tsx new file mode 100644 index 0000000..2b24471 --- /dev/null +++ b/pages/users/[id].tsx @@ -0,0 +1,83 @@ +import { NextPage, NextPageContext } from 'next' +import { SnowflakeUtil } from 'discord.js' +import { Fetch } from '../../utils' +import { ParsedUrlQuery } from 'querystring' +import NotFound from '../404' +import { Bot, User } from '../../types' +import Container from '../../components/Container' +import SEO from '../../components/SEO' +import DiscordImage from '../../components/DiscordImage' +import Divider from '../../components/Divider' +import BotCard from '../../components/BotCard' +import Tag from '../../components/Tag' +const Users: NextPage = ({ data }) => { + if (!data.id) return + return ( + + +
+
+ +
+
+
+

{data.username}

+ #{data.tag} +
+
+ {data.github && ( + + {data.github} + + } + github + circular + href={`https://github.com/${data.github}`} + /> + )} +
+
+
+ +

제작한 봇

+
+ {(data.bots as Bot[]).map((bot: Bot) => ( + + ))} +
+
+ ) +} + +export const getServerSideProps = async (ctx: Context) => { + const data = await Fetch.user.load(ctx.query.id) + return { props: { data, date: SnowflakeUtil.deconstruct(data.id ?? '0')?.date?.toJSON() } } +} + +interface UserProps { + data: User +} + +interface Context extends NextPageContext { + query: Query +} + +interface Query extends ParsedUrlQuery { + id: string +} + +export default Users