Skip to content
Open
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
31 changes: 3 additions & 28 deletions nevo_frontend/app/pools/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createPool, submitSignedXdr, ApiError } from '@/lib/api-client';
import { signTransaction } from '@stellar/freighter-api';
import { contractService } from '@/lib/contract-service';
import { useWalletStore } from '@/src/store/walletStore';
import { parseApiError } from '@/lib/errors';

import {
validateFormData,
Expand Down Expand Up @@ -130,7 +131,6 @@ function CreatePoolPageContent() {
const [submitStep, setSubmitStep] = useState<
'idle' | 'creating' | 'signing' | 'submitting'
>('idle');
const [submitted, setSubmitted] = useState(false);
const [imageFile, setImageFile] = useState<File | null>(null);
const [imagePreviewUrl, setImagePreviewUrl] = useState('');
const [cropPreviewUrl, setCropPreviewUrl] = useState('');
Expand Down Expand Up @@ -355,7 +355,8 @@ function CreatePoolPageContent() {
setSubmitStep('submitting');
await submitSignedXdr(signedResult.signedTxXdr);

setSubmitted(true);
// Redirect to the newly created pool's page after successful submission
router.push(`/pools/${createPoolResult.id}`);
} catch (error) {
setErrors({ submit: parseApiError(error) });
} finally {
Expand All @@ -364,10 +365,6 @@ function CreatePoolPageContent() {
}
}

if (submitted) {
return <SuccessScreen onGoToDashboard={() => router.push('/dashboard')} />;
}

const tagList = form.tags
.split(',')
.map((t) => t.trim())
Expand Down Expand Up @@ -951,28 +948,6 @@ function Step3({
);
}

/* ── Success screen ───────────────────────────────────────────────────────── */

function SuccessScreen({ onGoToDashboard }: { onGoToDashboard: () => void }) {
return (
<main className="mx-auto max-w-2xl px-6 py-24 text-center">
<div className="flex flex-col items-center gap-4">
<div className="flex size-16 items-center justify-center rounded-full bg-success-light text-success">
<CheckCircleIcon />
</div>
<h1 className="text-2xl font-bold">Pool Created!</h1>
<p className="text-[var(--color-text-muted)] max-w-sm">
Your donation pool has been created successfully. Share it with your
community to start receiving contributions.
</p>
<button onClick={onGoToDashboard} className={`mt-4 ${primaryBtn}`}>
Go to Dashboard
</button>
</div>
</main>
);
}

/* ── Field wrapper ────────────────────────────────────────────────────────── */

interface FieldProps {
Expand Down