All files / src/entities/history/ui PreviewOverlay.tsx

25% Statements 1/4
0% Branches 0/2
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19          2x                          
import React from 'react';
import { useAppSelector } from '@/store/hooks';
import { ApplySnapshotButton, ExitPreviewButton } from '@/shared/ui/buttons';
import { selectHistoryIsPreview } from '@/entities/history/model';
 
export const PreviewOverlay = React.memo(function PreviewOverlay() {
	const isPreview = useAppSelector(selectHistoryIsPreview);
 
	if (!isPreview) return null;
 
	return (
		<div className="absolute top-4 left-1/2 -translate-x-1/2 bg-amber-100 border border-amber-300 text-amber-800 px-4 py-2 rounded shadow-md z-[9999] flex items-center gap-4">
			<span className="font-medium">Viewing historical snapshot</span>
			<ApplySnapshotButton />
			<ExitPreviewButton />
		</div>
	);
});