mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30: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 { Bot } from '../types'
|
||||||
import { formatNumber } from '@utils/Tools'
|
import { formatNumber, makeBotURL } from '@utils/Tools'
|
||||||
import { Status } from '@utils/Constants'
|
import { Status } from '@utils/Constants'
|
||||||
import Divider from './Divider'
|
import Divider from './Divider'
|
||||||
import Tag from './Tag'
|
import Tag from './Tag'
|
||||||
@ -50,9 +50,7 @@ const BotCard = ({ bot }: BotProps): JSX.Element => {
|
|||||||
<Divider />
|
<Divider />
|
||||||
<div className='flex justify-evenly'>
|
<div className='flex justify-evenly'>
|
||||||
<Link
|
<Link
|
||||||
href={`/bots/${
|
href={makeBotURL(bot)}
|
||||||
(bot.partnered || bot.trusted) && bot.vanity ? bot.vanity : bot.id
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<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'>
|
<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 { NextPageContext } from 'next'
|
||||||
import cookie from 'cookie'
|
import cookie from 'cookie'
|
||||||
|
|
||||||
import { ImageOptions, UserPemissionFlags } from '@types'
|
import { Bot, ImageOptions, UserPemissionFlags } from '@types'
|
||||||
import { KoreanbotsEndPoints, Oauth, perms } from './Constants'
|
import { KoreanbotsEndPoints, Oauth, perms } from './Constants'
|
||||||
import { NextRouter } from 'next/router'
|
import { NextRouter } from 'next/router'
|
||||||
|
|
||||||
@ -27,6 +27,9 @@ export function makeImageURL(root:string, { format='png', size=256 }:ImageOption
|
|||||||
return `${root}.${format}?size=${size}`
|
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() {
|
export function supportsWebP() {
|
||||||
const elem = document.createElement('canvas')
|
const elem = document.createElement('canvas')
|
||||||
if (elem.getContext && elem.getContext('2d')) {
|
if (elem.getContext && elem.getContext('2d')) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user