@@ -7,6 +7,9 @@ import React from 'react'
7
7
import { FaEllipsisVertical } from 'react-icons/fa6'
8
8
import CreateCharacterModal from '@/components/Modals/CreateCharacter'
9
9
import { CharacterCard } from '@/components/layouts/Cards'
10
+ import Avatar from '@/components/Avatar'
11
+ import Checkbox from '@/components/layouts/Forms/Checkbox'
12
+ import { LuEye , LuLock } from 'react-icons/lu'
10
13
11
14
export default function CharactersView ( { characters } : { characters : Character [ ] } ) {
12
15
const [ isCreateModalOpen , setIsCreateModalOpen ] = React . useState ( false )
@@ -25,23 +28,92 @@ export default function CharactersView({ characters }: { characters: Character[]
25
28
</ div >
26
29
}
27
30
>
28
- < div className = "flex flex-1 items-center justify-center min-h-[60vh]" >
29
- { characters . length === 0 ? (
31
+ { characters . length === 0 ? (
32
+
33
+ < div className = "flex flex-1 items-center justify-center min-h-[60vh]" >
30
34
< div className = "flex flex-col items-center text-center" >
31
35
< h1 className = "text-4xl" > No one seems to be around...</ h1 >
32
36
< p className = "text-lg" > Create a character or import through a Toyhouse account to get started!</ p >
33
37
</ div >
34
- ) : (
35
- < div >
36
-
37
- </ div >
38
- ) }
39
- </ div >
38
+ </ div >
39
+
40
+ ) : (
41
+ < table className = "w-full text-left text-sm" >
42
+ < thead className = "border-b border-200 text-purple-600" >
43
+ < tr >
44
+ < th > </ th >
45
+ < th className = "py-3" > Character</ th >
46
+ < th className = "py-3" > Date</ th >
47
+ < th className = "py-3" > Ownership</ th >
48
+ < th className = "py-3" > Visibility</ th >
49
+ </ tr >
50
+ </ thead >
51
+ < tbody >
52
+ { characters . map ( ( characters , index ) => (
53
+ < tr key = { characters . name } className = "border-b border-100 hover:bg-200" onClick = { ( ) => window . location . href = `/studio/characters/${ characters . id } ` } >
54
+ < td className = "px-2" >
55
+ < Checkbox
56
+ inputName = { `character-select-${ index } ` }
57
+ label = ''
58
+ checked = { false }
59
+ onChange = { ( ) => { } }
60
+ disabled = { false }
61
+ />
62
+ </ td >
63
+ < td className = "flex items-center gap-3 py-4" >
64
+ < Avatar size = { 50 } src = { characters . avatarUrl } className = 'rounded-none' />
65
+ < div >
66
+ < div className = "flex items-center gap-2" >
67
+ < span className = "font-semibold text-lg" > { characters . name } </ span >
68
+ { characters . mainCharacter && (
69
+ < span className = "text-xs px-2 py-0.5 bg-100 text-700 rounded-full border border-300" >
70
+ Default
71
+ </ span >
72
+ ) }
73
+ { /* TODO: Toyhou.se Icon */ }
74
+ </ div >
75
+ < div className = "text-sm text-gray-500" > { characters . species } </ div >
76
+ </ div >
77
+ </ td >
78
+ < td className = "py-4" >
79
+ { characters . adoptionStatus ? (
80
+ < div className = "text-purple-600 text-sm" >
81
+ Adopted on { new Date ( characters . adoptionStatus . adoptionDate ) . toLocaleDateString ( ) }
82
+ </ div >
83
+ ) : (
84
+ < >
85
+ < div className = "text-purple-600 text-sm" >
86
+ Created
87
+ </ div >
88
+ < div className = "font-medium" > { new Date ( characters . createdAt ) . toLocaleDateString ( ) } </ div >
89
+ </ >
90
+ ) }
91
+
92
+ </ td >
93
+ < td className = "py-4 font-medium" > { characters . owner . handle } </ td >
94
+ < td className = "py-4" >
95
+ { characters . visibility === 'public' ? (
96
+ < div className = "flex items-center gap-1 text-600" >
97
+ < LuEye size = { 20 } />
98
+ < span > Public</ span >
99
+ </ div >
100
+ ) : (
101
+ < div className = "flex items-center gap-1 text-600" >
102
+ < LuLock size = { 20 } />
103
+ < span > Private</ span >
104
+ </ div >
105
+ ) }
106
+ </ td >
107
+ </ tr >
108
+ ) ) }
109
+ </ tbody >
110
+ </ table >
111
+ ) }
40
112
</ Group >
41
113
< CreateCharacterModal
42
114
createCharacterModalShown = { isCreateModalOpen }
43
115
toggleCreateCharacterModal = { toggleCreateCharacterModal }
44
116
/>
45
- </ div >
117
+ </ div >
46
118
)
47
119
}
0 commit comments