Skip to content

Commit

Permalink
fix: changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalCodes committed May 21, 2024
1 parent 32a43aa commit 059e59c
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prodtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}
1 change: 1 addition & 0 deletions src/components/private/events/create/CreateEvents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const CreateEvents = ({ setshowCreateModal }) => {

const handleCreateBase64 = useCallback(async (e) => {
const base64 = await convertToBase64(e);
console.log("🚀 ~ handleCreateBase64 ~ base64:", base64);
setevent((prevEvent) => ({ ...prevEvent, coverImage: base64 }));
e.target.value = "";
}, []);
Expand Down
4 changes: 2 additions & 2 deletions src/components/private/landing/Landing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const Landing = () => {
<>
<h1>We connect NGOs,</h1>
<h1>
Charities and <span>you.</span>
Charities and <span>you</span>
</h1>
</>
) : (
<h1>
We connect NGOs, charities and <span>you.</span>
We connect NGOs, charities and <span>you</span>
</h1>
)}

Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/buttons/globalbutton/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const Button = ({
size = "",
fontweight = "",
to = "",
disabled = false,
disabled,
isLoading = false,
cypressfield = "",
onClickfunction,
...props
}) => {
const classes = `btn ${styles.btn} ${className} ${styles[variant]} ${
const classes = `btn ${styles.btn} ${className} ${styles[variant]} ${
size ? styles[size] : ""
} ${fontweight ? styles[fontweight] : ""}`;

Expand Down
8 changes: 7 additions & 1 deletion src/components/shared/buttons/globalbutton/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@
color: black;
border: black solid 1px;
cursor: not-allowed;
opacity: 0.3;
opacity: 0.5;
}

.btn {
cursor: pointer;
}

.disabled {
cursor: not-allowed !important;
opacity: 0.5 !important;
pointer-events: none !important;
}
84 changes: 40 additions & 44 deletions src/components/shared/profileCompletion/ProfileCompletion.jsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
import Cookies from "js-cookie";
/* eslint-disable no-unused-vars */
import React, { useEffect, useState } from "react";
import { IoMdCloseCircleOutline } from "react-icons/io";
import { useDispatch, useSelector } from "react-redux";

import { useSWRConfig } from "swr";
import { ProfileElements } from "../../../constants";
import { clubEndpoints } from "../../../integrations/ApiEndpoints";
import { updateUserData } from "../../../redux/slice/userSlice";
import { UpdateUser } from "../../../service/MilanApi";
import { showErrorToast, showSuccessToast } from "../../../utils/Toasts";
import { useSelector } from "react-redux";

import getProfileFields from "../../../utils/getProfileFields";
import Button from "../buttons/globalbutton/Button";
import "./ProfileCompletion.scss";

const ProfileCompletion = ({
setShowProfileModal,
editProfile,
seteditProfile,
}) => {
const ProfileCompletion = ({ editProfile }) => {
console.log("🚀 ~ ProfileCompletion ~ editProfile:", editProfile);
const [part, setPart] = useState(editProfile ? 2 : 1);
const [currentStep, setcurrentStep] = useState(2);
const [currentIndex, setcurrentIndex] = useState(0);
const [formData, setFormData] = useState({});
const [errors, setErrors] = useState({});
const user = useSelector((state) => state.user);
const dispatch = useDispatch();
const { mutate } = useSWRConfig();
console.log("🚀 ~ user:", user);

useEffect(() => {
if (editProfile) {
Expand Down Expand Up @@ -57,42 +47,44 @@ const ProfileCompletion = ({

const handleSubmit = async (e) => {
e.preventDefault();
const response = await UpdateUser(formData);
if (response?.status !== 200) {
showErrorToast(response?.data?.message);
} else {
dispatch(updateUserData(formData));
setFormData({});
setShowProfileModal(false);
seteditProfile(false);
showSuccessToast(response?.data?.message);
mutate(clubEndpoints.details(user?.userName));
}

// formData is an object
// lenght of an object
console.log(Object.keys(formData).length);
// const response = await UpdateUser(formData);
// if (response?.status !== 200) {
// showErrorToast(response?.data?.message);
// } else {
// dispatch(updateUserData(formData));
// setFormData({});
// setShowProfileModal(false);
// seteditProfile(false);
// showSuccessToast(response?.data?.message);
// mutate(clubEndpoints.details(user?.userName));
// }
};

return (
<div className="profilecompletion_overlay">
<div className="profilecompletion_modal">
<IoMdCloseCircleOutline
className="crossButton"
onClick={() => {
setShowProfileModal(false);
seteditProfile(false);
Cookies.set("skipProfileCompletion", "true", { expires: 7 });
}}
/>

<div className="profilecompletion_header">
<h1> {editProfile ? "Edit Profile" : `We're almost done`} </h1>
{!editProfile && (
{part === 1 ? (
<h1> Choose Account Type </h1>
) : (
<h1> {editProfile ? "Edit Profile" : `We're almost done`} </h1>
)}

{part === 1 ? (
<p>Your Account Type is permanent and cannot be changed later.</p>
) : !editProfile ? (
<p>
Please complete your profile to enjoy the full benefits of the
platform
platform.
</p>
)}
) : null}
</div>

<form>
{/* <form>
{fields.slice(currentIndex, currentIndex + 2).map((elId) => {
const formElement = ProfileElements.find(
(element) => element.id === elId,
Expand Down Expand Up @@ -123,7 +115,7 @@ const ProfileCompletion = ({
</div>
);
})}
</form>
</form> */}

<div className="profilecompletion_btndiv">
<Button
Expand All @@ -134,7 +126,11 @@ const ProfileCompletion = ({
Previous
</Button>
{currentStep == totalfields ? (
<Button variant="solid" onClickfunction={handleSubmit}>
<Button
variant="solid"
onClickfunction={handleSubmit}
disabled={Object.keys(formData).length === 0}
>
Finish
</Button>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
font-size: 2rem;
font-weight: 700;
color: var(--secondary);
font-family: var(--poppins);
font-family: var(--outfit);

@media screen and (max-width: 500px) {
font-size: 1.5rem;
Expand Down
103 changes: 52 additions & 51 deletions src/pages/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,18 @@ const Dashboard = () => {
<h1 className="profile_header_name dashboard_heading">
{data?.name}{" "}
</h1>
<h2 className="profile_header_tagline">
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Impedit cum laudantium
</h2>
{data?.tagline ? (
<h2 className="profile_header_tagline">{data?.tagline}</h2>
) : (
<h2
className="profile_header_tagline"
style={{ opacity: 0 }}
>
{" "}
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Impedit cum laudantium
</h2>
)}
</div>
<Button
variant="solid"
Expand All @@ -163,10 +171,15 @@ const Dashboard = () => {
<div className="header_mobile">
<div className="name">
<h1 className="profile_header_name">{data?.name} </h1>
<h2 className="profile_header_tagline">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit
cum laudantium
</h2>
{data?.tagline ? (
<h2 className="profile_header_tagline">{data?.tagline}</h2>
) : (
<h2 className="profile_header_tagline" style={{ opacity: 0 }}>
{" "}
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Impedit cum laudantium
</h2>
)}
</div>
<Button
variant="solid"
Expand All @@ -179,54 +192,42 @@ const Dashboard = () => {
</div>

<div className="dashboard_body">
<div className="about">
<h1 className="dashboard_heading">About Us</h1>
<div className="about_content">
<p
className={`about_content_text ${
isExpanded ? "expanded" : ""
}`}
>
Lorem ipsum dolor sit amet consectetur, adipisicing elit.
Officiis pariatur fugit maiores eligendi, perspiciatis,
assumenda similique deserunt omnis exercitationem voluptate
porro iste velit, debitis nobis? Hic, rerum! Officiis rerum
reiciendis impedit numquam harum, omnis quasi qui cupiditate,
accusamus sed ad ipsam aspernatur cumque adipisci molestias
aperiam molestiae, nulla doloribus minus! Fugiat, quas nisi.
Eum corrupti dolore quas tenetur veritatis nam, quae dolores
nesciunt ducimus maiores consectetur minus harum iusto eaque
cupiditate doloremque, laudantium facere dolorum sequi, sit
distinctio! Animi eligendi cum nesciunt ducimus maiores
nesciunt ducimus maiores consectetur minus harum iusto eaque
cupiditate doloremque, laudantium facere dolorum sequi, sit
distinctio! Animi eligendi cum nesciunt ducimus maiores
nesciunt ducimus maiores consectetur minus harum iusto eaque
cupiditate doloremque, laudantium facere dolorum sequi, sit
distinctio! Animi eligendi cum nesciunt ducimus maiores
consectetur minus harum iusto eaque cupiditate doloremque,
laudantium facere dolorum sequi, sit distinctio! Animi
eligendi cum
</p>
<div className="readmore_div">
{!isExpanded && (
<span onClick={toggleExpand} className="readmore_div_span">
. . . Read More
</span>
)}
{data?.description && (
<div className="about">
<h1 className="dashboard_heading">About Us</h1>
<div className="about_content">
<p
className={`about_content_text ${
isExpanded ? "expanded" : ""
}`}
>
{data?.description}
</p>
<div className="readmore_div">
{!isExpanded && (
<span
onClick={toggleExpand}
className="readmore_div_span"
>
. . . Read More
</span>
)}
</div>
</div>
</div>
</div>
)}

<div className="events">
<h1 className="dashboard_heading">Events Hosted</h1>
{data?.events && (
<div className="events">
<h1 className="dashboard_heading">Events Hosted</h1>

<div className="events_grid">
{events?.map((event, id) => (
<EventsMarqueeCards event={event} key={id} />
))}
<div className="events_grid">
{events?.map((event, id) => (
<EventsMarqueeCards event={event} key={id} />
))}
</div>
</div>
</div>
)}
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/utils/getProfileFields.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function getMissingElements(info) {
console.log("🚀 ~ getMissingElements ~ info:", info);
const missing = [];

if (info?.userType === "club") {
Expand Down

0 comments on commit 059e59c

Please sign in to comment.