Files
outline/app/scenes/Document/components/ChangesNavigation.tsx
T
Tom MoorandClaude Opus 5.5 9e2565184e chore: Prune stale comments, TODOs, and type suppressions (#14092)
* chore: Remove unused lint disable directives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Replace TODO type suppressions with typed code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove obsolete workaround comments in tests and MediaDimension

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove Tippy compatibility props from Tooltip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Decouple DropdownMenu props from Tooltip and clarify sharing styles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove stale retention TODOs from cleanup tasks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Register relations synchronously and clarify workaround comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Replace Notion import TODOs with descriptive comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-15 08:54:37 -04:00

79 lines
2.3 KiB
TypeScript

import { observer } from "mobx-react";
import Flex from "@shared/components/Flex";
import { s } from "@shared/styles";
import Diff from "@shared/editor/extensions/Diff";
import { CaretDownIcon, CaretUpIcon } from "outline-icons";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import Button from "~/components/Button";
import { useDocumentContext } from "~/components/DocumentContext";
import Tooltip from "~/components/Tooltip";
import useQuery from "~/hooks/useQuery";
export const ChangesNavigation = observer(function ChangesNavigation_() {
const { t } = useTranslation();
const query = useQuery();
const showChanges = query.has("changes");
const { editor, totalChanges } = useDocumentContext();
if (!showChanges) {
return null;
}
const diffExtension = editor?.extensions.extensions.find(
(ext) => ext instanceof Diff
) as Diff | undefined;
const currentChangeIndex = diffExtension?.getCurrentChangeIndex() ?? -1;
return (
<>
{totalChanges > 0 && (
<Flex gap={4} align="center">
<NavigationLabel>
{currentChangeIndex >= 0
? t("{{ current }} of {{ count }} changes", {
current: currentChangeIndex + 1,
count: totalChanges,
})
: t("{{ count }} changes", {
count: totalChanges,
})}
</NavigationLabel>
<Tooltip content={t("Previous change")} side="bottom">
<NavigationButton
icon={<CaretUpIcon />}
onClick={() => editor?.commands.prevChange()}
disabled={!diffExtension}
aria-label={t("Previous change")}
/>
</Tooltip>
<Tooltip content={t("Next change")} side="bottom">
<NavigationButton
icon={<CaretDownIcon />}
onClick={() => editor?.commands.nextChange()}
disabled={!diffExtension}
aria-label={t("Next change")}
/>
</Tooltip>
</Flex>
)}
</>
);
});
const NavigationButton = styled(Button).attrs({
borderOnHover: true,
neutral: true,
})`
width: 32px;
height: 32px;
`;
const NavigationLabel = styled.span`
color: ${s("textSecondary")};
font-size: 14px;
font-weight: 500;
margin-right: 8px;
user-select: none;
`;