Skip to content

Commit

Permalink
remove username
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk0stas committed Oct 12, 2023
1 parent 8762292 commit cb08440
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 52 deletions.
1 change: 1 addition & 0 deletions src/views/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ExistingUser from "./components/ExistingUser/ExistingUser";
const Home = () => {

const { data: session } = useSession()
console.log("⚠️ ~ file: Home.tsx:12 ~ Home ~ session::::", session)

const email = session?.user?.email || "";
const platform = "google";
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home/components/NewUserForm/CreateWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function CreateWallet({formData, email, platform, handleReset}: {
<Flex m={10} gap={5}>
<VStack>
<Text fontWeight={'bold'} fontSize={'3xl'}>
Wallet Creation
Create Wallet
</Text>
{!clickedForInfo &&
<HStack>
Expand Down
101 changes: 50 additions & 51 deletions src/views/Home/components/NewUserForm/NewUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,60 +22,60 @@ const theme = extendTheme({
initialColorMode: 'light',
});

interface Step1Props {
usernameData: {
username?: string;
};
onNext: (data: { username: string }) => void;
}

function Step1({ usernameData, onNext }: Step1Props) {
const [username, setUsername] = useState(usernameData.username || '');

const handleNext = () => {
onNext({ username });
};
// interface Step1Props {
// usernameData: {
// username?: string;
// };
// onNext: (data: { username: string }) => void;
// }

// function Step1({ usernameData, onNext }: Step1Props) {
// const [username, setUsername] = useState(usernameData.username || '');

// const handleNext = () => {
// onNext({ username });
// };

// const handleUsernameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// const value = e.target.value;
// if (/^[a-z0-9._]{0,20}$/.test(value)) {
// setUsername(value);
// }
// };

// return (
// <VStack spacing={4}>
// <Text fontSize="xl">Step 1: Enter Username</Text>
// <Text>
// For now, usernames will be used only as a method of identification. In the future, you will be able to send or receive funds using your username.
// </Text>
// <FormControl maxW={'250px'}>
// <Input
// type="text"
// placeholder="Username"
// value={username}
// onChange={handleUsernameChange}
// />
// </FormControl>
// <Text>
// *only (max 20) alphanumeric lowercase characters, dot &#39;.&#39;, or underscore &#39;_&#39;
// </Text>
// <Button colorScheme="blue" onClick={handleNext}>
// Next
// </Button>
// </VStack>
// );
// }

const handleUsernameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
if (/^[a-z0-9._]{0,20}$/.test(value)) {
setUsername(value);
}
};

return (
<VStack spacing={4}>
<Text fontSize="xl">Step 1: Enter Username</Text>
<Text>
For now, usernames will be used only as a method of identification. In the future, you will be able to send or receive funds using your username.
</Text>
<FormControl maxW={'250px'}>
<Input
type="text"
placeholder="Username"
value={username}
onChange={handleUsernameChange}
/>
</FormControl>
<Text>
*only (max 20) alphanumeric lowercase characters, dot &#39;.&#39;, or underscore &#39;_&#39;
</Text>
<Button colorScheme="blue" onClick={handleNext}>
Next
</Button>
</VStack>
);
}

interface Step2Props {
interface Step1Props {
pinData: {
pin?: string;
};
onPrevious: () => void;
onNext: (data: { pin: string }) => void;
}

function Step2({ pinData, onPrevious, onNext }: Step2Props) {
function Step1({ pinData, onPrevious, onNext }: Step1Props) {
const [pin, setPin] = useState(pinData.pin || '');

const handlePrevious = () => {
Expand All @@ -95,7 +95,7 @@ function Step2({ pinData, onPrevious, onNext }: Step2Props) {

return (
<VStack spacing={4}>
<Text fontSize="xl">Step 2: Enter PIN</Text>
<Text fontSize="xl">Create PIN</Text>
<Text>
This is the most important part.
</Text>
Expand Down Expand Up @@ -165,11 +165,10 @@ function NewUserForm({ email, platform }: any) {
display="flex"
justifyContent="center"
>
{step === 1 && <Step1 usernameData={formData} onNext={handleNext} />}
{step === 2 && (
<Step2 pinData={formData} onPrevious={handlePrevious} onNext={handleNext} />
{step === 1 && (
<Step1 pinData={formData} onPrevious={handlePrevious} onNext={handleNext} />
)}
{step == 3 &&
{step == 2 &&
<VStack>
<CreateWallet formData={formData} email={email} platform={platform} handleReset={handleReset}/>
</VStack>
Expand Down

0 comments on commit cb08440

Please sign in to comment.