File tree Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export default defineConfig({
25
25
'./NgScore' : './src/components/NgScore.tsx' ,
26
26
'./NgViews' : './src/components/NgViews.tsx' ,
27
27
'./NgRatingSearchableSelect' : './src/components/NgRatingSearchableSelect.tsx' ,
28
+ './NgTrophies' : './src/components/NgTrophies.tsx' ,
28
29
} ,
29
30
shared : {
30
31
react : { singleton : true , requiredVersion : dependencies . react } ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export default function Initializer() {
10
10
'nga/NgScore' ,
11
11
'nga/NgFaves' ,
12
12
'nga/NgCredits' ,
13
+ 'nga/NgTrophies' ,
13
14
] ;
14
15
15
16
// Insert below alt titles
Original file line number Diff line number Diff line change
1
+ import { GameComponentProps } from 'flashpoint-launcher-renderer' ;
2
+ import { ExtData } from './types' ;
3
+ import { FaTrophy } from 'react-icons/fa' ;
4
+
5
+ export default function NgTrophies ( props : GameComponentProps ) {
6
+ const extData : ExtData | undefined = props . game . extData ?. nga ;
7
+ const trophies = extData ?. trophies || [ ] ;
8
+
9
+ if ( trophies . length === 0 ) {
10
+ return < > </ > ;
11
+ }
12
+
13
+ return (
14
+ < div className = 'ng-trophies' >
15
+ < p > Trophies:</ p >
16
+ { trophies . map ( ( trophy , index ) => (
17
+ < div key = { index } className = 'ng-trophy' >
18
+ < div className = 'ng-trophy__icon' >
19
+ < FaTrophy />
20
+ </ div >
21
+ < div className = 'ng-trophy__info' >
22
+ < div className = 'ng-trophy__name' > { trophy [ 0 ] } </ div >
23
+ < div className = 'ng-trophy__date' > { trophy [ 1 ] } </ div >
24
+ </ div >
25
+ </ div >
26
+ ) ) }
27
+ </ div >
28
+ ) ;
29
+ }
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ export type Credit = {
3
3
roles ?: string [ ] ;
4
4
}
5
5
6
+ export type Trophy = string [ ] ;
7
+
6
8
export type ExtData = {
7
9
score ?: number ;
8
10
rating ?: string ;
9
11
views ?: number ;
10
12
faves ?: number ;
11
13
credits ?: Credit [ ] ;
14
+ trophies ?: Trophy [ ] ;
12
15
}
Original file line number Diff line number Diff line change 42
42
.nga-credit-icon {
43
43
margin : 0.1em 0.3em 0em 0em ;
44
44
}
45
+
46
+
47
+ .ng-trophies {
48
+ display : flex;
49
+ flex-direction : column;
50
+ }
51
+
52
+ .ng-trophies__header {
53
+ font-weight : bold;
54
+ }
55
+
56
+ .ng-trophy {
57
+ display : flex;
58
+ flex-direction : row;
59
+ }
60
+
61
+ .ng-trophy__icon {
62
+ align-self : center;
63
+ margin-right : 0.5rem ;
64
+ }
65
+
66
+ .ng-trophy__info {
67
+ display : flex;
68
+ flex-direction : column;
69
+ }
70
+
71
+ .ng-trophy__name {
72
+ font-weight : bold;
73
+ }
You can’t perform that action at this time.
0 commit comments