This repository was archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathAfterInstallPageContent.tsx
More file actions
239 lines (225 loc) · 12.4 KB
/
AfterInstallPageContent.tsx
File metadata and controls
239 lines (225 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import React, { type VideoHTMLAttributes } from 'react'
import { mdiOpenInNew, mdiGithub, mdiCheck, mdiGitlab, mdiBitbucket, mdiLock, mdiBookOpenPageVariant } from '@mdi/js'
import classNames from 'classnames'
import { SourcegraphLogo } from '@sourcegraph/branded/src/components/SourcegraphLogo'
import { PhabricatorIcon } from '@sourcegraph/shared/src/components/icons'
import { Link, Icon, Code, H1, H2, H3, Text } from '@sourcegraph/wildcard'
import { getPlatformName } from '../../shared/util/context'
import styles from './AfterInstallPageContent.module.scss'
interface VideoProps extends Pick<VideoHTMLAttributes<HTMLVideoElement>, 'width' | 'height'> {
name: string
isLightTheme: boolean
}
const Video: React.FC<VideoProps> = ({ name, isLightTheme, width, height }) => {
const suffix = isLightTheme ? 'Light' : 'Dark'
return (
<video
className="w-100 h-auto cursor-pointer"
width={width}
height={height}
autoPlay={true}
loop={true}
muted={true}
playsInline={true}
onClick={event => event.currentTarget.requestFullscreen()}
// Add a key on the theme to force React to render a new <video> element when the theme changes
key={name + suffix}
>
<source
src={`https://storage.googleapis.com/sourcegraph-assets/code-host-integration/${name}${suffix}.webm`}
type="video/webm"
/>
<source
src={`https://storage.googleapis.com/sourcegraph-assets/code-host-integration/${name}${suffix}.mp4`}
type="video/mp4"
/>
</video>
)
}
interface AfterInstallPageContentProps {
isLightTheme: boolean
}
export const AfterInstallPageContent: React.FC<AfterInstallPageContentProps> = props => {
// Safari does not support the search shortcut. So don't show the feature.
const isSafari = getPlatformName() === 'safari-extension'
const showSearchShortcut = !isSafari
return (
<div className="after-install-page-content" data-testid="after-install-page-content">
<div className="d-flex w-100 p-3 justify-content-between align-items-center">
<Link to="https://sourcegraph.com/search" target="_blank" rel="noopener">
<SourcegraphLogo className={styles.sourcegraphLogo} />
</Link>
<Link to="https://sourcegraph.com/docs/integration/browser_extension" target="_blank" rel="noopener">
Browser extension docs <Icon aria-hidden={true} svgPath={mdiOpenInNew} />
</Link>
</div>
<div className="container mt-3">
<H1>🎉 You’ve just installed the Sourcegraph browser extension!</H1>
<Text className="lead mb-0">
We’ve gathered the most important information that will get your started:
</Text>
</div>
<section className="border-bottom py-5">
<div className="container">
<H2 className="mb-4">How do I use the extension?</H2>
<div className="row">
<div className="col-md-6">
<H3>Code navigation on your code host</H3>
<Text>
Sourcegraph browser extension adds code navigation to files and diffs on GitHub, GitHub
Enterprise, GitLab, Phabricator, Bitbucket Server, and Gerrit.
</Text>
<Video {...props} name="CodeIntelligenceOnCodeHost" width={1760} height={1060} />
</div>
{showSearchShortcut && (
<div className="col-md-6 mt-4 mt-md-0">
<H3>Search shortcut in the URL location bar</H3>
<Text>
Type <Code>src</Code>
<kbd>tab</kbd> in the address bar of your browser to search for queries on
Sourcegraph.
</Text>
<Video {...props} name="BrowserShortcut" width={1196} height={720} />
</div>
)}
</div>
</div>
</section>
<section className="border-bottom py-5">
<div className="container">
<div className="row">
<div className="col-md-6 d-flex flex-column">
<H2 className="mb-4">Make it work on your codehost</H2>
<div className="bg-2 rounded p-3 mb-3 d-flex flex-column justify-content-center">
<H3 className={classNames('mb-3', styles.codeHostTitles)}>
<Icon className={styles.codeHostLogo} aria-hidden={true} svgPath={mdiGithub} />{' '}
github.com
</H3>
<Text className="m-0">
<Icon aria-hidden={true} svgPath={mdiCheck} /> No action required.Your extension
works here by default.
</Text>
</div>
<div className="bg-2 rounded p-3 d-flex flex-column justify-content-center">
<H3 className={classNames('d-flex flex-wrap', styles.codeHostTitles)}>
<div className="mr-5 mb-3">
<Icon className={styles.codeHostLogo} aria-hidden={true} svgPath={mdiGithub} />{' '}
GitHub Enterprise
</div>
<div className="mr-5 mb-3">
<Icon className={styles.codeHostLogo} aria-hidden={true} svgPath={mdiGitlab} />{' '}
GitLab
</div>
<div className="mr-5 mb-3">
<Icon
className={styles.codeHostLogo}
aria-hidden={true}
svgPath={mdiBitbucket}
/>{' '}
Bitbucket Server
</div>
<div className="mr-5 mb-3">
<Icon className={styles.codeHostLogo} as={PhabricatorIcon} aria-hidden={true} />{' '}
Phabricator
</div>
</H3>
<Text>Your extension needs explicit permissions to your code host:</Text>
<ol className="m-0">
<li>Navigate to any page on your code host.</li>
<li>
Click the{' '}
<q>
<strong>Grant permissions</strong>
</q>{' '}
button.
</li>
<li>
Click{' '}
<q>
<strong>Allow</strong>
</q>{' '}
in the permissions request popup.
</li>
</ol>
</div>
</div>
<div className="col-md-6 mt-4 mt-md-0">
<Video {...props} name="GrantPermissions" width={1762} height={1384} />
</div>
</div>
</div>
</section>
<section className="border-bottom py-5">
<div className="container">
<div className="row">
<div className="col-md-6 d-flex flex-column">
<H2 className="mb-4">Make it work for private code</H2>
<Text>By default, the browser extension works only for public code.</Text>
<div className="d-flex align-items-center">
<div className="bg-3 rounded-circle p-2">
<Icon aria-hidden={true} svgPath={mdiLock} />
</div>
<Text className="m-0 ml-3">
To use the browser extension with your private repositories, you need to set up a{' '}
<strong>private Sourcegraph instance</strong> and connect the extension to it.
</Text>
</div>
<div className="bg-2 rounded p-3 mt-4 d-flex flex-column justify-content-around">
<Text>Follow these instructions:</Text>
<ol className="m-0 d-flex flex-column justify-content-around">
<li>
<strong>Install Sourcegraph</strong> (
<Link
to="https://sourcegraph.com/docs/admin/install"
target="_blank"
rel="noopener"
>
visit our docs for instructions
</Link>
).Skip this step if you already have a private Sourcegraph instance.
</li>
<li>
Click the Sourcegraph extension icon in the browser toolbar to{' '}
<Link to="./options.html" rel="noopener" target="_blank">
open the settings page
</Link>
.
</li>
<li>
Enter the <strong>URL</strong> (including the protocol) of your Sourcegraph
instance (such as <q>https://sourcegraph.example.com</q>).
</li>
<li>Make sure a green checkmark appears in the input field.</li>
</ol>
</div>
</div>
<div className="col-md-6 mt-4 mt-md-0">
<Video {...props} name="PrivateInstance" width={1764} height={1390} />
</div>
</div>
</div>
</section>
<section className="py-5">
<div className="container">
<H2 className="mb-4">Additional resources</H2>
<div className="d-flex w-100 align-items-center">
<div className="bg-3 rounded-circle p-2">
<Icon aria-hidden={true} svgPath={mdiBookOpenPageVariant} />
</div>
<Text className="m-0 ml-3">
Read the{' '}
<Link
to="https://sourcegraph.com/docs/integration/browser_extension"
rel="noopener"
target="_blank"
>
Sourcegraph docs
</Link>{' '}
to learn more about how we respect your privacy, troubleshooting and extension features.
</Text>
</div>
</div>
</section>
</div>
)
}