diff --git a/app/models/Share.js b/app/models/Share.js index 3c5305552..c290271a3 100644 --- a/app/models/Share.js +++ b/app/models/Share.js @@ -9,6 +9,7 @@ class Share extends BaseModel { documentId: string; documentTitle: string; documentUrl: string; + lastAccessedAt: ?string; createdBy: User; createdAt: string; updatedAt: string; diff --git a/app/scenes/Settings/Shares.js b/app/scenes/Settings/Shares.js index eaceaa978..b606d56bb 100644 --- a/app/scenes/Settings/Shares.js +++ b/app/scenes/Settings/Shares.js @@ -1,12 +1,13 @@ // @flow import { observer } from "mobx-react"; import * as React from "react"; +import { useTranslation, Trans } from "react-i18next"; import { Link } from "react-router-dom"; import CenteredContent from "components/CenteredContent"; import Empty from "components/Empty"; import HelpText from "components/HelpText"; -import List from "components/List"; import PageTitle from "components/PageTitle"; +import PaginatedList from "components/PaginatedList"; import Subheading from "components/Subheading"; import ShareListItem from "./components/ShareListItem"; import useCurrentTeam from "hooks/useCurrentTeam"; @@ -14,43 +15,40 @@ import useStores from "hooks/useStores"; function Shares() { const team = useCurrentTeam(); + const { t } = useTranslation(); const { shares, auth, policies } = useStores(); const canShareDocuments = auth.team && auth.team.sharing; - const hasSharedDocuments = shares.orderedData.length > 0; const can = policies.abilities(team.id); - React.useEffect(() => { - shares.fetchPage({ limit: 100 }); - }, [shares]); - return ( - -

Share Links

+ +

{t("Share Links")}

- 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. + + 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. + {can.manage && ( {!canShareDocuments && ( - Sharing is currently disabled. + {t("Sharing is currently disabled.")} )}{" "} - You can turn {canShareDocuments ? "off" : "on"} public document - sharing in security settings. + }} + /> )} - Shared Documents - {hasSharedDocuments ? ( - - {shares.published.map((share) => ( - - ))} - - ) : ( - No share links, yet. - )} + {t("Shared documents")} + {t("No share links, yet.")}} + fetch={shares.fetchPage} + renderItem={(item) => } + />
); } diff --git a/app/scenes/Settings/components/ShareListItem.js b/app/scenes/Settings/components/ShareListItem.js index 78cb7b5a1..d948b5179 100644 --- a/app/scenes/Settings/components/ShareListItem.js +++ b/app/scenes/Settings/components/ShareListItem.js @@ -1,23 +1,33 @@ // @flow import * as React from "react"; +import { useTranslation } from "react-i18next"; import Share from "models/Share"; import ListItem from "components/List/Item"; import Time from "components/Time"; import ShareMenu from "menus/ShareMenu"; -type Props = { +type Props = {| share: Share, -}; +|}; const ShareListItem = ({ share }: Props) => { + const { t } = useTranslation(); + const { lastAccessedAt } = share; + return ( - Shared