feat: Add view count to shared links in settings

This commit is contained in:
Tom Moor
2022-09-29 08:53:24 -04:00
parent 492affb29a
commit 41da156b0e
4 changed files with 20 additions and 10 deletions

View File

@@ -151,7 +151,7 @@ const useAuthorizedSettingsConfig = () => {
icon: GroupIcon,
},
Shares: {
name: t("Share Links"),
name: t("Shared Links"),
path: "/settings/shares",
component: Shares,
enabled: true,

View File

@@ -67,8 +67,8 @@ function Shares() {
}, [shares.orderedData, shareIds]);
return (
<Scene title={t("Share Links")} icon={<LinkIcon color="currentColor" />}>
<Heading>{t("Share Links")}</Heading>
<Scene title={t("Shared Links")} icon={<LinkIcon color="currentColor" />}>
<Heading>{t("Shared Links")}</Heading>
{can.manage && !canShareDocuments && (
<>

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next";
import { useTheme } from "styled-components";
import Share from "~/models/Share";
import Avatar from "~/components/Avatar";
import Flex from "~/components/Flex";
import TableFromParams from "~/components/TableFromParams";
import Time from "~/components/Time";
@@ -35,12 +36,15 @@ function SharesTable({ canManage, ...rest }: Props) {
Cell: observer(
({ value, row }: { value: string; row: { original: Share } }) =>
value ? (
<>
<Time dateTime={value} addSuffix />{" "}
{t("by {{ name }}", {
name: row.original.createdBy.name,
})}
</>
<Flex align="center" gap={4}>
{row.original.createdBy && (
<Avatar
src={row.original.createdBy.avatarUrl}
alt={row.original.createdBy.name}
/>
)}
<Time dateTime={value} addSuffix />
</Flex>
) : null
),
},
@@ -64,6 +68,11 @@ function SharesTable({ canManage, ...rest }: Props) {
) : null
),
},
{
id: "views",
Header: t("Views"),
accessor: "views",
},
canManage
? {
Header: " ",