Files
outline/app/scenes/Settings/Shares.tsx
Tom Moor 15b1069bcc chore: Move to Typescript (#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously.

closes #1282
2021-11-29 06:40:55 -08:00

58 lines
2.0 KiB
TypeScript

import { observer } from "mobx-react";
import { LinkIcon } from "outline-icons";
import * as React from "react";
import { useTranslation, Trans } from "react-i18next";
import { Link } from "react-router-dom";
import Empty from "~/components/Empty";
import Heading from "~/components/Heading";
import HelpText from "~/components/HelpText";
import PaginatedList from "~/components/PaginatedList";
import Scene from "~/components/Scene";
import Subheading from "~/components/Subheading";
import useCurrentTeam from "~/hooks/useCurrentTeam";
import useStores from "~/hooks/useStores";
import ShareListItem from "./components/ShareListItem";
function Shares() {
const team = useCurrentTeam();
const { t } = useTranslation();
const { shares, auth, policies } = useStores();
const canShareDocuments = auth.team && auth.team.sharing;
const can = policies.abilities(team.id);
return (
<Scene title={t("Share Links")} icon={<LinkIcon color="currentColor" />}>
<Heading>{t("Share Links")}</Heading>
<HelpText>
<Trans>
Documents that have been shared are listed below. Anyone that has the
public link can access a read-only version of the document until the
link has been revoked.
</Trans>
</HelpText>
{can.manage && (
<HelpText>
{!canShareDocuments && (
<strong>{t("Sharing is currently disabled.")}</strong>
)}{" "}
<Trans
defaults="You can globally enable and disable public document sharing in the <em>security settings</em>."
components={{
em: <Link to="/settings/security" />,
}}
/>
</HelpText>
)}
<Subheading>{t("Shared documents")}</Subheading>
<PaginatedList
items={shares.published}
empty={<Empty>{t("No share links, yet.")}</Empty>}
fetch={shares.fetchPage}
renderItem={(item) => <ShareListItem key={item.id} share={item} />}
/>
</Scene>
);
}
export default observer(Shares);