Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 2232d8e

Browse files
authored
feat: remove the extension list (#250)
1 parent 6acd186 commit 2232d8e

File tree

6 files changed

+37
-90
lines changed

6 files changed

+37
-90
lines changed

src/shared/components/options/BrowserSettingsEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export class BrowserSettingsEditor extends React.Component<{}, State> {
4444
public render(): JSX.Element | null {
4545
return (
4646
<div>
47-
<div className="options__section-header">Client settings</div>
4847
<div className="options__section-contents">
4948
<FormGroup>
5049
<Label className="options__input">
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from 'react'
2+
import { Card, CardBody, CardHeader, Col, Row } from 'reactstrap'
3+
import { BrowserSettingsEditor } from './BrowserSettingsEditor'
4+
5+
export class ClientSettingsCard extends React.Component {
6+
public render(): JSX.Element | null {
7+
return (
8+
<Row className="pb-3">
9+
<Col>
10+
<Card>
11+
<CardHeader>Client settings</CardHeader>
12+
<CardBody>
13+
<BrowserSettingsEditor />
14+
</CardBody>
15+
</Card>
16+
</Col>
17+
</Row>
18+
)
19+
}
20+
}

src/shared/components/options/ExtensionRegistry.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/shared/components/options/FeatureFlagCard.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react'
22
import { Card, CardBody, CardHeader, Col, Form, FormGroup, Input, Label, Row } from 'reactstrap'
33
import storage from '../../../browser/storage'
44
import { StorageItems } from '../../../browser/types'
5+
import { sourcegraphUrl } from '../../util/context'
56

67
interface Props {
78
storage: StorageItems
@@ -96,6 +97,15 @@ export class FeatureFlagCard extends React.Component<Props, {}> {
9697
type="checkbox"
9798
/>{' '}
9899
Use Sourcegraph extensions
100+
{useExtensions && (
101+
<>
102+
{' '}
103+
and{' '}
104+
<a href={sourcegraphUrl + '/extensions'} target="_blank">
105+
enable extensions on the registry
106+
</a>
107+
</>
108+
)}
99109
</Label>
100110
</FormGroup>
101111
<FormGroup check={true}>

src/shared/components/options/OptionsConfiguration.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as React from 'react'
2-
import { RouteComponentProps } from 'react-router'
32
import { Subscription } from 'rxjs'
43
import * as permissions from '../../../browser/permissions'
54
import storage from '../../../browser/storage'
65
import { StorageItems } from '../../../browser/types'
76
import { GQL } from '../../../types/gqlschema'
87
import { fetchCurrentUser } from '../../backend/server'
8+
import { ClientSettingsCard } from './ClientSettingsCard'
99
import { ConnectionCard } from './ConnectionCard'
1010
import { FeatureFlagCard } from './FeatureFlagCard'
1111

12-
interface Props extends RouteComponentProps<any> {}
12+
interface Props {}
1313
interface State {
1414
currentUser: GQL.IUser | undefined
1515
storage: StorageItems | undefined
@@ -78,6 +78,7 @@ export class OptionsConfiguration extends React.Component<Props, State> {
7878
<div className="options-configuation-page">
7979
<ConnectionCard permissionOrigins={permissionOrigins} storage={storage} currentUser={currentUser} />
8080
<FeatureFlagCard storage={storage} />
81+
{storage.useExtensions && <ClientSettingsCard />}
8182
</div>
8283
)
8384
}
Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,14 @@
11
import * as React from 'react'
2-
import { Redirect, Route, Switch } from 'react-router'
3-
import { HashRouter } from 'react-router-dom'
4-
import { sourcegraphUrl } from '../../util/context'
5-
import { ExtensionRegistry } from './ExtensionRegistry'
62
import { OptionsConfiguration } from './OptionsConfiguration'
7-
import { OptionsPageSidebar } from './OptionsPageSidebar'
8-
9-
const EXTENSION_ROUTE = '/extensions/:url/:author/:extension?'
103

114
export class OptionsDashboard extends React.Component<any, {}> {
12-
/**
13-
* extensionRedirectComponent redirects to the extension page on Sourcegraph instead of showing
14-
* the extension in the options page and keeps the user on the extension registry page.
15-
*/
16-
private extensionRedirectComponent = (): JSX.Element | null => {
17-
const extensionUrl = window.location.hash.replace('#', sourcegraphUrl)
18-
window.open(extensionUrl, '_blank')
19-
return <Redirect from={EXTENSION_ROUTE} to="/extensions" />
20-
}
21-
225
public render(): JSX.Element {
236
return (
24-
<HashRouter>
25-
<div className="site-admin-area area">
26-
<OptionsPageSidebar className="area__sidebar" />
27-
<div className="area__content">
28-
<Switch>
29-
<Route path="/" component={OptionsConfiguration} exact={true} />
30-
<Route path="/extensions" component={ExtensionRegistry} exact={true} />
31-
<Route path={EXTENSION_ROUTE} component={this.extensionRedirectComponent} />
32-
</Switch>
33-
</div>
7+
<div className="site-admin-area area">
8+
<div className="area__content">
9+
<OptionsConfiguration />
3410
</div>
35-
</HashRouter>
11+
</div>
3612
)
3713
}
3814
}

0 commit comments

Comments
 (0)