Skip to content

Commit

Permalink
update the code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanuka-ChandraYapa committed Oct 23, 2023
1 parent eb711bd commit 3572689
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 48 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 2 additions & 11 deletions src/layouts/authentication/sign-up/VerificationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ export default function VerificationDialog({ open, onClose, email, onSuccess, ad
setTimeRemaining((prevTime) => prevTime - 1);
}, 1000);

// Clear interval when component unmounts or dialog closes
return () => {
clearInterval(interval);
};
} else if (!open) {
// Reset timer when dialog closes
setTimeRemaining(60);
}
}, [open, timeRemaining]);
Expand All @@ -48,7 +46,6 @@ export default function VerificationDialog({ open, onClose, email, onSuccess, ad
.then(function (response) {
console.log(response);
if (response.data.success) {
// alert("Registration successful!");
setAlertType("success");
console.log(alertType);
if (address === "verify") {
Expand All @@ -66,11 +63,6 @@ export default function VerificationDialog({ open, onClose, email, onSuccess, ad
onSuccess();
onClose();
} else if (address === "verify-email") {
// alert(
// "Your new password is " +
// response.data.newpassword +
// " Important: Please imeediately change your password after login"
// );
setAlertPassword(true);
sethideComponent(false);
setNewPassword(response.data.newpassword);
Expand All @@ -96,12 +88,11 @@ export default function VerificationDialog({ open, onClose, email, onSuccess, ad
axios
.post(`${baseURL}/verify`, {
email: email,
verificationCode: "", // Provide an empty code to indicate cancellation
cancel: true, // Add a flag to indicate cancellation
verificationCode: "",
cancel: true,
})
.then(function (response) {
console.log(response);
// setVerificationOpen(false);
onClose();
})
.catch(function (error) {
Expand Down
11 changes: 1 addition & 10 deletions src/layouts/authentication/sign-up/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import bgImage from "assets/images/newspaper2.jpg";

import VerificationDialog from "./VerificationDialog";
import { useNavigate } from "react-router-dom";
// import { useUser } from "utils/userContext";
import baseURL from "config";
import TermModal from "./term";

Expand All @@ -33,7 +32,6 @@ function Cover() {
const [name, setName] = useState("");
const navigate = useNavigate();
const [showSuccessAlert, setShowSuccessAlert] = useState(false);
// const { login } = useUser();

const [verificationOpen, setVerificationOpen] = useState(false);

Expand Down Expand Up @@ -94,11 +92,7 @@ function Cover() {
} else {
return response.json().then((data) => {
console.log(data);
// const userData = data.user;
// console.log(userData);
setVerificationOpen(true);

// navigate("/dashboard");
});
}
})
Expand Down Expand Up @@ -189,8 +183,6 @@ function Cover() {
  I agree the 
</MDTypography>
<MDTypography
// component="a"
// href="#"
variant="button"
fontWeight="bold"
color="info"
Expand Down Expand Up @@ -234,9 +226,8 @@ function Cover() {
<VerificationDialog
open={verificationOpen}
onClose={() => setVerificationOpen(false)}
email={email} // Pass the email to the dialog
email={email}
onSuccess={() => {
// Handle successful verification if needed
setShowSuccessAlert(true);
setTimeout(() => {
setShowSuccessAlert(false);
Expand Down
7 changes: 3 additions & 4 deletions src/layouts/authentication/sign-up/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import MDTypography from "components/MDTypography";

function TermModal({ open, onClose }) {
const cardContentStyle = {
// Add your desired width and height for the modal
width: "80%", // Adjust as needed
height: "80vh", // Adjust as needed
overflowY: "scroll", // Add a vertical scroll when the content exceeds the height
width: "80%",
height: "80vh",
overflowY: "scroll",
};
return (
<Modal
Expand Down
18 changes: 0 additions & 18 deletions src/layouts/dashboard/components/Projects/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/**
=========================================================
* Material Dashboard 2 React - v2.2.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { useEffect, useState } from "react";

// @mui material components
Expand All @@ -38,10 +23,7 @@ function Projects() {
const openMenu = ({ currentTarget }) => setMenu(currentTarget);
const closeMenu = () => setMenu(null);
useEffect(() => {
// This code will run when the component is initially rendered.
console.log("Component is initially rendered.");
setSelectedData(landSale);
// You can place your logic here.
}, []);
const handleMenuItemClick = (dataKey) => {
setSelectedData(dataKey);
Expand Down
3 changes: 1 addition & 2 deletions src/layouts/dashboard/components/adCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const AdCard = () => {
<Grid item key={index} xs={12} md={6} xl={3}>
<Card elevation={3} style={{ padding: "12px", marginBottom: "16px" }}>
<DefaultProjectCard
image={item.Image || categoryToImage[item.category]} // Use categoryToImage mapping
image={item.Image || categoryToImage[item.category]}
label={item.category}
title={item.Title}
description={item.Description}
Expand All @@ -142,7 +142,6 @@ export const AdCard = () => {
color: "info",
label: "view Ad",
}}
// authors={123}
/>
</Card>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/upload/inputImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Checkbox, Container, Typography } from "@mui/material";
import Card from "@mui/material/Card";
import MDButton from "components/MDButton";

import { uploadImages } from "api/sendImg";
import { uploadImages } from "api/advertisementextract/sendImg";
import MDBox from "components/MDBox";
import MDTypography from "components/MDTypography";
import { useAppState } from "utils/userContext";
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/upload/inputPDF.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MDButton from "components/MDButton";
import MDBox from "components/MDBox";
import MDTypography from "components/MDTypography";

import { uploadPdfs } from "api/sendPdf"; // Replace with your API endpoint for PDF upload
import { uploadPdfs } from "api/advertisementextract/sendPdf"; // Replace with your API endpoint for PDF upload
import { useAppState } from "utils/userContext";
import { useState } from "react";
import Loading from "react-loading";
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/upload/inputURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import MDTypography from "components/MDTypography";
import MDInput from "components/MDInput";
import Card from "@mui/material/Card";

import { sendUrlToBackend } from "api/sendUrl";
import { sendUrlToBackend } from "api/advertisementextract/sendUrl";
import Loading from "react-loading";
import { CardContent, Checkbox, Grid, Modal } from "@mui/material";
import emptyImage from "./empty.gif";
Expand Down

0 comments on commit 3572689

Please sign in to comment.