1- 'use client' ;
2-
31import type { MeGuild } from '@chatsift/api' ;
4- import Image from 'next/image ' ;
2+ import { GuildIcon } from '@/components/common/GuildIcon ' ;
53import { SvgAutoModerator } from '@/components/icons/SvgAutoModerator' ;
64import { cn } from '@/utils/util' ;
75
86interface GuildCardProps {
97 readonly data : MeGuild ;
108}
119
12- function getGuildAcronym ( guildName : string ) {
13- return guildName
14- . replaceAll ( "'s " , ' ' )
15- . replaceAll ( / \w + / g, ( substring ) => substring [ 0 ] ! )
16- . replaceAll ( / \s / g, '' ) ;
17- }
18-
1910export default function GuildCard ( { data } : GuildCardProps ) {
2011 const hasBots = data . bots . length > 0 ;
21- const icon = data ?. icon ? `https://cdn.discordapp.com/icons/${ data . id } /${ data . icon } .png` : null ;
2212 const url = hasBots ? `/dashboard/${ data . id } ` : undefined ;
2313
2414 return (
@@ -28,24 +18,7 @@ export default function GuildCard({ data }: GuildCardProps) {
2818 hasBots ? 'bg-[#FFFFFF] dark:bg-[#1C1C21]' : 'group' ,
2919 ) }
3020 >
31- < div className = "flex flex-row items-center" >
32- { icon ? (
33- < a href = { url } >
34- { /* TODO: GuildIcon component */ }
35- < Image
36- alt = "Guild icon"
37- className = "flex h-12 w-12 items-center justify-center rounded-full border-on-secondary bg-on-tertiary dark:border-on-secondary-dark dark:bg-on-tertiary-dark"
38- height = { 48 }
39- src = { icon }
40- width = { 48 }
41- />
42- </ a >
43- ) : (
44- < p className = "flex h-12 w-12 items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-full border-on-secondary bg-on-tertiary after:max-w-[70%] dark:border-on-secondary-dark dark:bg-on-tertiary-dark" >
45- { getGuildAcronym ( data . name ) }
46- </ p >
47- ) }
48- </ div >
21+ < GuildIcon data = { data } hasBots = { hasBots } />
4922 < div className = "flex flex-col gap-1" >
5023 < p className = "w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-lg font-medium text-primary group-hover:hidden dark:text-primary-dark" >
5124 < a href = { url } > { data . name } </ a >
0 commit comments