Skip to content

Commit

Permalink
Merge pull request #30 from Jittojoyes98/develop
Browse files Browse the repository at this point in the history
Bugfix and more.
  • Loading branch information
Jittojoyes98 authored Jun 11, 2024
2 parents ab0231b + bb13501 commit ec00a06
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 127 deletions.
Binary file added assets/dropform-png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/Dashboard/DashboardCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const DashboardCard = ({ formData }) => {
// onClick={() => currentFormDetails(formData)}
>
<div className="form-name">
<p>{formData.form_name}</p>
<p title={formData.form_name} data-toggle="tooltip">
{formData.form_name}
</p>
</div>
</Link>
<Box className="form-details-wrapper">
Expand Down
1 change: 0 additions & 1 deletion src/Editor/InputSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const StyledTab = styled((props) => <Tab disableRipple {...props} />)(
);

const InputSettings = ({ currentInput }) => {
// console.log(questionName);
// issue with selcting the last question on clicking from one question to another.
const [updateQuestionName] = useQuestions((state) => {
return [state.updateQuestionName];
Expand Down
45 changes: 22 additions & 23 deletions src/ForgotPassword/ForgotPassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,39 @@ import React from "react";
import { useAuthContext } from "../auth";
import { useNavigate } from "react-router-dom";



const ForgotPassword = () => {
const { forgotPassword } = useAuthContext()
const navigate=useNavigate()
const handleForm=async(e)=>{
e.preventDefault()
const { forgotPassword } = useAuthContext();
const navigate = useNavigate();
const handleForm = async (e) => {
e.preventDefault();
try {
const { data, error } = await forgotPassword(e.target.uname.value)
if(!error && data){
console.log("Password reset has been sent to your email");
const { data, error } = await forgotPassword(e.target.uname.value);
if (!error && data) {
// show toast or something
navigate("/login")
navigate("/login");
}
if(error){
// form error
if (error) {
// form error
}
} catch (error) {
console.log("there was an unexpected error");
// form error
}
}
};
return (
<div>
<form onSubmit={handleForm}>
<div>
<h1>Forgot password ?</h1>
<label for="uname"><b>Email</b></label>
<input type="email" placeholder="Enter Email" name="uname" required />
</div>
<button type="submit">Send Instructions</button>
</form>
<form onSubmit={handleForm}>
<div>
<h1>Forgot password ?</h1>
<label for="uname">
<b>Email</b>
</label>
<input type="email" placeholder="Enter Email" name="uname" required />
</div>
<button type="submit">Send Instructions</button>
</form>
</div>
)
);
};

export {ForgotPassword};
export { ForgotPassword };
52 changes: 29 additions & 23 deletions src/ForgotPassword/NewPassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,38 @@ import { supabase } from "../_supabase/supabaseInitialize";
import { useNavigate } from "react-router-dom";

const NewPassword = () => {
const { updatePassword } = useAuthContext()
const navigate=useNavigate()
const handleForm=async(e)=>{
e.preventDefault()
try {
const { data, error } = await updatePassword(e.target.uname.value)
console.log(data);
console.log("Password was updated !!");
navigate("/dashboard")
} catch (error) {
alert("There was an error updating your password.")
}
const { updatePassword } = useAuthContext();
const navigate = useNavigate();
const handleForm = async (e) => {
e.preventDefault();
try {
const { data, error } = await updatePassword(e.target.uname.value);
// show toast
navigate("/dashboard");
} catch (error) {
alert("There was an error updating your password.");
}

return (
};

return (
<div>
<form onSubmit={handleForm}>
<div>
<form onSubmit={handleForm}>
<div>
<h1>Your new password</h1>
<label for="uname"><b>Password</b></label>
<input type="text" placeholder="Enter password" name="uname" required />
</div>
<button type="submit">Change</button>
</form>
<h1>Your new password</h1>
<label for="uname">
<b>Password</b>
</label>
<input
type="text"
placeholder="Enter password"
name="uname"
required
/>
</div>
)
<button type="submit">Change</button>
</form>
</div>
);
};

export default NewPassword;
4 changes: 3 additions & 1 deletion src/Input/InputCommon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const InputCommon = ({
spacing={2}
>
<Box className="input-text-handle-content-name">
<Typography>{questionName}</Typography>
<Typography data-toggle="tooltip" title={questionName}>
{questionName}
</Typography>
</Box>
<Box onClick={handleDelete}>
<img
Expand Down
8 changes: 4 additions & 4 deletions src/LoginPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ const LoginPage = () => {
try {
const { data, error } = await signInWithGoogle();
if (!error && data) {
console.log("Google sign in success");
// show toast
}
if (error) {
console.log("There was an error");
// show toast
}
} catch (error) {
setError("There was an unsupported response from server.");
Expand All @@ -74,10 +74,10 @@ const LoginPage = () => {
const handleAnonymous = async () => {
try {
await signInOutsider();
console.log("WE ARE MOVING TO DASHBOARD");
// show toast
navigate("/dashboard");
} catch (error) {
console.log("Error occured");
// show toast
}
};
const formik = useFormik({
Expand Down
106 changes: 66 additions & 40 deletions src/SignupPage/SignUpEmail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import * as yup from "yup";
import { Button, InputAdornment, TextField } from "@mui/material";
import { Link, useNavigate } from "react-router-dom";
import { useAuthContext } from "../auth";
import eyeLineCross from "../../assets/download-eye.svg"
import eyeLine from "../../assets/download-eye-text.svg"


import eyeLineCross from "../../assets/download-eye.svg";
import eyeLine from "../../assets/download-eye-text.svg";

const signupSchema = yup.object({
email: yup
Expand All @@ -25,43 +23,46 @@ const signupSchema = yup.object({
});

const SignUpEmail = () => {
const [error, setError] = useState("")
const [loading, setLoading] = useState(false)
const [show,setShow]=useState(true)
const { signup, currentUser, setCurrentUser, signUpWithGoogle,signUpWithEmail } = useAuthContext()
const navigate = useNavigate()
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
const [show, setShow] = useState(true);
const {
signup,
currentUser,
setCurrentUser,
signUpWithGoogle,
signUpWithEmail,
} = useAuthContext();
const navigate = useNavigate();
const handleForm = async (email, password) => {
try {
setError("")
setLoading(true)
const { data, error } =await signUpWithEmail(email, password)
if(!error && data) {
console.log("Registration Successful. Check your email to confirm your account");
navigate("/dashboard")
}else{
setError("Registration denied,Please see if this email already exist")
setError("");
setLoading(true);
const { data, error } = await signUpWithEmail(email, password);
if (!error && data) {
// show toast
navigate("/dashboard");
} else {
setError("Registration denied,Please see if this email already exist");
}
} catch (error) {
setError("Registration denied,Please see if this email already exist")
setError("Registration denied,Please see if this email already exist");
}
setLoading(false)
}
setLoading(false);
};
const formik = useFormik({
initialValues: {
email: "",
password: "",
},
validationSchema: signupSchema,
onSubmit: (values) => {
console.log(values);
handleForm(values.email, values.password)
handleForm(values.email, values.password);
},
});
const HandleFormError = () => {
return (
<p className="validation-error">{formik.errors.email}</p>
)
}
return <p className="validation-error">{formik.errors.email}</p>;
};
const handleErrorBox = () => {
return (
<div className="error-box-wrapper">
Expand All @@ -70,11 +71,11 @@ const SignUpEmail = () => {
<p>{error}</p>
</div>
</div>
)
}
const handleHide=()=>{
setShow(!show)
}
);
};
const handleHide = () => {
setShow(!show);
};
return (
<div className="centre-div auth-height">
<div>
Expand All @@ -86,7 +87,10 @@ const SignUpEmail = () => {
</span>
<div className="login-form-wrapper">
<div className="signup-email-wrapper">
<h2 className="login-title align-center">Get better data with conversational forms, surveys, quizzes & more.</h2>
<h2 className="login-title align-center">
Get better data with conversational forms, surveys, quizzes &
more.
</h2>
<div className="centre-div">
<div className="fix-width ">
<form onSubmit={formik.handleSubmit}>
Expand All @@ -106,7 +110,11 @@ const SignUpEmail = () => {
placeholder="[email protected]"
variant="outlined"
/>
{(formik.touched.email && Boolean(formik.errors.email)) ? HandleFormError() : <></>}
{formik.touched.email && Boolean(formik.errors.email) ? (
HandleFormError()
) : (
<></>
)}
</div>
<div>
<div className="label-wrapper">
Expand All @@ -117,11 +125,15 @@ const SignUpEmail = () => {
endAdornment: (
<InputAdornment position="end">
{show ? (
<img src={eyeLine} className="icon-password" onClick={handleHide} />
<img
src={eyeLine}
className="icon-password"
onClick={handleHide}
/>
) : (
<img
src={eyeLineCross}
className="icon-password"
className="icon-password"
onClick={handleHide}
/>
)}
Expand All @@ -132,27 +144,41 @@ const SignUpEmail = () => {
className="credential-field-inactive"
value={formik.values.password}
onChange={formik.handleChange}
type={show ? "text": "password"}
type={show ? "text" : "password"}
name="password"
placeholder="Atleast 8 characters"
variant="outlined"
/>
{(formik.touched.password && Boolean(formik.errors.password)) ? <p className="validation-error">{formik.errors.password}</p> : <></>}
{formik.touched.password &&
Boolean(formik.errors.password) ? (
<p className="validation-error">
{formik.errors.password}
</p>
) : (
<></>
)}
</div>


<div style={{ marginBottom: "25px", paddingTop: "5px" }}>
{/* <Link to="password/request" className="forgot-link small-text-light">Forgot Password?</Link> */}
</div>
<Button disabled={loading} style={{ marginBottom: "25px" }} variant='contained' type="submit" className='secondary-button auth-button'>Create my free account</Button>
<Button
disabled={loading}
style={{ marginBottom: "25px" }}
variant="contained"
type="submit"
className="secondary-button auth-button"
>
Create my free account
</Button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
)
);
};

export default SignUpEmail;
4 changes: 2 additions & 2 deletions src/SignupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const SignupPage = () => {
try {
const { data, error } = await signInWithGoogle();
if (!error && data) {
console.log("Google sign in success");
// show toast
}
} catch (error) {
console.log("Error occured");
// show toast
}
};

Expand Down
Loading

0 comments on commit ec00a06

Please sign in to comment.