import { ActionIcon, Group, Paper, ScrollArea, Switch, Text, } from "@mantine/core"; import HistoryList from "@/features/page-history/components/history-list"; import classes from "./css/history.module.css"; import { useAtom, useAtomValue } from "jotai"; import { activeHistoryIdAtom, activeHistoryPrevIdAtom, diffCountsAtom, highlightChangesAtom, } from "@/features/page-history/atoms/history-atoms"; import HistoryView from "@/features/page-history/components/history-view"; import { useRef } from "react"; import { IconChevronUp, IconChevronDown } from "@tabler/icons-react"; import { useTranslation } from "react-i18next"; import { useDiffNavigation, useHistoryReset, } from "@/features/page-history/hooks"; interface Props { pageId: string; } export default function HistoryModalBody({ pageId }: Props) { const { t } = useTranslation(); const scrollViewportRef = useRef(null); const activeHistoryId = useAtomValue(activeHistoryIdAtom); const activeHistoryPrevId = useAtomValue(activeHistoryPrevIdAtom); const [highlightChanges, setHighlightChanges] = useAtom(highlightChangesAtom); const diffCounts = useAtomValue(diffCountsAtom); useHistoryReset(pageId); const { currentChangeIndex, handlePrevChange, handleNextChange } = useDiffNavigation(scrollViewportRef); return (
{activeHistoryId && }
{activeHistoryId && activeHistoryPrevId && ( setHighlightChanges(e.currentTarget.checked)} styles={{ label: { userSelect: "none", whiteSpace: "nowrap" } }} /> {highlightChanges && diffCounts && diffCounts.total > 0 && ( {currentChangeIndex} of {diffCounts.total} )} )}
); }