Files
outline/app/menus/AccountMenu.js
Tom Moor 642c11ff7d Document Archive (#921)
* WIP: Archive

* WIP

* Finishing up archive endpoints

* WIP

* Update docs

* Flow

* Stash

* Add toast message confirmations

* Redirect handling, fixed publishhing info for archived docs

* Redirect to collection instead of home, remove unused pub info

* Account for deleted parent

* Trash -> Archive
Allow reading of archived docs

* Dont overload deletedAt

* Fixes

* 💚

* ParentDocumentId wipe for unarchived sub docs

* Fix: CMD+S exits editing
Fix: Duplicate user name on published but unedited docs

* Improve jank on paginated lists

* Prevent editing when archived

* 💚
Separate lint / flow steps
2019-04-06 16:20:27 -07:00

86 lines
2.3 KiB
JavaScript

// @flow
import * as React from 'react';
import { inject, observer } from 'mobx-react';
import { MoonIcon } from 'outline-icons';
import styled, { withTheme } from 'styled-components';
import UiStore from 'stores/UiStore';
import AuthStore from 'stores/AuthStore';
import Flex from 'shared/components/Flex';
import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
import {
developers,
changelog,
githubIssuesUrl,
mailToUrl,
spectrumUrl,
settings,
} from '../../shared/utils/routeHelpers';
type Props = {
label: React.Node,
ui: UiStore,
auth: AuthStore,
theme: Object,
};
@observer
class AccountMenu extends React.Component<Props> {
handleOpenKeyboardShortcuts = () => {
this.props.ui.setActiveModal('keyboard-shortcuts');
};
handleLogout = () => {
this.props.auth.logout();
};
render() {
const { ui, theme } = this.props;
const isLightTheme = ui.theme === 'light';
return (
<DropdownMenu
style={{ marginRight: 10, marginTop: -10 }}
label={this.props.label}
>
<DropdownMenuItem href={settings()}>Settings</DropdownMenuItem>
<DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
Keyboard shortcuts
</DropdownMenuItem>
<DropdownMenuItem href={developers()} target="_blank">
API documentation
</DropdownMenuItem>
<hr />
<DropdownMenuItem href={changelog()} target="_blank">
Changelog
</DropdownMenuItem>
<DropdownMenuItem href={spectrumUrl()} target="_blank">
Community
</DropdownMenuItem>
<DropdownMenuItem href={mailToUrl()} target="_blank">
Send us feedback
</DropdownMenuItem>
<DropdownMenuItem href={githubIssuesUrl()} target="_blank">
Report a bug
</DropdownMenuItem>
<hr />
<DropdownMenuItem onClick={ui.toggleDarkMode}>
<NightMode justify="space-between">
Night Mode{' '}
<MoonIcon
color={isLightTheme ? theme.textSecondary : theme.primary}
/>
</NightMode>
</DropdownMenuItem>
<hr />
<DropdownMenuItem onClick={this.handleLogout}>Logout</DropdownMenuItem>
</DropdownMenu>
);
}
}
const NightMode = styled(Flex)`
width: 100%;
`;
export default inject('ui', 'auth')(withTheme(AccountMenu));