@@ -6,13 +6,17 @@ import {
6
6
ManifestAspect ,
7
7
ManifestStatPlug ,
8
8
ManifestPlug ,
9
+ ManifestArmorMod ,
10
+ ManifestArmorStatMod ,
9
11
} from '../types/manifest-types' ;
10
12
11
13
type HoverCardItem =
12
14
| ManifestSubclass
13
15
| ManifestAspect
14
16
| ManifestStatPlug
15
17
| ManifestPlug
18
+ | ManifestArmorMod
19
+ | ManifestArmorStatMod
16
20
| undefined
17
21
| null ;
18
22
@@ -27,19 +31,19 @@ const HoverCardContainer = styled('div')(({ theme }) => ({
27
31
right : '100%' ,
28
32
zIndex : 1600 ,
29
33
padding : theme . spacing ( 1.5 ) ,
30
- backgroundColor : 'rgba(0, 0, 0, 0.8 )' ,
34
+ backgroundColor : 'rgba(0, 0, 0, 0.9 )' ,
31
35
borderRadius : '0px' ,
32
36
boxShadow : theme . shadows [ 10 ] ,
33
- width : '250px ' ,
37
+ width : '300px ' ,
34
38
pointerEvents : 'none' ,
35
39
display : 'flex' ,
36
40
flexDirection : 'column' ,
37
41
gap : theme . spacing ( 1 ) ,
38
- fontFamily : 'Helvetica, Arial, sans-serif' ,
42
+ fontFamily : 'Arial, sans-serif' ,
39
43
} ) ) ;
40
44
41
45
const HoverCardTitle = styled ( Typography ) ( {
42
- fontFamily : 'Helvetica, Arial, sans-serif' ,
46
+ fontFamily : 'Arial, sans-serif' ,
43
47
fontWeight : 'bold' ,
44
48
fontSize : '16px' ,
45
49
textAlign : 'center' ,
@@ -54,7 +58,7 @@ const HoverCardIcon = styled('img')({
54
58
} ) ;
55
59
56
60
const HoverCardDescription = styled ( Typography ) ( {
57
- fontFamily : 'Helvetica, Arial, sans-serif' ,
61
+ fontFamily : 'Arial, sans-serif' ,
58
62
fontSize : '14px' ,
59
63
color : '#cccccc' ,
60
64
} ) ;
@@ -74,6 +78,64 @@ const EnergyCapacitySquare = styled('div')(({ theme }) => ({
74
78
marginRight : '2px' ,
75
79
} ) ) ;
76
80
81
+ const ModHoverCardHeader = styled ( Box ) ( {
82
+ display : 'flex' ,
83
+ flexDirection : 'column' ,
84
+ marginBottom : '8px' ,
85
+ } ) ;
86
+
87
+ const ModHoverCardTitleRow = styled ( Box ) ( {
88
+ display : 'flex' ,
89
+ justifyContent : 'space-between' ,
90
+ alignItems : 'center' ,
91
+ } ) ;
92
+
93
+ const ModHoverCardIcon = styled ( 'img' ) ( {
94
+ width : '32px' ,
95
+ height : '32px' ,
96
+ marginRight : '8px' ,
97
+ } ) ;
98
+
99
+ const ModHoverCardTitle = styled ( Typography ) ( {
100
+ fontFamily : 'Arial, sans-serif' ,
101
+ fontWeight : 'bold' ,
102
+ fontSize : '18px' ,
103
+ color : '#ffffff' ,
104
+ flexGrow : 1 ,
105
+ } ) ;
106
+
107
+ const EnergyCostChip = styled ( Box ) ( ( { theme } ) => ( {
108
+ color : '#ffffff' ,
109
+ padding : '2px 6px' ,
110
+ fontSize : '24px' ,
111
+ fontWeight : 'bold' ,
112
+ } ) ) ;
113
+
114
+ const ModTypeLabel = styled ( Typography ) ( {
115
+ fontSize : '12px' ,
116
+ color : '#aaaaaa' ,
117
+ marginTop : '4px' ,
118
+ } ) ;
119
+
120
+ const Divider = styled ( 'div' ) ( {
121
+ width : '100%' ,
122
+ height : '1px' ,
123
+ background :
124
+ 'linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.3), rgba(255,255,255,0))' ,
125
+ margin : '8px 0' ,
126
+ } ) ;
127
+
128
+ const ModDescriptionContainer = styled ( Box ) ( {
129
+ display : 'flex' ,
130
+ alignItems : 'flex-start' ,
131
+ } ) ;
132
+
133
+ const ModDescription = styled ( Typography ) ( {
134
+ fontSize : '14px' ,
135
+ color : '#cccccc' ,
136
+ flexGrow : 1 ,
137
+ } ) ;
138
+
77
139
const HoverCard : React . FC < HoverCardProps > = ( { item, children } ) => {
78
140
const [ hoverData , setHoverData ] = useState < any | null > ( null ) ;
79
141
@@ -103,7 +165,6 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
103
165
104
166
fullData = await db . manifestSubclassFragmentsDef . where ( 'itemHash' ) . equals ( itemHash ) . first ( ) ;
105
167
if ( fullData ) {
106
- // Fetch the description from manifestSandboxPerkDef
107
168
const sandboxPerk = await db . manifestSandboxPerkDef
108
169
. where ( 'name' )
109
170
. equals ( fullData . name )
@@ -122,6 +183,34 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
122
183
return ;
123
184
}
124
185
186
+ fullData = await db . manifestArmorModDef . where ( 'itemHash' ) . equals ( itemHash ) . first ( ) ;
187
+ if ( fullData ) {
188
+ const sandboxPerk =
189
+ fullData . perks && fullData . perks . length > 0
190
+ ? await db . manifestSandboxPerkDef . where ( 'itemHash' ) . equals ( fullData . perks [ 0 ] ) . first ( )
191
+ : null ;
192
+ setHoverData ( {
193
+ ...fullData ,
194
+ type : 'armorMod' ,
195
+ description : sandboxPerk ? sandboxPerk . description : 'No description available' ,
196
+ } ) ;
197
+ return ;
198
+ }
199
+
200
+ fullData = await db . manifestArmorStatModDef . where ( 'itemHash' ) . equals ( itemHash ) . first ( ) ;
201
+ if ( fullData ) {
202
+ const sandboxPerk =
203
+ fullData . perks && fullData . perks . length > 0
204
+ ? await db . manifestSandboxPerkDef . where ( 'itemHash' ) . equals ( fullData . perks [ 0 ] ) . first ( )
205
+ : null ;
206
+ setHoverData ( {
207
+ ...fullData ,
208
+ type : 'armorStatMod' ,
209
+ description : sandboxPerk ? sandboxPerk . description : 'No description available' ,
210
+ } ) ;
211
+ return ;
212
+ }
213
+
125
214
console . log ( 'Item not found in any table' ) ;
126
215
} catch ( error ) {
127
216
console . error ( 'Error fetching item data:' , error ) ;
@@ -142,6 +231,25 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
142
231
) ;
143
232
} ;
144
233
234
+ const renderModContent = ( data : any ) => {
235
+ return (
236
+ < >
237
+ < ModHoverCardHeader >
238
+ < ModHoverCardTitleRow >
239
+ < ModHoverCardTitle > { data . name } </ ModHoverCardTitle >
240
+ < EnergyCostChip > { data . energyCost } </ EnergyCostChip >
241
+ </ ModHoverCardTitleRow >
242
+ < ModTypeLabel > { data . type === 'armorMod' ? 'Armor Mod' : 'Armor Stat Mod' } </ ModTypeLabel >
243
+ </ ModHoverCardHeader >
244
+ < Divider />
245
+ < ModDescriptionContainer >
246
+ < ModHoverCardIcon src = { data . icon } alt = { data . name } />
247
+ < ModDescription > { data . description } </ ModDescription >
248
+ </ ModDescriptionContainer >
249
+ </ >
250
+ ) ;
251
+ } ;
252
+
145
253
const renderDescription = ( ) => {
146
254
if ( ! hoverData ) return null ;
147
255
@@ -179,6 +287,10 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
179
287
</ >
180
288
) ;
181
289
290
+ case 'armorMod' :
291
+ case 'armorStatMod' :
292
+ return renderModContent ( hoverData ) ;
293
+
182
294
default :
183
295
return < HoverCardDescription > </ HoverCardDescription > ;
184
296
}
@@ -193,9 +305,15 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
193
305
{ children }
194
306
{ hoverData && (
195
307
< HoverCardContainer >
196
- < HoverCardTitle variant = "h6" > { hoverData . name } </ HoverCardTitle >
197
- < HoverCardIcon src = { hoverData . secondaryIcon || hoverData . icon } alt = { hoverData . name } />
198
- { renderDescription ( ) }
308
+ { hoverData . type === 'armorMod' || hoverData . type === 'armorStatMod' ? (
309
+ renderDescription ( )
310
+ ) : (
311
+ < >
312
+ < HoverCardTitle variant = "h6" > { hoverData . name } </ HoverCardTitle >
313
+ < HoverCardIcon src = { hoverData . secondaryIcon || hoverData . icon } alt = { hoverData . name } />
314
+ { renderDescription ( ) }
315
+ </ >
316
+ ) }
199
317
</ HoverCardContainer >
200
318
) }
201
319
</ div >
0 commit comments