Move settings to modal (#139)
This commit is contained in:
@ -14,11 +14,12 @@ import { documentEditUrl, homeUrl, searchUrl } from 'utils/routeHelpers';
|
|||||||
import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
|
import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
|
||||||
import { LoadingIndicatorBar } from 'components/LoadingIndicator';
|
import { LoadingIndicatorBar } from 'components/LoadingIndicator';
|
||||||
import Scrollable from 'components/Scrollable';
|
import Scrollable from 'components/Scrollable';
|
||||||
import KeyboardShortcuts from 'components/KeyboardShortcuts';
|
|
||||||
import Avatar from 'components/Avatar';
|
import Avatar from 'components/Avatar';
|
||||||
import Modal from 'components/Modal';
|
import Modal from 'components/Modal';
|
||||||
import AddIcon from 'components/Icon/AddIcon';
|
import AddIcon from 'components/Icon/AddIcon';
|
||||||
import CollectionNew from 'scenes/CollectionNew';
|
import CollectionNew from 'scenes/CollectionNew';
|
||||||
|
import KeyboardShortcuts from 'scenes/KeyboardShortcuts';
|
||||||
|
import Settings from 'scenes/Settings';
|
||||||
|
|
||||||
import SidebarCollection from './components/SidebarCollection';
|
import SidebarCollection from './components/SidebarCollection';
|
||||||
import SidebarCollectionList from './components/SidebarCollectionList';
|
import SidebarCollectionList from './components/SidebarCollectionList';
|
||||||
@ -78,6 +79,10 @@ type Props = {
|
|||||||
this.modal = 'keyboard-shortcuts';
|
this.modal = 'keyboard-shortcuts';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleOpenSettings = () => {
|
||||||
|
this.modal = 'settings';
|
||||||
|
};
|
||||||
|
|
||||||
handleCreateCollection = () => {
|
handleCreateCollection = () => {
|
||||||
this.modal = 'create-collection';
|
this.modal = 'create-collection';
|
||||||
};
|
};
|
||||||
@ -114,9 +119,9 @@ type Props = {
|
|||||||
<LogoLink to="/">Atlas</LogoLink>
|
<LogoLink to="/">Atlas</LogoLink>
|
||||||
</Flex>
|
</Flex>
|
||||||
<DropdownMenu label={<Avatar src={user.user.avatarUrl} />}>
|
<DropdownMenu label={<Avatar src={user.user.avatarUrl} />}>
|
||||||
<MenuLink to="/settings">
|
<DropdownMenuItem onClick={this.handleOpenSettings}>
|
||||||
<DropdownMenuItem>Settings</DropdownMenuItem>
|
Settings
|
||||||
</MenuLink>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
|
<DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
|
||||||
Keyboard shortcuts
|
Keyboard shortcuts
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
@ -176,6 +181,13 @@ type Props = {
|
|||||||
>
|
>
|
||||||
<KeyboardShortcuts />
|
<KeyboardShortcuts />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
<Modal
|
||||||
|
isOpen={this.modal === 'settings'}
|
||||||
|
onRequestClose={this.handleCloseModal}
|
||||||
|
title="Settings"
|
||||||
|
>
|
||||||
|
<Settings />
|
||||||
|
</Modal>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import Starred from 'scenes/Starred';
|
|||||||
import Collection from 'scenes/Collection';
|
import Collection from 'scenes/Collection';
|
||||||
import Document from 'scenes/Document';
|
import Document from 'scenes/Document';
|
||||||
import Search from 'scenes/Search';
|
import Search from 'scenes/Search';
|
||||||
import Settings from 'scenes/Settings';
|
|
||||||
import SlackAuth from 'scenes/SlackAuth';
|
import SlackAuth from 'scenes/SlackAuth';
|
||||||
import Flatpage from 'scenes/Flatpage';
|
import Flatpage from 'scenes/Flatpage';
|
||||||
import ErrorAuth from 'scenes/ErrorAuth';
|
import ErrorAuth from 'scenes/ErrorAuth';
|
||||||
@ -121,7 +120,7 @@ render(
|
|||||||
|
|
||||||
<Route exact path="/search" component={Search} />
|
<Route exact path="/search" component={Search} />
|
||||||
<Route exact path="/search/:query" component={Search} />
|
<Route exact path="/search/:query" component={Search} />
|
||||||
<Route exact path="/settings" component={Settings} />
|
<Route exact path="/developers" component={Api} />
|
||||||
|
|
||||||
<Route path="/404" component={Error404} />
|
<Route path="/404" component={Error404} />
|
||||||
|
|
||||||
@ -135,9 +134,6 @@ render(
|
|||||||
path="/collections/:id/new"
|
path="/collections/:id/new"
|
||||||
component={DocumentNew}
|
component={DocumentNew}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route exact path="/developers" component={Api} />
|
|
||||||
|
|
||||||
<Route component={notFoundSearch} />
|
<Route component={notFoundSearch} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import Flex from 'components/Flex';
|
import { Link } from 'react-router-dom';
|
||||||
|
import styled from 'styled-components';
|
||||||
import ApiKeyRow from './components/ApiKeyRow';
|
import ApiKeyRow from './components/ApiKeyRow';
|
||||||
import styles from './Settings.scss';
|
|
||||||
import SettingsStore from './SettingsStore';
|
import SettingsStore from './SettingsStore';
|
||||||
|
import { color } from 'styles/constants';
|
||||||
|
|
||||||
|
import Flex from 'components/Flex';
|
||||||
import Button from 'components/Button';
|
import Button from 'components/Button';
|
||||||
import Input from 'components/Input';
|
import Input from 'components/Input';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import HelpText from 'components/HelpText';
|
||||||
import SlackAuthLink from 'components/SlackAuthLink';
|
import SlackAuthLink from 'components/SlackAuthLink';
|
||||||
import PageTitle from 'components/PageTitle';
|
|
||||||
|
|
||||||
@observer class Settings extends React.Component {
|
@observer class Settings extends React.Component {
|
||||||
store: SettingsStore;
|
store: SettingsStore;
|
||||||
@ -25,15 +25,14 @@ import PageTitle from 'components/PageTitle';
|
|||||||
const showSlackSettings = DEPLOYMENT === 'hosted';
|
const showSlackSettings = DEPLOYMENT === 'hosted';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CenteredContent>
|
<Flex column>
|
||||||
<PageTitle title="Settings" />
|
|
||||||
{showSlackSettings &&
|
{showSlackSettings &&
|
||||||
<div className={styles.section}>
|
<Section>
|
||||||
<h2 className={styles.sectionHeader}>Slack</h2>
|
<h2>Slack</h2>
|
||||||
<p>
|
<HelpText>
|
||||||
Connect Atlas to your Slack to instantly search for your documents
|
Connect Atlas to your Slack to instantly search for your documents
|
||||||
using <code>/atlas</code> command.
|
using <code>/atlas</code> command.
|
||||||
</p>
|
</HelpText>
|
||||||
|
|
||||||
<SlackAuthLink
|
<SlackAuthLink
|
||||||
scopes={['commands']}
|
scopes={['commands']}
|
||||||
@ -47,17 +46,17 @@ import PageTitle from 'components/PageTitle';
|
|||||||
srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x"
|
srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x"
|
||||||
/>
|
/>
|
||||||
</SlackAuthLink>
|
</SlackAuthLink>
|
||||||
</div>}
|
</Section>}
|
||||||
|
|
||||||
<div className={styles.section}>
|
<Section>
|
||||||
<h2 className={styles.sectionHeader}>API access</h2>
|
<h2>API access</h2>
|
||||||
<p>
|
<HelpText>
|
||||||
Create API tokens to hack on your Atlas.
|
Create API tokens to hack on your Atlas.
|
||||||
Learn more in <a href>API documentation</a>.
|
Learn more in <Link to="/developers">API documentation</Link>.
|
||||||
</p>
|
</HelpText>
|
||||||
|
|
||||||
{this.store.apiKeys &&
|
{this.store.apiKeys &&
|
||||||
<table className={styles.apiKeyTable}>
|
<Table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{this.store.apiKeys &&
|
{this.store.apiKeys &&
|
||||||
this.store.apiKeys.map(key => (
|
this.store.apiKeys.map(key => (
|
||||||
@ -70,21 +69,18 @@ import PageTitle from 'components/PageTitle';
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>}
|
</Table>}
|
||||||
|
<InlineForm
|
||||||
<div>
|
placeholder="Token name"
|
||||||
<InlineForm
|
buttonLabel="Create token"
|
||||||
placeholder="Token name"
|
name="inline_form"
|
||||||
buttonLabel="Create token"
|
value={this.store.keyName}
|
||||||
name="inline_form"
|
onChange={this.store.setKeyName}
|
||||||
value={this.store.keyName}
|
onSubmit={this.store.createApiKey}
|
||||||
onChange={this.store.setKeyName}
|
disabled={this.store.isFetching}
|
||||||
onSubmit={this.store.createApiKey}
|
/>
|
||||||
disabled={this.store.isFetching}
|
</Section>
|
||||||
/>
|
</Flex>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CenteredContent>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,4 +144,18 @@ class InlineForm extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Section = styled.div`
|
||||||
|
margin-bottom: 40px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Table = styled.table`
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
td {
|
||||||
|
margin-right: 20px;
|
||||||
|
color: ${color.slate};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export default Settings;
|
export default Settings;
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
@import '~styles/constants.scss';
|
|
||||||
|
|
||||||
.section {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sectionHeader {
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apiKeyTable {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
td {
|
|
||||||
margin-right: 20px;
|
|
||||||
color: #969696;
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user