Allow viewing diff before revision is written (#5399)

This commit is contained in:
Tom Moor
2023-05-29 22:49:13 -04:00
committed by GitHub
parent 555691c79b
commit 45641103ba
17 changed files with 313 additions and 179 deletions

View File

@@ -7,6 +7,7 @@ import { Link, useRouteMatch } from "react-router-dom";
import styled from "styled-components";
import { TeamPreference } from "@shared/types";
import Document from "~/models/Document";
import Revision from "~/models/Revision";
import DocumentMeta from "~/components/DocumentMeta";
import Fade from "~/components/Fade";
import useStores from "~/hooks/useStores";
@@ -15,12 +16,19 @@ import { documentPath, documentInsightsPath } from "~/utils/routeHelpers";
type Props = {
/* The document to display meta data for */
document: Document;
revision?: Revision;
isDraft: boolean;
to?: LocationDescriptor;
rtl?: boolean;
};
function TitleDocumentMeta({ to, isDraft, document, ...rest }: Props) {
function TitleDocumentMeta({
to,
isDraft,
document,
revision,
...rest
}: Props) {
const { auth, views, comments, ui } = useStores();
const { t } = useTranslation();
const { team } = auth;
@@ -36,7 +44,7 @@ function TitleDocumentMeta({ to, isDraft, document, ...rest }: Props) {
const commentsCount = comments.inDocument(document.id).length;
return (
<Meta document={document} to={to} replace {...rest}>
<Meta document={document} revision={revision} to={to} replace {...rest}>
{team?.getPreference(TeamPreference.Commenting) && (
<>
&nbsp;&nbsp;