@@ -7,6 +7,7 @@ import './InstallationInfo.css';
7
7
interface IInstallationInfoProps {
8
8
id : string ;
9
9
version : string ;
10
+ isDotnetTool : boolean ;
10
11
}
11
12
12
13
interface IInstallationInfoState {
@@ -16,7 +17,9 @@ interface IInstallationInfoState {
16
17
}
17
18
18
19
enum Tab {
19
- DotNet ,
20
+ Dotnet ,
21
+ DotnetTool ,
22
+ PackageReference ,
20
23
Paket ,
21
24
PackageManager ,
22
25
}
@@ -26,16 +29,43 @@ class InstallationInfo extends React.Component<IInstallationInfoProps, IInstalla
26
29
constructor ( props : IInstallationInfoProps ) {
27
30
super ( props ) ;
28
31
29
- this . state = this . buildState ( Tab . DotNet ) ;
32
+ // tslint:disable-next-line:no-console
33
+ console . log ( props ) ;
34
+ this . state = props . isDotnetTool
35
+ ? this . buildState ( Tab . DotnetTool )
36
+ : this . buildState ( Tab . Dotnet ) ;
30
37
}
31
38
32
39
public render ( ) {
33
40
return (
34
41
< div className = "installation-info" >
35
42
< ul className = "nav" >
36
- < InstallationInfoTab type = { Tab . DotNet } selected = { this . state . selected } onSelect = { this . handleSelect } />
37
- < InstallationInfoTab type = { Tab . Paket } selected = { this . state . selected } onSelect = { this . handleSelect } />
38
- < InstallationInfoTab type = { Tab . PackageManager } selected = { this . state . selected } onSelect = { this . handleSelect } />
43
+ < InstallationInfoTab
44
+ type = { Tab . Dotnet }
45
+ hidden = { this . props . isDotnetTool }
46
+ selected = { this . state . selected }
47
+ onSelect = { this . handleSelect } />
48
+ < InstallationInfoTab
49
+ type = { Tab . PackageReference }
50
+ hidden = { this . props . isDotnetTool }
51
+ selected = { this . state . selected }
52
+ onSelect = { this . handleSelect } />
53
+ < InstallationInfoTab
54
+ type = { Tab . Paket }
55
+ hidden = { this . props . isDotnetTool }
56
+ selected = { this . state . selected }
57
+ onSelect = { this . handleSelect } />
58
+ < InstallationInfoTab
59
+ type = { Tab . PackageManager }
60
+ hidden = { this . props . isDotnetTool }
61
+ selected = { this . state . selected }
62
+ onSelect = { this . handleSelect } />
63
+
64
+ < InstallationInfoTab
65
+ type = { Tab . DotnetTool }
66
+ hidden = { ! this . props . isDotnetTool }
67
+ selected = { this . state . selected }
68
+ onSelect = { this . handleSelect } />
39
69
</ ul >
40
70
41
71
< div className = "content" >
@@ -62,11 +92,21 @@ class InstallationInfo extends React.Component<IInstallationInfoProps, IInstalla
62
92
let prefix : string ;
63
93
64
94
switch ( tab ) {
65
- case Tab . DotNet :
95
+ case Tab . Dotnet :
66
96
content = `dotnet add package ${ this . props . id } --version ${ this . props . version } ` ;
67
97
prefix = ">" ;
68
98
break ;
69
99
100
+ case Tab . DotnetTool :
101
+ content = `dotnet tool install --global ${ this . props . id } --version ${ this . props . version } ` ;
102
+ prefix = ">" ;
103
+ break ;
104
+
105
+ case Tab . PackageReference :
106
+ content = `<PackageReference Include="${ this . props . id } " Version="${ this . props . version } " />` ;
107
+ prefix = "" ;
108
+ break ;
109
+
70
110
case Tab . Paket :
71
111
content = `paket add ${ this . props . id } --version ${ this . props . version } ` ;
72
112
prefix = ">" ;
@@ -89,6 +129,7 @@ class InstallationInfo extends React.Component<IInstallationInfoProps, IInstalla
89
129
90
130
interface IInstallationInfoTabProps {
91
131
type : Tab ;
132
+ hidden : boolean ;
92
133
selected : Tab ;
93
134
onSelect ( value : Tab ) : void ;
94
135
}
@@ -102,13 +143,19 @@ class InstallationInfoTab extends React.Component<IInstallationInfoTabProps> {
102
143
super ( props ) ;
103
144
104
145
switch ( props . type ) {
105
- case Tab . DotNet : this . title = ".NET CLI" ; break ;
146
+ case Tab . Dotnet : this . title = ".NET CLI" ; break ;
147
+ case Tab . DotnetTool : this . title = ".NET CLI" ; break ;
148
+ case Tab . PackageReference : this . title = "PackageReference" ; break ;
106
149
case Tab . Paket : this . title = "Paket CLI" ; break ;
107
150
case Tab . PackageManager : this . title = "Package Manager" ; break ;
108
151
}
109
152
}
110
153
111
154
public render ( ) {
155
+ if ( this . props . hidden ) {
156
+ return null ;
157
+ }
158
+
112
159
if ( this . props . type === this . props . selected ) {
113
160
return < li className = "active" > < a href = "#" > { this . title } </ a > </ li >
114
161
}
0 commit comments