Skip to content

Commit

Permalink
Merge pull request #1656 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Dev Server
  • Loading branch information
nashnsulthan authored Oct 20, 2024
2 parents d0e5ae2 + 31e19ea commit 013d4ff
Show file tree
Hide file tree
Showing 31 changed files with 1,910 additions and 665 deletions.
413 changes: 245 additions & 168 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@chakra-ui/react": "^2.6.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@types/react-star-ratings": "^2.3.3",
"@types/react-tabs": "^5.0.5",
"axios": "^1.3.4",
"file-saver": "^2.0.5",
Expand All @@ -35,6 +36,7 @@
"react-router-dom": "^6.9.0",
"react-select": "^5.7.7",
"react-spinners": "^0.13.8",
"react-star-ratings": "^2.3.0",
"react-tabs": "^6.0.1",
"react-tag-input-component": "^2.0.2",
"react-tooltip": "^5.18.1",
Expand Down
15 changes: 15 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import UserInterest from "./modules/Common/Authentication/pages/Onboarding/UserI
import LcMeetupIfo from "./modules/Dashboard/modules/LearningCircle/pages/Meetup/LcMeetup";
import OrganizationSetting from "./modules/Dashboard/modules/Settings/pages/Organization/Organization";
import SettingsHome from "./modules/Dashboard/modules/Settings/pages/Settings/SettingsHome";
import LcReportAttendee from "./modules/Dashboard/modules/LearningCircle/pages/LcDashboard/components/LcAttendeeReport";
import LcAdmin from "./modules/Dashboard/modules/LearningCircle/pages/LcAdmin/LcAdmin";

