-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(robot-page): 🎉 update robot-page layout
- Loading branch information
1 parent
1a19655
commit c90a467
Showing
7 changed files
with
101 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,27 @@ | ||
import React, { Fragment, ReactElement, useEffect, useState } from "react"; | ||
import useRobot from "../../hooks/useRobot"; | ||
import { useAppSelector } from "../../hooks/redux"; | ||
import { ReactElement } from "react"; | ||
|
||
export default function HiddenFrame(): ReactElement { | ||
const [iframeKey, setIframeKey] = useState<number>(0); | ||
const { responseRobot, setIsSettedCookie, isSettedCookie } = useRobot(); | ||
const { urls } = useAppSelector((state) => state.robot); | ||
|
||
useEffect(() => { | ||
const timer = setInterval( | ||
() => { | ||
setIframeKey(iframeKey + 1); | ||
}, | ||
5 * 60 * 1000, | ||
); // 5 minutes | ||
|
||
return () => { | ||
clearInterval(timer); | ||
}; | ||
}, [iframeKey]); | ||
const { | ||
responseRobot, | ||
isRobotReady, | ||
setIsSettedCookie, | ||
isSettedCookie, | ||
iFrameId, | ||
} = useRobot(); | ||
|
||
return ( | ||
<Fragment> | ||
{responseRobot?.ideIngressEndpoint && ( | ||
<iframe | ||
key={iframeKey} | ||
title="iframe" | ||
allow="clipboard-read" | ||
className="absolute -top-[9999px]" | ||
src={urls?.ide || responseRobot?.ideIngressEndpoint} | ||
onLoad={() => { | ||
setTimeout(() => { | ||
!isSettedCookie && setIsSettedCookie(true); | ||
}, 2500); | ||
}} | ||
/> | ||
)} | ||
</Fragment> | ||
<iframe | ||
key={iFrameId} | ||
title={String(iFrameId)} | ||
allow="clipboard-read" | ||
className="absolute -top-[9999px]" | ||
src={responseRobot?.ideIngressEndpoint} | ||
onLoad={() => { | ||
setTimeout(() => { | ||
isRobotReady && !isSettedCookie && setIsSettedCookie(true); | ||
}, 2500); | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters