Skip to content

Commit

Permalink
feat: redireact to the factory after user installed the github app (#570
Browse files Browse the repository at this point in the history
)
  • Loading branch information
xingwanying authored Dec 6, 2024
1 parent 89a53df commit 346373b
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions client/app/github/installed/page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex h-screen w-full flex-col items-center bg-white pb-16 pt-20 sm:pb-20 md:pt-36 lg:py-32">
<p className='font-display text-4xl font-bold tracking-tight text-slate-900'>
<p className="font-display text-4xl font-bold tracking-tight text-slate-900">
Installation Approved
</p>
<p>
Thank you for installing PeterCat&#x27;s GitHub App!
</p>
<p>Thank you for installing PeterCat&#x27;s GitHub App!</p>
<p>
Your Team will now be able to use robots for your GitHub organization!
</p>
<Button
onPress={handleClick}
className="min-w-[88px] px-4 h-10 inline-block transition-colors bg-[#3F3F46] text-[#FFFFFF] rounded-full leading-10 text-center"
>
Redirecting to the factory in {countdown} seconds...
</Button>
</div>
)
);
}

0 comments on commit 346373b

Please sign in to comment.