mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 06:10:22 +00:00
* deps: added mongoose * feat(*): added mongo and saving invited count * chore(env): updated mongo configuration * chore: updated next-env.d.ts * chore(*): changed categories to botCategories * chore(Image): maded image component * feat(ServerCard): added ServerCard component * feat(ServerIcon): added ServerIcon component * feat(Tools): added server related functions * feat(Mongo): added serverSchema * chore(Hero): support serverlist * feat(Owner): added crown * feat(icons): added icons api * feat(Yup): added AddServerSubmitSchema * types: added server related types * chore(BotCard): changed bot category link * chore(Hero): changed category links * feat(ServerCard): added unreachable state display * feat(Yup): added ManageServerSchema * feat(Query): added server related queries * feat(Constants): added server related stuffs * types: added updatedAt field for ServerData * feat(pages/servers/*): added server pages * feat(*): moved bot category rotue * typo: fixed typo issue * feat(pages/addserver/*): added add server page * feat(api/servers): added server related api * feat(pages/servers): added server edit page * feat(pages/bots): changed bot list route * feat(*): server categories * feat(pages/users): added owned server list * chore(pages/bots): changed image size * feat(docker-compose): added bot * ci: made some changes * types: fixed type * types(Search): fixed type * types(*): fixed type * fix(*): missing fields * fix: Hero type typo issue * ci(*): missing sentry org slug * ci(*): fix * feat(*): added and changed search pages * Update pages/addserver/[id].tsx Co-authored-by: Ryu JuHeon <saidbysolo@gmail.com> * feat(api/search): added servers search api * feat(pages/panel): added server list in manage page * feat(Search): supporting server search at SearchBox * feat(pages/apllications/servers): added server application page * chore(docker-compose): changed image link * chore(utils): removing server cache at submit * chore(image/icons): added debug code * chore(*): changed component names * chore(Query): decreased server cache ttl * fix(Query): error on addserver page close: https://github.com/koreanbots/serverlist-testing/issues/10 * fix(Query): not using vote type close: https://github.com/koreanbots/serverlist-testing/issues/9 * fix(Constants): fixed category unexpected char close: https://github.com/koreanbots/serverlist-testing/issues/8 * fix(Query): serialize server data * fix(Query): returning null on boost level 0 * fix(page/servers): displaying n/a on boostTier null close: https://github.com/koreanbots/serverlist-testing/issues/4 * fix(pages/servers): hiding emoji list if no emoji close: https://github.com/koreanbots/serverlist-testing/issues/1 * typo(pages/servers): bot to server close: https://github.com/koreanbots/serverlist-testing/issues/2 * fix(components/Hero): editing vote list link close: https://github.com/koreanbots/serverlist-testing/issues/11 * chore(*): changed list route * feat(pages/servers/list/votes): added server vote list page close: https://github.com/koreanbots/serverlist-testing/issues/12 * feat(Dockerfile): added pre-build * fix(Image): image broken when fallbackSrc not given close: https://github.com/koreanbots/serverlist-testing/issues/5 * ci: checking out submodules * fix(ServerCard): bot category displayed at ServerCard close: https://github.com/koreanbots/serverlist-testing/issues/16 * feat(*): supporting opengraph image for server * fix(utils/Constants): fixed type missing on og * feat(pages/servers): not forcing emoji width * chore(utils/Yup): fixed agree checkbox error message * typo(utils/Yup): fixed bot to server * feat(pages/servers): improved emoji display * chore(api/images/discord/icons): removed debug code * chore(pages/servers): removed crown for owner close: https://github.com/koreanbots/serverlist-testing/issues/19 * fix(utils/Query): returning date as string close: https://github.com/koreanbots/serverlist-testing/issues/23 * fix(ServerCard): changed manage link from bot manage link * fix(ServerCard): same height for every card * chore: removed debug code * chore(pages/addserver): showing as invite for server kicked bot * typo(*): fixed typo issues * types: added nullable type * feat(Navbar): added list menu * chore: showing warning for server data not fetched * chore: changed main page (combined bots and servers) * typo(*): replace '한국 디스코드봇 리스트' with '한국 디스코드 리스트' * chore: added Hero component combined state * typo: changed name * fix(Navbar): fix link href * typo: fix about page for serverlist * chore: decrease font size * fix: server category tag link * fix: bot category link * feat: added server widget * fix(ServerCard): fixed servername overflowing * chore: forcing re-login when discord server data fetch fails * fix: error causing on owner not registered * fix: making state same for join button * fix: filtering owner if null * fix(servers/[id]): fix error causing if owner is null * fix(addserver): fixed error occuring for users not logged in * fix(Constant): fixed og image extension getting popped * typo: fixed typo issue * fix: showing forbidden page for non-owner users * feat: invite guide for server which bot left * fix: invalid path for paginator on bot page Co-authored-by: Hajin Lim <zero734kr@gmail.com> Co-authored-by: Ryu JuHeon <saidbysolo@gmail.com>
123 lines
4.1 KiB
TypeScript
123 lines
4.1 KiB
TypeScript
import Link from 'next/link'
|
|
import dynamic from 'next/dynamic'
|
|
|
|
import { checkBotFlag, formatNumber, makeBotURL } from '@utils/Tools'
|
|
import { Status } from '@utils/Constants'
|
|
import { Bot } from '@types'
|
|
|
|
const Divider = dynamic(() => import('@components/Divider'))
|
|
const Tag = dynamic(() => import('@components/Tag'))
|
|
const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar'))
|
|
|
|
const BotCard: React.FC<BotCardProps> = ({ manage = false, bot }) => {
|
|
return <div className='container mb-16 transform hover:-translate-y-1 transition duration-100 ease-in cursor-pointer'>
|
|
<div className='relative'>
|
|
<div className='container mx-auto'>
|
|
<div className='h-full'>
|
|
<div
|
|
className='relative mx-auto h-full text-black dark:text-white dark:bg-discord-black bg-little-white rounded-2xl shadow-xl'
|
|
style={
|
|
checkBotFlag(bot.flags, 'trusted') && bot.banner
|
|
? {
|
|
background: `linear-gradient(to right, rgba(34, 36, 38, 0.68), rgba(34, 36, 38, 0.68)), url("${bot.banner}") center top / cover no-repeat`,
|
|
color: 'white',
|
|
}
|
|
: {}
|
|
}
|
|
>
|
|
<Link href={makeBotURL(bot)}>
|
|
<div>
|
|
<div className='flex h-44'>
|
|
<div className='w-3/5'>
|
|
<div className='flex justify-start'>
|
|
<DiscordAvatar
|
|
size={128}
|
|
userID={bot.id}
|
|
alt='Avatar'
|
|
className='absolute -left-2 -top-8 mx-auto w-32 h-32 bg-white rounded-full'
|
|
/>
|
|
</div>
|
|
|
|
<div className='mt-28 px-4'>
|
|
<h2 className='px-1 text-sm'>
|
|
<i className={`fas fa-circle text-${Status[bot.status]?.color}`} />
|
|
{Status[bot.status]?.text}
|
|
</h2>
|
|
<h1 className='mb-3 text-left text-2xl font-bold truncate'>{bot.name}</h1>
|
|
</div>
|
|
</div>
|
|
<div className='grid grid-cols-1 pr-5 py-5 w-2/5 h-0'>
|
|
<Tag
|
|
text={
|
|
<>
|
|
<i className='fas fa-heart text-red-600' /> {formatNumber(bot.votes)}
|
|
</>
|
|
}
|
|
dark
|
|
/>
|
|
<Tag
|
|
blurple
|
|
text={bot.servers ? <>{formatNumber(bot.servers)} 서버</> : 'N/A'}
|
|
dark
|
|
/>
|
|
</div>
|
|
</div>
|
|
<p className='mb-10 px-4 h-6 text-left text-gray-400 text-sm font-medium'>
|
|
{bot.intro}
|
|
</p>
|
|
<div>
|
|
<div className='category flex flex-wrap px-2'>
|
|
{bot.category.slice(0, 3).map(el => (
|
|
<Tag key={el} text={el} href={`/bots/categories/${el}`} dark />
|
|
))}{' '}
|
|
{bot.category.length > 3 && <Tag text={`+${bot.category.length - 3}`} dark />}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Link>
|
|
<Divider />
|
|
<div className='w-full'>
|
|
<div className='flex justify-evenly'>
|
|
<Link href={makeBotURL(bot)}>
|
|
<a className='py-3 w-full text-center text-koreanbots-blue hover:text-white text-sm font-bold hover:bg-koreanbots-blue rounded-bl-2xl hover:shadow-lg transition duration-100 ease-in'>
|
|
보기
|
|
</a>
|
|
</Link>
|
|
{manage ? (
|
|
<Link href={`/bots/${bot.id}/edit`}>
|
|
<a className='py-3 w-full text-center text-green-500 hover:text-white text-sm font-bold hover:bg-green-500 rounded-br-2xl hover:shadow-lg transition duration-100 ease-in'>
|
|
관리하기
|
|
</a>
|
|
</Link>
|
|
) : bot.state !== 'ok' ? <a
|
|
className='py-3 w-full text-center text-discord-blurple text-sm font-bold rounded-br-2xl hover:shadow-lg transition duration-100 ease-in opacity-50 cursor-default select-none'
|
|
>
|
|
초대하기
|
|
</a> :
|
|
<a
|
|
href={
|
|
makeBotURL(bot) + '/invite'
|
|
}
|
|
rel='noopener noreferrer'
|
|
target='_blank'
|
|
className='py-3 w-full text-center text-discord-blurple hover:text-white text-sm font-bold hover:bg-discord-blurple rounded-br-2xl hover:shadow-lg transition duration-100 ease-in'
|
|
>
|
|
초대하기
|
|
</a>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
}
|
|
|
|
interface BotCardProps {
|
|
manage?: boolean
|
|
bot: Bot
|
|
}
|
|
|
|
export default BotCard |