Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.
Merged
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
26 changes: 22 additions & 4 deletions src/components/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ import { TextContent } from '@patternfly/react-core/dist/esm/components/Text/Tex
import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
import { Popover } from '@patternfly/react-core/dist/esm/components/Popover';
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
import { Modal, ModalVariant } from '@patternfly/react-core/dist/esm/components/Modal/Modal';
import { useState } from 'react';
import { Spinner } from '@patternfly/react-core/dist/esm/components/Spinner';

const Index: React.FunctionComponent = () => {
const { data: session } = useSession();
const [pullRequests, setPullRequests] = React.useState<PullRequest[]>([]);
const [error, setError] = React.useState<string | null>(null);
const [isFirstPullDone, setIsFirstPullDone] = React.useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(true);
//const [error, setError] = React.useState<string | null>(null);
const router = useRouter();

const fetchAndSetPullRequests = React.useCallback(async () => {
Expand All @@ -52,8 +57,10 @@ const Index: React.FunctionComponent = () => {

setPullRequests(sortedPRs);
} catch (error) {
setError('Failed to fetch pull requests.');
console.log('Failed to fetch pull requests.' + error);
}
setIsFirstPullDone(true);
setIsLoading(false);
}
}, [session?.accessToken]);

Expand All @@ -74,6 +81,10 @@ const Index: React.FunctionComponent = () => {
}
};

const handleOnClose = () => {
setIsLoading(false);
};

if (!session) {
return <div>Loading...</div>;
}
Expand Down Expand Up @@ -109,8 +120,15 @@ const Index: React.FunctionComponent = () => {
</PageSection>
<PageSection>
<div style={{ marginBottom: '20px' }} />
{error && <div>{error}</div>}
{pullRequests.length === 0 ? (
{!isFirstPullDone && (
<Modal variant={ModalVariant.small} title="Retrieving your submissions" isOpen={isLoading} onClose={() => handleOnClose()}>
<div>
<Spinner size="md" />
Retrieving all your skills and knowledge submissions from taxonomy repository.
</div>
</Modal>
)}
{isFirstPullDone && pullRequests.length === 0 ? (
<EmptyState>
<EmptyStateHeader
titleText="Welcome to InstructLab"
Expand Down