const Profile = lazy(
() => import("./modules/Dashboard/modules/Profile/pages/Profile")
Expand Down Expand Up @@ -365,6 +367,15 @@ function App() {
/>
)
},
{
path: "lc-meetup-verification",
element: (
<AuthChecker
roles={[roles.ADMIN, roles.FELLOW]}
children={<LcAdmin />}
/>
)
},
{
path: "campus-details",
element: (
Expand Down Expand Up @@ -704,6 +715,10 @@ function App() {
path: "learning-circle/meetup/:id",
element: <LcMeetupIfo />
},
{
path: "learning-circle/meetup/:id/attendee-report",
element: <LcReportAttendee />
},
{
path: "learning-circle/details/:id",
element: <LearningCircle />
Expand Down
4 changes: 0 additions & 4 deletions src/modules/Common/Authentication/pages/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ const Onboarding = (props: Props) => {
setDefaultCommunity([
{ value: foundCommunity.id, label: foundCommunity.title }
]);
console.log(defaultCommunity);
}
}
}, [communityAPI]);
Expand Down Expand Up @@ -1065,9 +1064,6 @@ const Onboarding = (props: Props) => {
: null
}
onChange={OnChangeValue => {
console.log(
OnChangeValue
);
formik.setFieldValue(
"community",
OnChangeValue.map(
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ const scheme = z.object({

export default function CollegePage() {
const navigate = useNavigate();

const location = useLocation();
let userData: any = location.state as Object;

const [isloading, setIsLoading] = useState(true);
const [colleges, setColleges] = useState([{ id: "", title: "" }]);
const [departments, setDepartments] = useState([{ id: "", title: "" }]);
Expand All @@ -66,6 +62,8 @@ export default function CollegePage() {
title: ""
});

const ruri = window.location.href.split("=")[1];

const CustomFilter = (
{ label, value }: { label: string; value: string },
string: string
Expand Down Expand Up @@ -93,17 +91,28 @@ export default function CollegePage() {
selectOrganization({
setIsLoading: setIsLoading,
userData: {
organization: values.organization,
department: values.department,
organization:
values.organization == "Others"
? null
: values.organization,
department:
values.department == "Others" ? null : values.department,
graduation_year:
values.graduationYear == null || values.graduationYear != ""
? values.graduationYear
: null
},
navigate: navigate
: null,
is_student: isCollege
}
}).then(res => {
if (res) {
if (ruri) {
navigate(`/${ruri}`);
} else {
navigate("/dashboard/connect-discord");
}
}
});
};
// console.log(userData);
return (
<OnboardingTemplate>
<OnboardingHeader
Expand Down Expand Up @@ -260,9 +269,13 @@ export default function CollegePage() {
variant="outline"
onClick={e => {
e.preventDefault();
navigate(
"/dashboard/connect-discord"
);
if (ruri) {
navigate(`/${ruri}`);
} else {
navigate(
"/dashboard/connect-discord"
);
}
}}
>
Skip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export default function CompanyPage({
// console.log(newUserData);
submitUserData({
setIsLoading: setIsLoading,
userData: newUserData,
navigate: navigate
userData: newUserData
// navigate: navigate
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export default function Rolepage() {

submitUserData({
setIsLoading: setIsLoading,
userData: newUserData,
navigate: navigate
userData: newUserData
// navigate: navigate # want to handle this if this page is used in other places
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export default function SignIn() {
});

const onSubmit = (values: any) => {
console.log(values);

if (!otpForm) {
login(
values.emailOrMuId,
Expand Down Expand Up @@ -153,7 +151,13 @@ export default function SignIn() {
</PowerfulButton>
</div>
<div className={styles.noAccount}>
<a href="/register">
<a
href={
ruri
? `/register/?ruri=${ruri}`
: "/register"
}
>
Don't have an account? Sign up
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default function UserInterest() {
const [stepTwo, setStepTwo] = useState(false);
const [interestGroups, setInterestGroups] = useState<InterestGroups>({});
const navigate = useNavigate();
const ruri = window.location.href.split("=")[1];

useEffect(() => {
const fetchInterestGroups = async () => {
Expand Down Expand Up @@ -153,7 +154,11 @@ export default function UserInterest() {
data
);
toast.success(res.data?.message.general[0]);
navigate("/register/organization");
navigate(
ruri
? `/register/organization/?ruri=${ruri}`
: "/register/organization"
);
} catch (err: any) {
toast.error(
err.response?.data.message.general[0] ||
Expand Down Expand Up @@ -275,9 +280,15 @@ export default function UserInterest() {
<div className={styles.popUp}>
<div className={styles.box}>
<img src={muBrand} alt="mulearn" />
<h1>{stepTwo ? "What do you expect by MuLearning " : "What describes you the most!"}</h1>
<h1>
{stepTwo
? "What do you expect by MuLearning "
: "What describes you the most!"}
</h1>
<p className={styles.subText}>
{stepTwo ? "Pick your goal." : "Please select your interested area"}
{stepTwo
? "Pick your goal."
: "Please select your interested area"}
</p>

{stepTwo
Expand All @@ -292,7 +303,7 @@ export default function UserInterest() {
isLoading={false}
onClick={stepTwo ? handleSubmit : handleContinue}
>
{stepTwo ? "Submit" : "Continue"}
Continue
</PowerfulButton>
)}
</div>
Expand Down
1 change: 0 additions & 1 deletion src/modules/Common/Authentication/pages/ResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const ResetPassword = (props: Props) => {
useEffect(() => {
const paramToken = searchParams.get("token");
setToken(paramToken as string);
console.log(token);
if (token.length > 0 && muid.length === 0) {
getMuid(token, navigate, setMuID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ export const getCompanies = async ({

export const submitUserData = async ({
setIsLoading,
userData,
navigate
userData
}: {
setIsLoading: Dispatch<SetStateAction<boolean>>;
userData: Object;
navigate: NavigateFunction;
}) => {
console.log("UserData", userData);
try {
Expand All @@ -164,13 +162,14 @@ export const submitUserData = async ({
const tokens = res.data.response;
localStorage.setItem("accessToken", tokens.accessToken);
localStorage.setItem("refreshToken", tokens.refreshToken);
navigate("/register/interests");
return true;
} catch (err: any) {
setIsLoading(false);
const messages = err.response.data.message.general[0];
showToasts({
messages: messages
});
return false;
}
};

Expand Down
7 changes: 3 additions & 4 deletions src/modules/Common/Authentication/services/onboardingApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ export const getCommunities = ({

export const selectOrganization = async ({
setIsLoading,
userData,
navigate
userData
}: {
setIsLoading: Dispatch<SetStateAction<boolean>>;
userData: Object;
navigate: NavigateFunction;
}) => {
try {
setIsLoading(true);
Expand All @@ -253,14 +251,15 @@ export const selectOrganization = async ({
);
if (res.status == 200 && !res.data.hasError) {
toast.success(res.data.message.general[0]);
navigate("/dashboard/connect-discord");
return true;
} else {
toast.error("Organization selection failed.");
}
setIsLoading(false);
} catch (err: any) {
toast.error("Unable to select organization.");
}
return false;
};

// POST request for registration
Expand Down
8 changes: 7 additions & 1 deletion src/modules/Dashboard/layouts/DashboardRootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,15 @@ const DashboardRootLayout = (props: { component?: any }) => {
url: "/dashboard/interest-groups",
title: "Interest Groups",
hasView: true,
roles: [roles.ADMIN]
roles: [roles.ADMIN, roles.FELLOW]
// icon: <i className="fi fi-sr-books"></i>
},
{
url: "/dashboard/lc-meetup-verification",
title: "LC Meetup Verification",
hasView: true,
roles: [roles.ADMIN]
},
{
url: "/dashboard/college-levels",
title: "College Levels",
Expand Down
Empty file.
Loading

0 comments on commit 013d4ff

Please sign in to comment.