mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
feat: using makeBotURL function
This commit is contained in:
parent
12dda17c0a
commit
ccc4df6a55
@ -1,5 +1,5 @@
|
||||
import { Bot } from '../types'
|
||||
import { formatNumber } from '@utils/Tools'
|
||||
import { formatNumber, makeBotURL } from '@utils/Tools'
|
||||
import { Status } from '@utils/Constants'
|
||||
import Divider from './Divider'
|
||||
import Tag from './Tag'
|
||||
@ -50,9 +50,7 @@ const BotCard = ({ bot }: BotProps): JSX.Element => {
|
||||
<Divider />
|
||||
<div className='flex justify-evenly'>
|
||||
<Link
|
||||
href={`/bots/${
|
||||
(bot.partnered || bot.trusted) && bot.vanity ? bot.vanity : bot.id
|
||||
}`}
|
||||
href={makeBotURL(bot)}
|
||||
>
|
||||
<a className='rounded-bl-2xl py-3 w-full text-center text-koreanbots-blue hover:text-white text-sm font-bold hover:bg-koreanbots-blue hover:shadow-lg transition duration-100 ease-in'>
|
||||
보기
|
||||
|
||||
@ -2,7 +2,7 @@ import { Readable } from 'stream'
|
||||
import { NextPageContext } from 'next'
|
||||
import cookie from 'cookie'
|
||||
|
||||
import { ImageOptions, UserPemissionFlags } from '@types'
|
||||
import { Bot, ImageOptions, UserPemissionFlags } from '@types'
|
||||
import { KoreanbotsEndPoints, Oauth, perms } from './Constants'
|
||||
import { NextRouter } from 'next/router'
|
||||
|
||||
@ -27,6 +27,9 @@ export function makeImageURL(root:string, { format='png', size=256 }:ImageOption
|
||||
return `${root}.${format}?size=${size}`
|
||||
}
|
||||
|
||||
export function makeBotURL(bot: Bot): string {
|
||||
return `/bots/${(bot.partnered || bot.trusted) && bot.vanity ? bot.vanity : bot.id}`
|
||||
}
|
||||
export function supportsWebP() {
|
||||
const elem = document.createElement('canvas')
|
||||
if (elem.getContext && elem.getContext('2d')) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user