import { observer } from "mobx-react";
import { EditIcon } from "outline-icons";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import styled from "styled-components";
import breakpoint from "styled-components-breakpoint";
import { IconTitleWrapper } from "@shared/components/Icon";
import CollectionModel from "~/models/Collection";
import { Action } from "~/components/Actions";
import Button from "~/components/Button";
import CenteredContent from "~/components/CenteredContent";
import Flex from "~/components/Flex";
import Heading from "~/components/Heading";
import CollectionIcon from "~/components/Icons/CollectionIcon";
import Scene from "~/components/Scene";
import Text from "~/components/Text";
import Time from "~/components/Time";
import Tooltip from "~/components/Tooltip";
import useMobile from "~/hooks/useMobile";
import usePolicy from "~/hooks/usePolicy";
import { collectionPath } from "~/utils/routeHelpers";
import Overview from "../Collection/components/Overview";
import { AppearanceAction } from "~/components/Sharing/components/Actions";
type Props = {
collection: CollectionModel;
shareId: string;
};
function SharedCollection({ collection, shareId }: Props) {
const { t } = useTranslation();
const can = usePolicy(collection);
const isMobile = useMobile();
const editAction = (
}
to={{
pathname: collectionPath(collection.path, "overview"),
}}
neutral
>
{isMobile ? null : t("Edit")}
);
return (
}
title={
<>
{collection.name}
>
}
actions={
<>
{can.update ? editAction : null}
>
}
>
{collection.name}
{!!shareId && !!collection.updatedAt ? (
{t("Last updated")}{" "}
) : null}
);
}
const CollectionHeading = styled(Heading)`
display: flex;
align-items: center;
position: relative;
margin-left: 40px;
${breakpoint("tablet")`
margin-left: 0;
`}
`;
const SharedMeta = styled(Text)`
margin: -12px 0 2em 0;
font-size: 14px;
`;
export const Collection = observer(SharedCollection);