feat: handle capture full page and visible part ss

This commit is contained in:
karishmas6
2024-08-05 23:17:11 +05:30
parent ca3b8d5b76
commit 0c03c54eae

View File

@@ -9,7 +9,7 @@ import { PairForEdit } from "../../pages/RecordingPage";
import { useActionContext } from '../../context/browserActions';
import { useBrowserSteps } from '../../context/browserSteps';
import { useSocketStore } from '../../context/socket';
import { ScreenshotSettings } from "../../shared/types";
import { ScreenshotSettings } from '../../shared/types';
interface RightSidePanelProps {
pairForEdit: PairForEdit;
@@ -74,10 +74,21 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => {
}
}, [stopGetText, createSettingsObject, socket]);
// Function to handle screenshot settings based on capture type
const captureScreenshot = (fullPage: boolean) => {
const screenshotSettings: ScreenshotSettings = {
fullPage,
// Add other settings as required
};
socket?.emit('action', { action: 'takeScreenshot', settings: screenshotSettings });
};
const handleCaptureFullpage = () => {
captureScreenshot(true);
};
const handleCaptureVisiblePart = () => {
captureScreenshot(false);
};
return (
@@ -134,4 +145,3 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => {
export const ActionDescription = styled.p`
margin-left: 15px;
`;