1+ import * as React from 'react' ;
2+ import { TeamHistory } from '../../models/profile-types' ;
3+
4+ type Props = {
5+ playerProfile : {
6+ teamHistory : TeamHistory [ ]
7+ }
8+ }
9+
10+ export const PlayerHistory = ( { playerProfile } : Props ) => {
11+ console . info ( playerProfile . teamHistory )
12+
13+ return (
14+ < div className = "flex flex-col gap-4" >
15+ < h2 className = "text-lg font-bold text-center uppercase text-gray-400" > Player History (WIP)</ h2 >
16+ < div className = "overflow-x-auto" >
17+ < ul className = "flex flex-col gap-3" >
18+ { playerProfile . teamHistory . map ( ( history , index ) => {
19+ let bubbleColor = "" ;
20+ let icon = null ;
21+
22+ switch ( history ?. changeType ?. toUpperCase ( ) ?? "" ) {
23+ case "CUT" :
24+ bubbleColor = "bg-red-100 border-red-400 text-red-800" ;
25+ icon = (
26+ < svg className = "w-5 h-5 text-red-500 mr-3" fill = "none" stroke = "currentColor" strokeWidth = "2" viewBox = "0 0 24 24" >
27+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M6 18L18 6M6 6l12 12" />
28+ </ svg >
29+ ) ;
30+ break ;
31+ case "SIGN" :
32+ bubbleColor = "bg-blue-100 border-blue-400 text-blue-800" ;
33+ icon = (
34+ < svg className = "w-5 h-5 text-blue-500 mr-3" fill = "none" stroke = "currentColor" strokeWidth = "2" viewBox = "0 0 24 24" >
35+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M12 4v16m8-8H4" />
36+ </ svg >
37+ ) ;
38+ break ;
39+ case "SUB" :
40+ bubbleColor = "bg-green-100 border-green-400 text-green-800" ;
41+ icon = (
42+ < svg className = "w-5 h-5 text-green-500 mr-3" fill = "none" stroke = "currentColor" strokeWidth = "2" viewBox = "0 0 24 24" >
43+ < circle cx = "12" cy = "12" r = "10" />
44+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M8 12l2 2 4-4" />
45+ </ svg >
46+ ) ;
47+ break ;
48+ case "DRAFT" :
49+ bubbleColor = "bg-purple-100 border-purple-400 text-purple-800" ;
50+ icon = (
51+ < svg className = "w-5 h-5 text-purple-500 mr-3" fill = "none" stroke = "currentColor" strokeWidth = "2" viewBox = "0 0 24 24" >
52+ < rect x = "4" y = "4" width = "16" height = "16" rx = "4" />
53+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M8 12h8" />
54+ </ svg >
55+ ) ;
56+ break ;
57+ default :
58+ bubbleColor = "bg-gray-100 border-gray-400 text-gray-800" ;
59+ icon = (
60+ < svg className = "w-5 h-5 text-gray-500 mr-3" fill = "none" stroke = "currentColor" strokeWidth = "2" viewBox = "0 0 24 24" >
61+ < circle cx = "12" cy = "12" r = "10" />
62+ </ svg >
63+ ) ;
64+ }
65+
66+ return (
67+ < li
68+ key = { index }
69+ className = { `flex items-center border rounded-xl px-2 py-1 shadow-sm ${ bubbleColor } ` }
70+ >
71+ { icon }
72+ < div className = "flex flex-row flex-1 gap-4" >
73+ < div className = "font-semibold uppercase" > { history . changeType } </ div >
74+ < div className = "text-xs" > { history . value } </ div >
75+ < div className = "text-xs" > { new Date ( history . dateCreated ) . toLocaleDateString ( ) } </ div >
76+ {
77+ history . metadata ?. teamId &&
78+ < div > ({ history . metadata . franchisePrefix } )</ div >
79+ }
80+ </ div >
81+ </ li >
82+ ) ;
83+ } ) }
84+ </ ul >
85+ </ div >
86+ </ div >
87+ )
88+ }
0 commit comments