2017-11-27 02:09:55 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import { observer, inject } from "mobx-react";
|
2018-05-23 06:01:49 +00:00
|
|
|
import {
|
2018-06-21 04:33:21 +00:00
|
|
|
DocumentIcon,
|
2018-12-05 06:24:30 +00:00
|
|
|
EmailIcon,
|
2018-05-23 06:01:49 +00:00
|
|
|
ProfileIcon,
|
2018-08-19 23:06:39 +00:00
|
|
|
PadlockIcon,
|
2018-05-23 06:01:49 +00:00
|
|
|
CodeIcon,
|
|
|
|
UserIcon,
|
2020-03-15 03:48:32 +00:00
|
|
|
GroupIcon,
|
2018-05-23 06:01:49 +00:00
|
|
|
LinkIcon,
|
2018-06-01 22:00:48 +00:00
|
|
|
TeamIcon,
|
2020-05-31 01:26:06 +00:00
|
|
|
ExpandedIcon,
|
2020-06-20 20:59:15 +00:00
|
|
|
} from "outline-icons";
|
2020-08-09 05:53:59 +00:00
|
|
|
import * as React from "react";
|
2020-11-30 04:04:58 +00:00
|
|
|
import { withTranslation, type TFunction } from "react-i18next";
|
2020-08-09 05:53:59 +00:00
|
|
|
import type { RouterHistory } from "react-router-dom";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import AuthStore from "stores/AuthStore";
|
|
|
|
import PoliciesStore from "stores/PoliciesStore";
|
2020-07-10 05:33:07 +00:00
|
|
|
import Flex from "components/Flex";
|
2020-06-20 20:59:15 +00:00
|
|
|
import Scrollable from "components/Scrollable";
|
2020-08-09 05:53:59 +00:00
|
|
|
|
|
|
|
import Sidebar from "./Sidebar";
|
2020-06-20 20:59:15 +00:00
|
|
|
import Header from "./components/Header";
|
|
|
|
import HeaderBlock from "./components/HeaderBlock";
|
2020-08-09 05:53:59 +00:00
|
|
|
import Section from "./components/Section";
|
|
|
|
import SidebarLink from "./components/SidebarLink";
|
2020-06-20 20:59:15 +00:00
|
|
|
import Version from "./components/Version";
|
2020-08-09 05:53:59 +00:00
|
|
|
import SlackIcon from "./icons/Slack";
|
|
|
|
import ZapierIcon from "./icons/Zapier";
|
2020-07-18 18:02:40 +00:00
|
|
|
import env from "env";
|
2017-11-27 02:09:55 +00:00
|
|
|
|
2020-09-29 04:08:58 +00:00
|
|
|
const isHosted = env.DEPLOYMENT === "hosted";
|
|
|
|
|
2017-11-27 02:09:55 +00:00
|
|
|
type Props = {
|
2019-08-09 06:09:09 +00:00
|
|
|
history: RouterHistory,
|
2019-08-22 04:41:37 +00:00
|
|
|
policies: PoliciesStore,
|
2017-11-27 02:09:55 +00:00
|
|
|
auth: AuthStore,
|
2020-11-30 04:04:58 +00:00
|
|
|
t: TFunction,
|
2017-11-27 02:09:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
@observer
|
2018-05-05 23:16:08 +00:00
|
|
|
class SettingsSidebar extends React.Component<Props> {
|
2017-11-27 02:09:55 +00:00
|
|
|
returnToDashboard = () => {
|
2020-08-15 00:47:12 +00:00
|
|
|
this.props.history.push("/home");
|
2017-11-27 02:09:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2020-11-30 04:04:58 +00:00
|
|
|
const { policies, t, auth } = this.props;
|
2019-08-22 04:41:37 +00:00
|
|
|
const { team } = auth;
|
|
|
|
if (!team) return null;
|
|
|
|
|
2019-10-06 01:42:03 +00:00
|
|
|
const can = policies.abilities(team.id);
|
2017-11-27 02:09:55 +00:00
|
|
|
|
|
|
|
return (
|
2018-02-11 07:24:12 +00:00
|
|
|
<Sidebar>
|
2017-11-27 02:09:55 +00:00
|
|
|
<HeaderBlock
|
2020-05-31 01:26:06 +00:00
|
|
|
subheading={
|
|
|
|
<ReturnToApp align="center">
|
2020-11-30 04:04:58 +00:00
|
|
|
<BackIcon color="currentColor" /> {t("Return to App")}
|
2020-05-31 01:26:06 +00:00
|
|
|
</ReturnToApp>
|
|
|
|
}
|
2017-11-27 02:09:55 +00:00
|
|
|
teamName={team.name}
|
|
|
|
logoUrl={team.avatarUrl}
|
|
|
|
onClick={this.returnToDashboard}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Flex auto column>
|
2018-05-06 19:46:52 +00:00
|
|
|
<Scrollable shadow>
|
2017-11-27 02:09:55 +00:00
|
|
|
<Section>
|
|
|
|
<Header>Account</Header>
|
2019-01-07 00:12:07 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<ProfileIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Profile")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
|
|
|
<SidebarLink
|
|
|
|
to="/settings/notifications"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<EmailIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Notifications")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
|
|
|
<SidebarLink
|
|
|
|
to="/settings/tokens"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<CodeIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("API Tokens")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2017-11-27 02:09:55 +00:00
|
|
|
</Section>
|
|
|
|
<Section>
|
|
|
|
<Header>Team</Header>
|
2019-08-22 04:41:37 +00:00
|
|
|
{can.update && (
|
2019-01-07 00:12:07 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/details"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<TeamIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Details")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2018-05-31 19:52:03 +00:00
|
|
|
)}
|
2019-08-22 04:41:37 +00:00
|
|
|
{can.update && (
|
2019-01-07 00:12:07 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/security"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<PadlockIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Security")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2018-08-19 23:06:39 +00:00
|
|
|
)}
|
2018-11-18 02:43:46 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/people"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<UserIcon color="currentColor" />}
|
2018-11-18 02:43:46 +00:00
|
|
|
exact={false}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("People")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2020-03-15 03:48:32 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/groups"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<GroupIcon color="currentColor" />}
|
2020-03-15 03:48:32 +00:00
|
|
|
exact={false}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Groups")}
|
2020-03-15 03:48:32 +00:00
|
|
|
/>
|
2019-01-07 00:12:07 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/shares"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<LinkIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Share Links")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2019-08-22 04:41:37 +00:00
|
|
|
{can.export && (
|
2019-01-07 00:12:07 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/export"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<DocumentIcon color="currentColor" />}
|
2020-11-30 04:04:58 +00:00
|
|
|
label={t("Export Data")}
|
2019-01-07 00:12:07 +00:00
|
|
|
/>
|
2018-06-21 04:33:21 +00:00
|
|
|
)}
|
2017-11-27 02:09:55 +00:00
|
|
|
</Section>
|
2019-08-22 04:41:37 +00:00
|
|
|
{can.update && (
|
2018-09-30 15:51:14 +00:00
|
|
|
<Section>
|
2020-11-30 04:04:58 +00:00
|
|
|
<Header>{t("Integrations")}</Header>
|
2018-10-01 00:56:20 +00:00
|
|
|
<SidebarLink
|
|
|
|
to="/settings/integrations/slack"
|
2020-06-20 02:11:02 +00:00
|
|
|
icon={<SlackIcon color="currentColor" />}
|
2019-01-07 00:12:07 +00:00
|
|
|
label="Slack"
|
|
|
|
/>
|
2020-09-29 04:08:58 +00:00
|
|
|
{isHosted && (
|
|
|
|
<SidebarLink
|
|
|
|
to="/settings/integrations/zapier"
|
|
|
|
icon={<ZapierIcon color="currentColor" />}
|
|
|
|
label="Zapier"
|
|
|
|
/>
|
|
|
|
)}
|
2018-09-30 15:51:14 +00:00
|
|
|
</Section>
|
|
|
|
)}
|
2020-09-29 04:08:58 +00:00
|
|
|
{can.update && !isHosted && (
|
2020-08-09 01:53:11 +00:00
|
|
|
<Section>
|
2020-11-30 04:04:58 +00:00
|
|
|
<Header>{t("Installation")}</Header>
|
2020-08-09 01:53:11 +00:00
|
|
|
<Version />
|
|
|
|
</Section>
|
|
|
|
)}
|
2017-11-27 02:09:55 +00:00
|
|
|
</Scrollable>
|
|
|
|
</Flex>
|
2018-02-11 07:24:12 +00:00
|
|
|
</Sidebar>
|
2017-11-27 02:09:55 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-31 01:26:06 +00:00
|
|
|
const BackIcon = styled(ExpandedIcon)`
|
|
|
|
transform: rotate(90deg);
|
|
|
|
margin-left: -8px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const ReturnToApp = styled(Flex)`
|
|
|
|
height: 16px;
|
|
|
|
`;
|
|
|
|
|
2020-11-30 04:04:58 +00:00
|
|
|
export default withTranslation()<SettingsSidebar>(
|
|
|
|
inject("auth", "policies")(SettingsSidebar)
|
|
|
|
);
|