Skip to content

Commit

Permalink
Merge pull request #1651 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Dev server
  • Loading branch information
nashnsulthan authored Oct 13, 2024
2 parents 690b268 + 3bf9f25 commit bebf99c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ const CheckMark = () => (
);

const INITIAL_INTERESTS = [
{ title: "Software", value: "software", img: software, checked: false },
{ title: "Maker", value: "maker", img: maker, checked: false },
{ title: "Management", value: "management", img: management, checked: false },
{ title: "Coder", value: "coder", img: software, checked: false },
{ title: "Hardware", value: "hardware", img: maker, checked: false },
{ title: "Manager", value: "manager", img: management, checked: false },
{ title: "Creative", value: "creative", img: creative, checked: false },
{ title: "Others", value: "others", img: others, checked: false }
];

const INITIAL_ENDGOALS = [
{ title: "Job", value: "job", checked: false },
{ title: "Higher Education", value: "higher_education", checked: false },
{ title: "Research & Development", value: "r&d", checked: false },
{ title: "Entrepreneurship", value: "entrepreneurship", checked: false },
{ title: "Gig Works", value: "gig_work", checked: false },
{ title: "Higher Education", value: "higher_education", checked: false },
{ title: "Others", value: "others", checked: false }
];

Expand Down Expand Up @@ -201,9 +202,9 @@ export default function UserInterest() {
<div className={styles.popUp}>
<div className={styles.box}>
<img src={muBrand} alt="mulearn" />
<h1>{stepTwo ? "What describes you the most!" : "Your dynamic area of interest!"}</h1>
<h1>{stepTwo ? "What do you expect by MuLearning " : "What describes you the most!"}</h1>
<p className={styles.subText}>
{stepTwo ? "Choose one or goals you expect from µLearn." : "Please select your interested area"}
{stepTwo ? "Pick your goal." : "Please select your interested area"}
</p>

{stepTwo ? renderItems(endgoals, false) : renderItems(interests, true)}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Dashboard/components/SideNavBarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const SideNavBarBody = ({
<MuButton
text="Account Setting"
icon={<MuSettings />}
onClick={() => navigate("/dashboard/settings")}
onClick={() => navigate("/dashboard/settings/account")}
style={{
color: "#9297AA",
backgroundColor: "#fff"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const IntrestGroupForm = forwardRef(
category: "others"
});
const interestGroup = [
{ label: "Software", value: "software" },
{ label: "Maker", value: "maker" },
{ label: "Coder", value: "coder" },
{ label: "Hardware", value: "hardware" },
{
label: "Management",
value: "management"
label: "Manager",
value: "manager"
},
{ label: "Creative", value: "creative" },
{ label: "Others", value: "others" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "../../../../../Common/Authentication/services/newOnboardingApis";
import ReactSelect, { SingleValue } from "react-select";
import { useLocation, useNavigate } from "react-router-dom";
import { selectOrganization } from "../../settingsApis";

// Define the Option type for ReactSelect
type Option = {
Expand Down Expand Up @@ -61,7 +62,9 @@ export default function CollegePage({}: {}) {
const [roles, setRoles] = useState([{ id: "", title: "" }]);

const [selectedCollege, setSelectedCollege] = useState<Option | null>(null);
const [selectedDepartment, setSelectedDepartment] = useState<Option | null>(null);
const [selectedDepartment, setSelectedDepartment] = useState<Option | null>(
null
);

const getRoleTitle = (id: string) => {
const slice = roles.filter(val => val.id === id);
Expand Down Expand Up @@ -94,34 +97,19 @@ export default function CollegePage({}: {}) {

const onSubmit = async (values: any) => {
const newUserData: any = {
user: {
full_name: userData.user.full_name,
email: userData.user.email,
password: userData.user.password,
district: userData.district
},
organization: {
...(values.department !== "Others" && {
department: values.department
}),
year_of_graduation: values.graduationYear,
organizations: [
...(values.college !== "Others" ? [values.college] : []),
...userData.communities
],
verified: true
}
organization: values.college,
department: values.department
};

if (userData.referral)
newUserData["referral"] = { muid: userData.referral.muid };
// if (userData.referral)
// newUserData["referral"] = { muid: userData.referral.muid };

if (userData.role === "Enabler")
delete newUserData.organization.year_of_graduation;
// if (userData.role === "Enabler")
// delete newUserData.organization.year_of_graduation;

console.log(newUserData);
// console.log(newUserData);

submitUserData({
selectOrganization({
setIsLoading: setIsLoading,
userData: newUserData,
navigate: navigate
Expand Down Expand Up @@ -159,7 +147,10 @@ export default function CollegePage({}: {}) {
onChange={(newValue: SingleValue<Option>) => {
if (newValue) {
setSelectedCollege(newValue);
formik.setFieldValue("college", newValue.value);
formik.setFieldValue(
"college",
newValue.value
);
} else {
setSelectedCollege(null);
formik.setFieldValue("college", "");
Expand Down Expand Up @@ -189,7 +180,10 @@ export default function CollegePage({}: {}) {
onChange={(newValue: SingleValue<Option>) => {
if (newValue) {
setSelectedDepartment(newValue);
formik.setFieldValue("department", newValue.value);
formik.setFieldValue(
"department",
newValue.value
);
} else {
setSelectedDepartment(null);
formik.setFieldValue("department", "");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,61 @@
/* Container Styling */
.container {
display: flex;
justify-content: space-around;
padding: 20px;
justify-content: space-between; /* Better layout distribution */
padding: 30px; /* Increased padding for more space */
gap: 20px; /* Adds space between the columns */
background-color: #f8f9fa; /* Light background for better contrast */
border-radius: 10px; /* Rounded container edges */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

/* Column Styling */
.column {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px; /* Adds space between items in the column */
flex: 1; /* Ensures columns are equally spaced */
}

/* Button Styling */
.button {
padding: 10px 20px;
font-size: 16px;
padding: 15px 25px; /* Increased padding for larger buttons */
font-size: 18px; /* Larger font for better readability */
cursor: pointer;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
transition: background-color 0.3s ease;
border-radius: 8px; /* Slightly more rounded for modern look */
transition: background-color 0.3s ease, transform 0.2s ease; /* Add smooth hover effect */
}

/* Hover Effect for Buttons */
.button:hover {
background-color: #0056b3;
transform: scale(1.05); /* Slightly increases size on hover */
}

/* Increased Button Size for Reset Password and Select College */
#reset-password-btn,
#select-college-btn {
padding: 20px 40px; /* Increase the button size */
font-size: 20px; /* Make the text larger */
}

/* Responsive Design for Smaller Screens */
@media (max-width: 768px) {
.container {
flex-direction: column; /* Stack columns on smaller screens */
padding: 20px;
}

.button {
width: 100%; /* Make buttons full width on smaller screens */
}

#reset-password-btn,
#select-college-btn {
padding: 15px 35px; /* Adjust button size for mobile */
}
}
33 changes: 33 additions & 0 deletions src/modules/Dashboard/modules/Settings/settingsApis.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { AxiosError } from "axios";
import { privateGateway } from "@/MuLearnServices/apiGateways";
import { dashboardRoutes } from "@/MuLearnServices/urls";
import toast from "react-hot-toast";
import { Dispatch, SetStateAction } from "react";
import { NavigateFunction } from "react-router-dom";

export const selectOrganization = async ({
setIsLoading,
userData,
navigate
}: {
setIsLoading: Dispatch<SetStateAction<boolean>>;
userData: Object;
navigate: NavigateFunction;
}) => {
console.log("UserData", userData);
try {
setIsLoading(true);
const res = await privateGateway.post(
"/api/v1/dashboard/user/organization/",
userData
);
if (res.status == 200 && !res.data.hasError) {
toast.success(res.data.message.general[0]);
} else {
toast.error("Org link failed");
}
setIsLoading(false);
} catch (err: any) {
toast.error("Unable to select college.");
}
};

0 comments on commit bebf99c

Please sign in to comment.