Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -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<boolean>(false);

const handleWarningConditionAccepted = () => {
if (!isWarningConditionAccepted) {
setIsWarningConditionAccepted(true);
}
};

return (
<AppLayout>
<GithubAccessPopup />
<Index />
<GithubAccessPopup onAccept={handleWarningConditionAccepted} />
{isWarningConditionAccepted && <Index />}
</AppLayout>
);
};
Expand Down
13 changes: 11 additions & 2 deletions src/components/GithubAccessPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props> = ({ onAccept }) => {
const [isOpen, setIsOpen] = React.useState(false);

React.useEffect(() => {
Expand All @@ -16,13 +19,19 @@ const GithubAccessPopup: React.FunctionComponent = () => {
const envConfig = await res.json();
if (envConfig.DEPLOYMENT_TYPE === 'dev') {
setIsOpen(false);
onAccept();
} else {
setIsOpen(true);
}
};
showPopupWarning();
}, []);

const setDecisionAndClose = () => {
setIsOpen(false);
onAccept();
};

return (
<Modal
variant={ModalVariant.medium}
Expand All @@ -31,7 +40,7 @@ const GithubAccessPopup: React.FunctionComponent = () => {
isOpen={isOpen}
onClose={() => setIsOpen(false)}
actions={[
<Button key="confirm" variant="primary" onClick={() => setIsOpen(false)}>
<Button key="confirm" variant="primary" onClick={() => setDecisionAndClose()}>
Accept
</Button>,
<Button key="cancel" variant="secondary" onClick={() => signOut()}>
Expand Down