1
+ export type AboutProject = [
2
+ release : string ,
3
+ platforms : string ,
4
+ developer : string
5
+ ]
6
+
7
+ export type RelatedLinks = [
8
+ name : string ,
9
+ path : string ,
10
+ ]
11
+
12
+ export function projectInfo ( about : AboutProject , links : RelatedLinks [ ] ) {
13
+ const info = document . createElement ( "div" ) ;
14
+
15
+ if ( about != null ) {
16
+ info . appendChild ( sectionAboutTheGame ( about ) ) ;
17
+ }
18
+
19
+ if ( links != null ) {
20
+ info . appendChild ( sectionRelatedLinks ( links ) ) ;
21
+ }
22
+ }
23
+
24
+
25
+ function sectionAboutTheGame ( about : AboutProject ) {
26
+ const [ release , platforms , developer ] = about ;
27
+
28
+ const detailSection = document . createElement ( 'div' ) ;
29
+ const detailTitle = document . createElement ( "h4" ) ;
30
+ const releaseDate = document . createElement ( "p" ) ;
31
+ const platformAvailable = document . createElement ( "p" ) ;
32
+ const developerNames = document . createElement ( "p" ) ;
33
+
34
+ detailSection . className = "detail-section" ;
35
+ detailTitle . textContent = "About the Project"
36
+ releaseDate . textContent = "<b>Release date: </b>" + release ;
37
+ platformAvailable . textContent = "<b>Platforms: </b" + platforms ;
38
+ developerNames . textContent = "<b>Developer: </b>" + developer ;
39
+
40
+ detailSection . appendChild ( detailTitle ) ;
41
+ detailSection . appendChild ( releaseDate ) ;
42
+ detailSection . appendChild ( platformAvailable ) ;
43
+ detailSection . appendChild ( developerNames ) ;
44
+
45
+ return detailSection ;
46
+ }
47
+
48
+
49
+ function sectionRelatedLinks ( relatedLinks : RelatedLinks [ ] ) {
50
+ const detailSection = document . createElement ( 'div' ) ;
51
+ const linkList = document . createElement ( 'ul' ) ;
52
+
53
+ detailSection . className = "detail-section" ;
54
+ detailSection . appendChild ( linkList ) ;
55
+
56
+ relatedLinks . forEach ( relatedLink => {
57
+ const [ name , path ] = relatedLink ;
58
+ const linkLine = document . createElement ( 'li' ) ;
59
+ const link = document . createElement ( "a" ) ;
60
+
61
+ link . href = path ;
62
+ link . target = "_blank" ;
63
+ link . textContent = name ;
64
+
65
+ linkList . appendChild ( linkLine ) ;
66
+ linkLine . appendChild ( link ) ;
67
+ } )
68
+
69
+ return detailSection ;
70
+ }
0 commit comments