All files / src/shared/ui/buttons/HistoryApplySnapshotButton HistoryApplySnapshotButton.tsx

66.66% Statements 2/3
100% Branches 0/0
50% Functions 1/2
66.66% Lines 2/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 20 21 22          14x   1x                            
import React from 'react';
import { motion } from 'framer-motion';
import { useAppDispatch } from '@/store/hooks';
import { applyCurrentSnapshot } from '@/entities/history/model';
 
export const HistoryApplySnapshotButton = React.memo(
	function HistoryApplySnapshotButton() {
		const dispatch = useAppDispatch();
 
		return (
			<motion.button
				whileHover={{ scale: 1.04 }}
				whileTap={{ scale: 0.96 }}
				onClick={() => dispatch(applyCurrentSnapshot())}
				className="flex-1 bg-blue-600 hover:bg-blue-700 text-white text-sm py-1 rounded cursor-pointer shadow-sm"
			>
				Apply snapshot
			</motion.button>
		);
	},
);