From 346373b76adcd93523de627104416c9123435f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=A8=E7=BC=A8?= Date: Fri, 6 Dec 2024 15:03:40 +0800 Subject: [PATCH] feat: redireact to the factory after user installed the github app (#570) --- client/app/github/installed/page.tsx | 40 +++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/client/app/github/installed/page.tsx b/client/app/github/installed/page.tsx index 8f889533..13705f1c 100644 --- a/client/app/github/installed/page.tsx +++ b/client/app/github/installed/page.tsx @@ -1,19 +1,47 @@ 'use client'; -import React from 'react'; +import React, { useState, useEffect } from 'react'; +import { Button } from '@nextui-org/react'; +import { useRouter } from 'next/navigation'; export default function GithubAppInstalled() { + const router = useRouter(); + const [countdown, setCountdown] = useState(5); + + useEffect(() => { + if (countdown > 0) { + const timer = setInterval(() => { + setCountdown((prevCountdown) => prevCountdown - 1); + }, 1000); + return () => clearInterval(timer); + } else { + redirectToLink(); + } + }, [countdown]); + + const redirectToLink = () => { + router.push('/factory/list'); + }; + + const handleClick = () => { + redirectToLink(); + }; + return (
-

+

Installation Approved

-

- Thank you for installing PeterCat's GitHub App! -

+

Thank you for installing PeterCat's GitHub App!

Your Team will now be able to use robots for your GitHub organization!

+
- ) + ); }