mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
- Replace complex multi-step signup flow with simple key-focused design - Add NostrExtensionIndicator component for browser extension detection - Simplify UI to match Soapbox key-step design with emoji and clean layout - Remove unused profile setup, key generation, and download functionality - Keep extension login and placeholder for future key generation - Maintain existing props interface for compatibility with LoginArea
138 lines
4.2 KiB
TypeScript
138 lines
4.2 KiB
TypeScript
// NOTE: This file is stable and usually should not be modified.
|
|
// It is important that all functionality in this file is preserved, and should only be modified if explicitly requested.
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
|
|
|
import { toast } from '@/hooks/useToast';
|
|
|
|
import NostrExtensionIndicator from './NostrExtensionIndicator';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
interface SignupDialogProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
onComplete?: () => void;
|
|
onLogin?: () => void;
|
|
}
|
|
|
|
const SignupDialog: React.FC<SignupDialogProps> = ({ isOpen, onClose, onLogin }) => {
|
|
const [step, setStep] = useState<'key' | 'keygen'>('key');
|
|
|
|
const handleGenerateKey = () => {
|
|
setStep('keygen');
|
|
};
|
|
|
|
const handleHasKey = () => {
|
|
onClose();
|
|
// This would trigger the login dialog to open with the key-add step
|
|
// For now, we'll just show a toast message
|
|
toast({
|
|
title: 'Use Login Instead',
|
|
description: 'Please use the login dialog to enter your existing key.',
|
|
});
|
|
};
|
|
|
|
const handleExtensionLogin = () => {
|
|
if (onLogin) {
|
|
onLogin();
|
|
}
|
|
onClose();
|
|
};
|
|
|
|
// Reset state when dialog opens
|
|
useEffect(() => {
|
|
if (isOpen) {
|
|
setStep('key');
|
|
}
|
|
}, [isOpen]);
|
|
|
|
return (
|
|
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
<DialogContent
|
|
className={cn("max-w-[95vw] sm:max-w-md max-h-[90vh] max-h-[90dvh] p-0 overflow-hidden rounded-2xl flex flex-col")}
|
|
>
|
|
<DialogHeader className={cn('px-6 pt-6 pb-1 relative flex-shrink-0')}>
|
|
<DialogTitle className={cn('font-semibold text-center text-lg')}>
|
|
Sign up
|
|
</DialogTitle>
|
|
</DialogHeader>
|
|
|
|
<div className='px-6 pt-2 pb-6 space-y-6 overflow-y-scroll flex-1'>
|
|
{step === 'key' && (
|
|
<div className='flex flex-col items-center space-y-6'>
|
|
<p className='text-center font-semibold'>
|
|
You need a key to continue
|
|
</p>
|
|
|
|
<div className='text-6xl'>
|
|
🔑
|
|
</div>
|
|
|
|
<div className='flex flex-col items-center space-y-3 w-full'>
|
|
<Button
|
|
className='w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg'
|
|
size='lg'
|
|
onClick={handleGenerateKey}
|
|
>
|
|
Generate key
|
|
</Button>
|
|
|
|
<Button
|
|
variant='ghost'
|
|
className='text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200'
|
|
onClick={handleHasKey}
|
|
>
|
|
I already have a key
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{step === 'keygen' && (
|
|
<div className='text-center space-y-4'>
|
|
<div className='space-y-2'>
|
|
<p className='text-lg font-semibold'>
|
|
Key Generation Coming Soon
|
|
</p>
|
|
<p className='text-sm text-muted-foreground'>
|
|
Key generation feature is being developed. For now, please use an existing key or browser extension.
|
|
</p>
|
|
</div>
|
|
|
|
<Button
|
|
variant='outline'
|
|
onClick={() => setStep('key')}
|
|
className='w-full'
|
|
>
|
|
Back
|
|
</Button>
|
|
</div>
|
|
)}
|
|
|
|
<div className='space-y-4'>
|
|
<div className='relative'>
|
|
<div className='absolute inset-0 flex items-center'>
|
|
<div className='w-full border-t border-gray-300 dark:border-gray-600'></div>
|
|
</div>
|
|
<div className='relative flex justify-center text-sm'>
|
|
<span className='px-3 bg-background text-muted-foreground'>
|
|
or
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<NostrExtensionIndicator
|
|
onLogin={handleExtensionLogin}
|
|
onClose={onClose}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
export default SignupDialog; |