diff --git a/src/components/Projects/SubmissionRequirement.tsx b/src/components/Projects/SubmissionRequirement.tsx
index 455f7d084..a4ff9fae5 100644
--- a/src/components/Projects/SubmissionRequirement.tsx
+++ b/src/components/Projects/SubmissionRequirement.tsx
@@ -1,14 +1,16 @@
import type { ReactNode } from 'react';
import { cn } from '../../lib/classname.ts';
-import {CheckIcon, CircleDashed, X} from 'lucide-react';
+import { CheckIcon, CircleDashed, Loader, Loader2, X } from 'lucide-react';
+import { Spinner } from '../ReactIcons/Spinner.tsx';
type SubmissionRequirementProps = {
status: 'pending' | 'success' | 'error';
children: ReactNode;
+ isLoading?: boolean;
};
export function SubmissionRequirement(props: SubmissionRequirementProps) {
- const { status, children } = props;
+ const { status, isLoading = false, children } = props;
return (
- {status === 'pending' ? (
-
- ) : status === 'success' ? (
-
- ) : (
-
+ {!isLoading && (
+ <>
+ {status === 'pending' ? (
+
+ ) : status === 'success' ? (
+
+ ) : (
+
+ )}
+ >
+ )}
+
+ {isLoading && (
+
)}
{children}
diff --git a/src/components/Projects/SubmitProjectModal.tsx b/src/components/Projects/SubmitProjectModal.tsx
index 1bcece5da..10f9cfbb3 100644
--- a/src/components/Projects/SubmitProjectModal.tsx
+++ b/src/components/Projects/SubmitProjectModal.tsx
@@ -1,10 +1,8 @@
-import { CheckIcon, CircleDashed, CopyIcon, X } from 'lucide-react';
+import { CheckIcon, CopyIcon, X } from 'lucide-react';
import { Modal } from '../Modal';
-import { useState, type FormEvent, type ReactNode } from 'react';
-import { useToast } from '../../hooks/use-toast';
+import { type FormEvent, useState } from 'react';
import { httpPost } from '../../lib/http';
import { GitHubIcon } from '../ReactIcons/GitHubIcon.tsx';
-import { cn } from '../../lib/classname.ts';
import { SubmissionRequirement } from './SubmissionRequirement.tsx';
import { useCopyText } from '../../hooks/use-copy-text.ts';
@@ -165,6 +163,12 @@ export function SubmitProjectModal(props: SubmitProjectModalProps) {
throw new Error('Add the project page URL to the readme file');
}
+ setVerificationChecks({
+ repositoryExists: 'success',
+ readmeExists: 'success',
+ projectUrlExists: 'success',
+ });
+
const submitProjectUrl = `${import.meta.env.PUBLIC_API_URL}/v1-submit-project/${projectId}`;
const { response: submitResponse, error } =
await httpPost(submitProjectUrl, {
@@ -172,10 +176,12 @@ export function SubmitProjectModal(props: SubmitProjectModalProps) {
});
if (error || !submitResponse) {
- throw new Error(error?.message || 'Failed to submit project');
+ throw new Error(
+ error?.message || 'Error submitting project. Please try again!',
+ );
}
- setSuccessMessage('Repository verified successfully');
+ setSuccessMessage('Solution submitted successfully!');
setIsLoading(false);
onSubmit(submitResponse);
@@ -196,13 +202,22 @@ export function SubmitProjectModal(props: SubmitProjectModalProps) {
-
+
URL must point to a public GitHub repository
-
+
Repository must contain a README file
-
+
README file must contain the{' '}