File tree Expand file tree Collapse file tree 2 files changed +14
-32
lines changed
site/src/modules/dashboard/Navbar/UserDropdown Expand file tree Collapse file tree 2 files changed +14
-32
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ package appearance
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
6
+ "strings"
5
7
8
+ "github.com/coder/coder/v2/buildinfo"
6
9
"github.com/coder/coder/v2/codersdk"
7
10
)
8
11
@@ -11,20 +14,21 @@ type Fetcher interface {
11
14
}
12
15
13
16
func DefaultSupportLinks (docsURL string ) []codersdk.LinkConfig {
17
+ version := buildinfo .Version ()
14
18
if docsURL == "" {
15
- docsURL = "https://coder.com/docs/{CODER_VERSION}"
19
+ docsURL = "https://coder.com/docs/@" + strings . Split ( version , "-" )[ 0 ]
16
20
}
21
+ buildInfo := fmt .Sprintf ("Version: [`%s`](%s)" , version , buildinfo .ExternalURL ())
17
22
18
- docsLink := codersdk.LinkConfig {
19
- Name : "Documentation" ,
20
- Target : docsURL ,
21
- Icon : "docs" ,
22
- }
23
-
24
- defaultSupportLinks := []codersdk.LinkConfig {
23
+ return []codersdk.LinkConfig {
24
+ {
25
+ Name : "Documentation" ,
26
+ Target : docsURL ,
27
+ Icon : "docs" ,
28
+ },
25
29
{
26
30
Name : "Report a bug" ,
27
- Target : "https://github.com/coder/coder/issues/new?labels=needs+grooming&body={CODER_BUILD_INFO}" ,
31
+ Target : "https://github.com/coder/coder/issues/new?labels=needs+grooming&body=" + buildInfo ,
28
32
Icon : "bug" ,
29
33
},
30
34
{
@@ -38,8 +42,6 @@ func DefaultSupportLinks(docsURL string) []codersdk.LinkConfig {
38
42
Icon : "star" ,
39
43
},
40
44
}
41
-
42
- return append ([]codersdk.LinkConfig {docsLink }, defaultSupportLinks ... )
43
45
}
44
46
45
47
type AGPLFetcher struct {
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
93
93
< Divider />
94
94
{ supportLinks . map ( ( link ) => (
95
95
< a
96
- href = { includeBuildInfo ( link . target , buildInfo ) }
96
+ href = { link . target }
97
97
key = { link . name }
98
98
target = "_blank"
99
99
rel = "noreferrer"
@@ -177,26 +177,6 @@ export const GithubStar: FC<SvgIconProps> = (props) => (
177
177
</ svg >
178
178
) ;
179
179
180
- const includeBuildInfo = (
181
- href : string ,
182
- buildInfo ?: TypesGen . BuildInfoResponse ,
183
- ) : string => {
184
- let version = encodeURIComponent ( ( buildInfo ?. version ?? "" ) . split ( "-" ) [ 0 ] ) ;
185
- if ( version ) {
186
- // Not encoding the @ because it makes the link look a bit weird.
187
- version = `@${ version } ` ;
188
- }
189
-
190
- return href
191
- . replace (
192
- "{CODER_BUILD_INFO}" ,
193
- `${ encodeURIComponent (
194
- `Version: [\`${ buildInfo ?. version } \`](${ buildInfo ?. external_url } )` ,
195
- ) } `,
196
- )
197
- . replace ( "{CODER_VERSION}" , version ) ;
198
- } ;
199
-
200
180
const styles = {
201
181
info : ( theme ) => [
202
182
theme . typography . body2 as CSSObject ,
You can’t perform that action at this time.
0 commit comments