diff --git a/src/app/page.tsx b/src/app/page.tsx index 026b9015..6853aa0b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,16 +1,25 @@ // src/app/page.tsx 'use client'; -import * as React from 'react'; import { GithubAccessPopup } from '@/components/GithubAccessPopup'; +import * as React from 'react'; +import { useState } from 'react'; import { AppLayout } from '../components/AppLayout'; import { Index } from '../components/Dashboard'; const HomePage: React.FC = () => { + const [isWarningConditionAccepted, setIsWarningConditionAccepted] = useState(false); + + const handleWarningConditionAccepted = () => { + if (!isWarningConditionAccepted) { + setIsWarningConditionAccepted(true); + } + }; + return ( - - + + {isWarningConditionAccepted && } ); }; diff --git a/src/components/GithubAccessPopup/index.tsx b/src/components/GithubAccessPopup/index.tsx index f7b7b310..87822a13 100644 --- a/src/components/GithubAccessPopup/index.tsx +++ b/src/components/GithubAccessPopup/index.tsx @@ -7,7 +7,10 @@ import { Modal } from '@patternfly/react-core/dist/dynamic/components/Modal'; import { ModalVariant } from '@patternfly/react-core/dist/dynamic/components/Modal'; import { Button } from '@patternfly/react-core/dist/dynamic/components/Button'; -const GithubAccessPopup: React.FunctionComponent = () => { +interface Props { + onAccept: () => void; +} +const GithubAccessPopup: React.FunctionComponent = ({ onAccept }) => { const [isOpen, setIsOpen] = React.useState(false); React.useEffect(() => { @@ -16,6 +19,7 @@ const GithubAccessPopup: React.FunctionComponent = () => { const envConfig = await res.json(); if (envConfig.DEPLOYMENT_TYPE === 'dev') { setIsOpen(false); + onAccept(); } else { setIsOpen(true); } @@ -23,6 +27,11 @@ const GithubAccessPopup: React.FunctionComponent = () => { showPopupWarning(); }, []); + const setDecisionAndClose = () => { + setIsOpen(false); + onAccept(); + }; + return ( { isOpen={isOpen} onClose={() => setIsOpen(false)} actions={[ - ,