Skip to content

Commit

Permalink
Merge pull request #219 from jaison080/dev
Browse files Browse the repository at this point in the history
Committing before modifying architeture
  • Loading branch information
AchyuthMohan authored Jan 1, 2023
2 parents ad75690 + 130f9f7 commit 38a7933
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 105 deletions.
68 changes: 68 additions & 0 deletions src/Components/InviteEmail/InviteEmail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
function InviteEmail({ data, member, id }) {
return (
<>
<div>
<p>
Hi {member}
{" , "}{" "}
</p>
<p
style={{
paddingLeft: "1.5rem",
}}
>
<b>{data.leader_name}</b> has added you to their team for the project
{" "}
<i>
<a
href={
id
? `https://iedc-collab-frontend.pages.dev/projects/${id}`
: `https://iedc-collab-frontend.pages.dev/projects/`
}
target="_blank"
rel="noreferrer"
>
{data.name}
</a>
</i>{" "}
. Login to{" "}
<a
href="https://www.iedc-collab-frontend.pages.dev"
target="_blank"
rel="noreferrer"
>
IEDC Collab to check out.
</a>
</p>
<br />
<div>
<p>
To view more details , Vist{" "}
<a
href="https://www.iedc-collab-frontend.pages.dev"
target="_blank"
rel="noreferrer"
>
https://www.iedc-collab-frontend.pages.dev
</a>
</p>
</div>
<p>Regards</p>
<p>IEDC MEC Collab Team</p>
<br />
<p>
NOTE : This is an auto generated email.Please DO NOT REPLY to this
mail.
</p>
<p>
<i>
For any queries please visit{" "}
<a href="https://www.iedcmec.in">https://www.iedcmec.in</a>
</i>
</p>
</div>
</>
);
}
export default InviteEmail;
5 changes: 2 additions & 3 deletions src/Components/InviteToProjectModal/InviteToProjectModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ const InviteToProjectModal = ({ user, selectedUser, ...props }) => {
projects.forEach((project, index) => {
if (project.leaderEmail === user.email) {
if (
!project.teamMembers?.some(
(x) => x.toLowerCase() === selectedUser.name.toLowerCase()
)
!project.teamMembers?.some((x) => x === selectedUser.email) &&
project?.isReq === true
)
temp.push(project);
}
Expand Down
117 changes: 82 additions & 35 deletions src/Components/ProjectModal/ProjectModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ import { toast } from "react-toastify";
import Compress from "compress.js";
import axios from "axios";
import { emailUrl } from "../../Utils/urls";
import { renderEmail } from "react-html-email";
import InviteEmail from "../InviteEmail/InviteEmail";
import { FormControlLabel, Radio, RadioGroup } from "@mui/material";

const compress = new Compress();
const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
const [image, setImage] = useState(project?.projectPhoto || "");
const [isReq, setIsReq] = useState(project?.isReq || true);
const [projectPhotoName, setProjectPhotoName] = useState(
project?.projectPhotoName || ""
);
Expand All @@ -28,6 +32,7 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
name: project?.name || "",
desc: project?.desc || "",
req: project?.req || "",
isReq: project?.isReq || true,
links: project?.links?.join(", ") || "",
contactNo: project?.contactNo || "",
githubLink: project?.githubLink || "",
Expand All @@ -36,7 +41,6 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
hiring: project?.hiring ? project.hiring.join(", ") : "",
projectPhoto: project?.projectPhoto,
};

const newProjectSchema = yup.object({
name: yup.string().required("Please add a valid project name").min(3),
desc: yup.string().required("Please add a valid description").min(10),
Expand Down Expand Up @@ -90,8 +94,9 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
axios.post(emailUrl, {
toEmail: member,
subject: "New Project",
content:
"A new project has been added to the website. Please check it out.",
content: renderEmail(
<InviteEmail data={formValues} member={member} />
),
});
} else {
}
Expand All @@ -115,9 +120,14 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
if (sent === false) {
axios.post(emailUrl, {
toEmail: member,
subject: "New Project",
content:
"A new project has been added to the website. Please check it out.",
subject: "Invitation to join IEDC Collab",
content: renderEmail(
<InviteEmail
data={formValues}
member={member}
id={project.id}
/>
),
});
} else {
}
Expand Down Expand Up @@ -174,35 +184,73 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
: ""}
</Form.Text>
</Form.Group>
<Form.Group controlId="formBasicDescription">
<Form.Label>Project Requirements</Form.Label>
<Form.Control
onBlur={props.handleBlur("req")}
value={props.values.req}
style={{ whiteSpace: "pre-wrap" }}
onChange={props.handleChange("req")}
as="textarea"
placeholder="lorem ipsum dolor si amet..."
rows="3"
/>
<Form.Text className="text-danger">
{props.touched.req && props.errors.req ? "" : ""}
</Form.Text>
</Form.Group>
<Form.Group controlId="formTeamMembers">
<Form.Label>Hiring Roles</Form.Label>
<Form.Control
onBlur={props.handleBlur("hiring")}
value={props.values.hiring}
onChange={props.handleChange("hiring")}
type="text"
placeholder="Enter Hiring Roles..."
/>
<Form.Text className="text-right helperText">
Please separate the roles using commas
</Form.Text>
<Form.Group
style={{
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
flexWrap: "wrap",
}}
>
<Form.Label>Are you looking for team members?</Form.Label>
<RadioGroup
row
aria-labelledby="demo-row-radio-buttons-group-label"
name="row-radio-buttons-group"
style={{
marginTop: "10px",
marginLeft: "10px",
}}
value={isReq}
onChange={() => {
setIsReq(!isReq);
}}
>
<FormControlLabel
value={true}
control={<Radio />}
label="Yes"
/>
<FormControlLabel
value={false}
control={<Radio />}
label="No"
/>
</RadioGroup>
</Form.Group>
<br />
{isReq ? (
<>
<Form.Group controlId="formBasicDescription">
<Form.Label>Project Requirements</Form.Label>
<Form.Control
onBlur={props.handleBlur("req")}
value={props.values.req}
style={{ whiteSpace: "pre-wrap" }}
onChange={props.handleChange("req")}
as="textarea"
placeholder="lorem ipsum dolor si amet..."
rows="3"
/>
<Form.Text className="text-danger">
{props.touched.req && props.errors.req ? "" : ""}
</Form.Text>
</Form.Group>
<Form.Group controlId="formTeamMembers">
<Form.Label>Hiring Roles</Form.Label>
<Form.Control
onBlur={props.handleBlur("hiring")}
value={props.values.hiring}
onChange={props.handleChange("hiring")}
type="text"
placeholder="Enter Hiring Roles..."
/>
<Form.Text className="text-right helperText">
Please separate the roles using commas
</Form.Text>
</Form.Group>
<br />
</>
) : null}

<InputGroup controlId="formPhoto" className="photoContainer">
<Form.Label className="photoLabel">
Expand Down Expand Up @@ -233,7 +281,6 @@ const NewProjectForm = ({ onClose, project, setVariable, variable }) => {
}
);
const img1 = results[0];
console.log(img1);
const base64str = results[0].data;
const imgExt = img1.ext;
const compressedImage = Compress.convertBase64ToFile(
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ProjectNav/ProjectNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const ProjectNav = ({ selectedProject }) => {
</div> */}
{/* </div> */}
{selectedProject.teamMembers?.some(
(x) => x.toLowerCase() === currentUser?.displayName.toLowerCase()
) || selectedProject.leader_id === currentUser?.uid ? (
(x) => x === currentUser?.email || selectedProject?.isReq === false
) ? (
""
) : (
<div
Expand Down
1 change: 0 additions & 1 deletion src/Firebase/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const signIn = async (onSigninSuccess = () => {}) => {
email: user.email,
profilePhoto: user.photoURL,
};
console.log(userData);

firebase
.database()
Expand Down
71 changes: 42 additions & 29 deletions src/Pages/DeveloperDetail/DeveloperDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function DeveloperDetails() {
const { currentUser } = useContext(AuthContext);
const [selectedUser, setSelectedUser] = useState({});
const [loading, setLoading] = useState(true);
const {projects}=useContext(ProjectContext)
const { projects } = useContext(ProjectContext);
const [count, setCount] = useState(false);
const [open, setOpen] = useState(false);
const defaultOptions = {
loop: true,
Expand All @@ -41,6 +42,14 @@ function DeveloperDetails() {
useEffect(() => {
getDev(id);
}, [id]);
useEffect(() => {
if (projects)
projects.forEach((project) => {
project.teamMembers?.forEach(
(member) => member === selectedUser?.email && setCount(true)
);
});
}, [projects, selectedUser]);
if (loading) {
return (
<div>
Expand Down Expand Up @@ -215,35 +224,39 @@ function DeveloperDetails() {
</div>
<div className="developer_details_body_right_content">
<div className="developer_details_body_right_content_projects">
{projects.map((project, index) => {
return project.teamMembers?.find(
(member) => member === selectedUser.email
) ? (
<div
className="developer_details_body_right_content_project"
key={index}
onClick={() => {
history.push(`/projects/${project.id}`);
}}
>
<div className="developer_details_body_right_content_project_img">
<img
src={
project.projectPhoto ||
"https://images.unsplash.com/photo-1639413665566-2f75adf7b7ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyN3x8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=60"
}
alt=""
/>
</div>
<div className="developer_details_body_right_content_project_title">
{project.name}
</div>
<div className="developer_details_body_right_content_project_lead">
{project.leader_name}
{count ? (
projects.map((project, index) => {
return project.teamMembers?.find(
(member) => member === selectedUser.email
) ? (
<div
className="developer_details_body_right_content_project"
key={index}
onClick={() => {
history.push(`/projects/${project.id}`);
}}
>
<div className="developer_details_body_right_content_project_img">
<img
src={
project.projectPhoto ||
"https://images.unsplash.com/photo-1639413665566-2f75adf7b7ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyN3x8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=60"
}
alt=""
/>
</div>
<div className="developer_details_body_right_content_project_title">
{project.name}
</div>
<div className="developer_details_body_right_content_project_lead">
{project.leader_name}
</div>
</div>
</div>
) : null;
})}
) : null;
})
) : (
<div className="skill">No Projects Added</div>
)}
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/Pages/Developers/Developers.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ const Developers = () => {
}, [page]);

useEffect(() => {
console.log(branch);

filterDevelopers();
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
2 changes: 0 additions & 2 deletions src/Pages/Developers/Drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ export default function PersistentDrawerLeft({
};
const addSkill = (skill) => {
let oldSkills = selectedSkills;
console.log(oldSkills);
if (oldSkills.find((s) => s === skill)) {
oldSkills = oldSkills.filter((s) => s !== skill);
} else {
oldSkills = [...oldSkills, skill];
}
console.log(oldSkills);
setSelectedSkills(oldSkills);
};

Expand Down
Loading

0 comments on commit 38a7933

Please sign in to comment.