Skip to content
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
2 changes: 1 addition & 1 deletion components/landing-page/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function Navbar() {
return (
<nav
ref={navbarRef}
className='sticky top-0 z-50 -mt-11 max-h-[88px] bg-[#030303A3] backdrop-blur-[12px]'
className='sticky top-0 z-50 max-h-[88px] bg-[#030303A3] backdrop-blur-[12px]'
>
<div className='mx-auto max-w-[1440px] px-5 py-5 md:px-[50px] lg:px-[100px]'>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { Button } from '@/components/ui/button';
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { AlertCircle, CheckCircle, Loader2 } from 'lucide-react';
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
import { Info, Loader2 } from 'lucide-react';

interface TransactionSigningScreenProps {
onSign: () => void;
Expand All @@ -27,36 +26,13 @@ const TransactionSigningScreen: React.FC<TransactionSigningScreenProps> = ({
errorMessage,
}) => {
return (
<div className='flex h-full items-center justify-center'>
<Card className='w-full max-w-md'>
<CardHeader className='text-center'>
<div className='mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-500/10'>
{isSigning ? (
<Loader2 className='h-8 w-8 animate-spin text-blue-500' />
) : (
<AlertCircle className='h-8 w-8 text-blue-500' />
)}
</div>
<CardTitle className='text-xl'>
{flowStep === 'confirming'
? 'Creating Your Project...'
: isSigning
? 'Signing Transaction...'
: 'Sign Transaction Required'}
</CardTitle>
<CardDescription>
{flowStep === 'confirming'
? 'Please wait while we finalize your project creation.'
: isSigning
? 'Please confirm the transaction in your wallet to complete project creation.'
: 'Your project has been prepared and requires a transaction signature to be finalized.'}
</CardDescription>
</CardHeader>
<CardContent className='space-y-4'>
<TooltipProvider>
<div className='flex h-full items-center justify-center'>
<div className='flex flex-col items-center space-y-4'>
{hasError && errorMessage && (
<div className='rounded-lg border border-red-500/40 bg-red-500/10 p-4'>
<div className='max-w-md rounded-lg border border-red-500/40 bg-red-500/10 p-4'>
<div className='flex items-start gap-2'>
<AlertCircle className='mt-0.5 h-4 w-4 flex-shrink-0 text-red-500' />
<Info className='mt-0.5 h-4 w-4 flex-shrink-0 text-red-500' />
<div>
<h4 className='text-sm font-medium text-red-300'>Error</h4>
<p className='text-sm text-red-200'>{errorMessage}</p>
Expand All @@ -65,73 +41,68 @@ const TransactionSigningScreen: React.FC<TransactionSigningScreenProps> = ({
</div>
)}

<div className='rounded-lg bg-gray-800/50 p-4'>
<h4 className='mb-2 text-sm font-medium text-gray-300'>
What happens next?
</h4>
<ul className='space-y-2 text-sm text-gray-400'>
<li className='flex items-start gap-2'>
<CheckCircle className='mt-0.5 h-4 w-4 flex-shrink-0 text-green-500' />
<span>Your project details have been prepared</span>
</li>
<li className='flex items-start gap-2'>
<CheckCircle className='mt-0.5 h-4 w-4 flex-shrink-0 text-green-500' />
<span>Escrow contract is ready for funding</span>
</li>
<li className='flex items-start gap-2'>
{flowStep === 'confirming' ? (
<Loader2 className='mt-0.5 h-4 w-4 animate-spin text-blue-500' />
) : isSigning ? (
<Loader2 className='mt-0.5 h-4 w-4 animate-spin text-blue-500' />
) : (
<AlertCircle className='mt-0.5 h-4 w-4 text-yellow-500' />
)}
<span>
<div className='flex items-center gap-2'>
<Button
onClick={onSign}
className='w-full max-w-md'
size='lg'
disabled={isSigning || flowStep === 'confirming'}
>
{isSigning || flowStep === 'confirming' ? (
<>
<Loader2 className='mr-2 h-4 w-4 animate-spin' />
{flowStep === 'confirming'
? 'Finalizing project creation...'
: isSigning
? 'Waiting for transaction signature...'
: 'Sign the transaction to activate your project'}
</span>
</li>
</ul>
? 'Creating Project...'
: 'Signing...'}
</>
) : (
'Sign Transaction'
)}
</Button>

{!isSigning && flowStep === 'signing' && (
<Tooltip>
<TooltipTrigger asChild>
<Button variant='ghost' size='icon' className='h-10 w-10'>
<Info className='h-4 w-4' />
</Button>
</TooltipTrigger>
<TooltipContent className='w-80' align='end'>
<div className='space-y-2'>
<h4 className='font-medium'>What happens when you sign?</h4>
<div className='space-y-2 text-sm text-gray-600'>
<p>• Your project will be created on the blockchain</p>
<p>• An escrow contract will be set up for funding</p>
<p>• Team members will receive invitations</p>
<p>• Your project will be visible to the community</p>
</div>
</div>
</TooltipContent>
</Tooltip>
)}
</div>

{flowStep === 'signing' && !isSigning && (
<div className='space-y-2'>
<Button onClick={onSign} className='w-full' size='lg'>
Sign Transaction
</Button>
{hasError && onRetry && (
<Button
onClick={onRetry}
variant='outline'
className='w-full'
size='lg'
>
Try Again
</Button>
)}
</div>
{hasError && onRetry && (
<Button
onClick={onRetry}
variant='outline'
className='w-full max-w-md'
size='lg'
>
Try Again
</Button>
)}

{(isSigning || flowStep === 'confirming') && (
<div className='text-center text-sm text-gray-400'>
<p>
{flowStep === 'confirming'
? 'Please wait while we create your project...'
: 'Please check your wallet for the transaction prompt.'}
</p>
<p className='mt-1'>
{flowStep === 'confirming'
? 'This may take a few moments...'
: 'This may take a few moments...'}
</p>
</div>
<p className='max-w-md text-center text-sm text-gray-400'>
{flowStep === 'confirming'
? 'Please wait while we create your project...'
: 'Please check your wallet for the transaction prompt.'}
</p>
)}
</CardContent>
</Card>
</div>
</div>
</div>
</TooltipProvider>
);
};

Expand Down
17 changes: 14 additions & 3 deletions components/landing-page/project/CreateProjectModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import {
CreateCrowdfundingProjectRequest,
PrepareCrowdfundingProjectResponse,
} from '@/lib/api/types';
import { useWalletSigning } from '@/hooks/use-wallet';
import { useWalletInfo, useWalletSigning } from '@/hooks/use-wallet';
import { useWalletProtection } from '@/hooks/use-wallet-protection';
import { cn } from '@/lib/utils';

type StepHandle = { validate: () => boolean; markSubmitted?: () => void };

Expand Down Expand Up @@ -56,6 +57,8 @@ const CreateProjectModal = ({ open, setOpen }: CreateProjectModalProps) => {
'form' | 'preparing' | 'signing' | 'confirming' | 'success'
>('form');

const { address } = useWalletInfo() || { address: '' };

// Form data state
const [formData, setFormData] = useState<ProjectFormData>({
basic: {},
Expand Down Expand Up @@ -236,7 +239,7 @@ const CreateProjectModal = ({ open, setOpen }: CreateProjectModalProps) => {
backup: contact.backupContact || '',
},
socialLinks: apiSocialLinks,
signer: 'GD4NCQMLAU5Z7HIMNGMKLSFLCA46AILVIB6FJZ7QEJXANFNGBHFR24H6',
signer: address,
};
};

Expand Down Expand Up @@ -692,7 +695,15 @@ Our development is structured in clear phases with measurable milestones and com
)}
<div
ref={contentRef}
className={`min-h-[calc(55vh)] px-4 transition-opacity duration-100 md:px-[50px] lg:px-[75px] xl:px-[150px]`}
className={cn(
'min-h-[calc(55vh)] px-4 transition-opacity duration-100 md:px-[50px] lg:px-[75px] xl:px-[150px]',
flowStep === 'confirming' ||
isSigningTransaction ||
(flowStep === 'signing' &&
unsignedTransaction &&
!isSigningTransaction),
'flex h-full items-center justify-center'
)}
>
{flowStep !== 'form' ? (
<div className='flex h-full items-center justify-center'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export function ProjectSidebarActions({
</BoundlessButton>
)}

{projectStatus === 'Funding' ||
(projectStatus === 'live' && (
{projectStatus === 'funding' ||
projectStatus === 'Validated' ||
projectStatus === 'campaigning' || (
<BoundlessButton
onClick={handleFundClick}
className='flex h-12 flex-1 items-center justify-center gap-2 rounded-lg bg-[#A7F950] text-base font-semibold text-black shadow-lg transition-all duration-200 hover:bg-[#A7F950] hover:shadow-xl'
Expand All @@ -75,7 +76,7 @@ export function ProjectSidebarActions({
>
<span className=''>Back Project</span>
</BoundlessButton>
))}
)}

{projectStatus === 'Completed' && (
<BoundlessButton
Expand Down
Loading