Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login+signup fix , remove babel warning #59

Merged
merged 1 commit into from
Jul 7, 2024
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
26 changes: 23 additions & 3 deletions tracknow/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tracknow/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@types/react-slick": "^0.23.13",
"ajv": "^7.2.4"
}
Expand Down
44 changes: 29 additions & 15 deletions tracknow/web/src/components/User/UserLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as React from "react";
import { Flex, Input, Button, Image, Text, Link, useToast } from "@chakra-ui/react";
import { Flex, Input, Button, Image, Text, Link, useToast, InputRightElement, InputGroup } from "@chakra-ui/react";
import { Link as ReactRouterLink, useNavigate } from 'react-router-dom';
import { Navbar } from "../Navbar/Navbar";
import API from "../../hooks/API";

import { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'

export const UserLogin = () => {

const [username, setUsername] = React.useState("");
Expand All @@ -13,6 +15,7 @@ export const UserLogin = () => {
const [passwordValid, setPasswordValid] = React.useState(false);

const [isLoading, setIsLoading] = React.useState(false);
const [showPassword, setShowPassword] = React.useState(false);

const navigate = useNavigate();
const toast = useToast();
Expand Down Expand Up @@ -65,9 +68,8 @@ export const UserLogin = () => {
<Image boxSize="80px" alignSelf="center" src='./web_svg/arrow_done.svg' alt='track-bnow img' />

<Text marginBottom="10px" alignSelf="center" fontSize='xs'>Welcome, driver. Sign in to continue</Text>

<Input
focusBorderColor='red.500'
focusBorderColor='grey'
placeholder="Username"
type="text"
variant="outline"
Expand All @@ -79,18 +81,30 @@ export const UserLogin = () => {

}}
/>
<Input
focusBorderColor='red.500'
placeholder="Password"
type="password"
variant="outline"
mb={3}
value={password}
onChange={(e) => {
setPassword(e.target.value)
setPasswordValid(e.target.value.length > 0)
}}
/>
<InputGroup>
<Input
focusBorderColor='grey'
placeholder="Password"
type={showPassword ? 'text' : 'password'}
variant="outline"
mb={3}
value={password}
onChange={(e) => {
setPassword(e.target.value)
setPasswordValid(e.target.value.length > 0)
}}
/>
<InputRightElement >
<Button
color={'red'}
variant={'ghost'}
colorScheme='black'
onClick={() => setShowPassword((showPassword) => !showPassword)}>
{showPassword ? <ViewIcon /> : <ViewOffIcon />}
</Button>
</InputRightElement>
</InputGroup>

<Button
colorScheme="red"
mb={3}
Expand Down
51 changes: 34 additions & 17 deletions tracknow/web/src/components/User/UserSignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from "react";
import { Flex, Input, Button, Image, Text, Link, useToast } from "@chakra-ui/react";
import { Flex, Input, Button, Image, Text, Link, useToast, InputRightElement, InputGroup } from "@chakra-ui/react";
import { Link as ReactRouterLink, useNavigate } from "react-router-dom";
import { Navbar } from "../Navbar/Navbar";
import API from "../../hooks/API"
import { ViewIcon, ViewOffIcon } from "@chakra-ui/icons";

export const UserSignUp = () => {

Expand All @@ -13,6 +14,7 @@ export const UserSignUp = () => {
const [passwordValid, setPasswordValid] = React.useState(false);

const [isLoading, setIsLoading] = React.useState(false);
const [showPassword, setShowPassword] = React.useState(false);

const navigate = useNavigate();
const toast = useToast();
Expand Down Expand Up @@ -87,25 +89,40 @@ export const UserSignUp = () => {
setUsername(e.target.value);
setUsernameValid(e.target.value.length >= 5 && e.target.value.length <= 10);
}}
borderColor={usernameValid ? "green.500" : "red.500"}
borderColor={'grey'}
/>
<Text fontSize="xs" color={usernameValid ? "green.500" : "red.500"} mb={2}>
<Text fontSize="10px" color={usernameValid ? "green.500" : "red.500"} mb={2}>
Username must be between 5 and 10 characters long.
</Text>
<Input
focusBorderColor="grey"
placeholder="Password"
type="password"
variant="outline"
mb={3}
value={password}
onChange={(e) => {
setPassword(e.target.value);
setPasswordValid(e.target.value.length >= 8);
}}
borderColor={passwordValid ? "green.500" : "red.500"}
/>
<Text fontSize="xs" color={passwordValid ? "green.500" : "red.500"} mb={2}>
<InputGroup>
<Input
focusBorderColor="grey"
placeholder="Password"
type={showPassword ? 'text' : 'password'}
variant="outline"
mb={3}
value={password}
onChange={(e) => {
setPassword(e.target.value);
setPasswordValid(e.target.value.length >= 8);
}}
borderColor={'grey'}
/>
<InputRightElement>
<Button
color={'red'}
variant={'ghost'}
colorScheme='black'
onClick={() => setShowPassword((showPassword) => !showPassword)}>
{showPassword ? <ViewIcon /> : <ViewOffIcon />}

</Button>


</InputRightElement>
</InputGroup>

<Text fontSize="10px" color={passwordValid ? "green.500" : "red.500"} mb={2}>
Password must be at least 8 characters long.
</Text>
<Button
Expand Down