Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.1.2 #238

Merged
merged 16 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/e2e.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Frontend dashboard of the scholarX platform

## Setup Development Environment

### **Project setup walkthrough :- https://youtu.be/1STopJMM2nM**

1. Clone your forked repository
```
git clone https://github.com/USERNAME/scholarx-frontend
Expand Down
16 changes: 15 additions & 1 deletion src/components/Layout/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ const Navbar: React.FC = () => {
};
}, []);

useEffect(() => {
if (user) {
if (isUserMentor) {
navigate('/mentor/dashboard');
} else if (isUserAdmin) {
navigate('/admin/dashboard/mentor-applications');
} else if (isUserMentee) {
navigate('/mentee/dashboard');
} else {
navigate('/');
}
}
}, [user]);

return (
<div className="fixed top-0 start-0 flex justify-between w-full z-20">
<nav className="bg-white border-gray-200 container mx-auto">
Expand Down Expand Up @@ -114,7 +128,7 @@ const Navbar: React.FC = () => {
</li>
<li>
<a
href="https://sefglobal.org/join-us.html"
href="https://sefglobal.org/apply"
className="py-2 lg:px-3 md:text-sm md:px-1 text-gray-900 rounded hover:bg-gray-100 "
>
Join Us
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenteeCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MenteeCard: React.FC<MenteeCardProps> = ({
</p>
) : (
<>
<p className="text-sm">{mentee.application.position}</p>,
<p className="text-sm">{mentee.application.position}</p>
<p className="text-xs text-gray-500">
{mentee.application.company}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MonthlyCheckInModal: React.FC<{
} = useForm<MenteeCheckInForm>({
resolver: zodResolver(MenteeCheckInSchema),
defaultValues: {
title: '',
month: '',
progressTowardsGoals: '',
generalUpdatesAndFeedback: '',
mediaContentLinks: [],
Expand Down Expand Up @@ -107,9 +107,9 @@ const MonthlyCheckInModal: React.FC<{
Select the month for which you are submitting the progress.
</p>
<select
{...register('title', { required: 'Month is required' })}
{...register('month', { required: 'Month is required' })}
className={`mt-1 block w-full border ${
errors.title ? 'border-red-500' : 'border-gray-300'
errors.month ? 'border-red-500' : 'border-gray-300'
} rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500`}
>
<option value="">Select a month</option>
Expand All @@ -119,9 +119,9 @@ const MonthlyCheckInModal: React.FC<{
</option>
))}
</select>
{errors.title && (
{errors.month && (
<p className="text-red-500 text-xs mt-1">
{errors.title.message}
{errors.month.message}
</p>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MonthlyChecking/MenteeMonthlyChecking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CheckInItem: React.FC<CheckInItemProps> = ({ checkIn }) => {
>
<div className="flex justify-between items-center">
<h4 className="text-lg font-medium text-gray-700 truncate flex-1">
{checkIn.title}
{checkIn.month}
</h4>
<ArrowIcon isExpanded={isExpanded} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MonthlyChecking/MentorMonthlyChecking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const CheckInItem: React.FC<CheckInItemProps> = ({
>
<div className="flex justify-between items-center">
<h4 className="text-lg font-medium text-gray-700 truncate flex-1">
{checkIn.title}
{checkIn.month}
</h4>
<ArrowIcon isExpanded={isExpanded} />
</div>
Expand Down
22 changes: 22 additions & 0 deletions src/hooks/useCountries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useQuery } from '@tanstack/react-query';
import { API_URL } from '../constants';
import axios from 'axios';

const useCountries = () => {
const { isLoading, error, data } = useQuery({
queryKey: ['countries'],
initialData: [],
queryFn: async () => {
const { data } = await axios.get(`${API_URL}/countries`);
return data.data;
},
});

return {
isLoading,
error,
data,
};
};

export default useCountries;
5 changes: 2 additions & 3 deletions src/hooks/usePublicMentors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ export const usePublicMentors = (categoryId: string | null, pageSize = 10) => {
queryFn: fetchPublicMentors,
initialPageParam: 1,
getNextPageParam: (lastPage, pages) => {
if (lastPage.items.length < pageSize) {
return undefined;
if (lastPage.totalItemCount / pageSize > pages.length) {
return pages.length + 1;
}
return pages.length + 1;
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const OngoingMentorshipPrograms: React.FC = () => {
<div className="flex flex-col md:flex-row min-h-screen">
<div className="md:w-1/4 p-4 bg-blue-50">
<h2 className="text-2xl font-semibold mb-4">Approved Mentees</h2>
<div className="h-96 overflow-y-auto md:overflow-y-visible">
<div className="h-96 md:h-[32rem] overflow-y-auto md:overflow-y-auto">
{approvedMentees.map(renderMenteeLink)}
{approvedMentees.length === 0 && (
<p className="text-gray-600">No approved mentees available.</p>
Expand Down
38 changes: 22 additions & 16 deletions src/pages/MentorProfile/MentorProfile.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,28 @@ const MentorProfile: React.FC = () => {
</div>
<div className="flex flex-row md:gap-9 md:m-5 gap-4 mt-4">
<span className="w-0.5 h-24 bg-gray-300 md:block hidden"></span>
<a
href={mentor?.application.linkedin}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
>
Linkedin
</a>
<a
href={mentor?.application.website}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
>
Website
</a>

{mentor?.application.linkedin && (
<a
href={mentor.application.linkedin}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
>
Linkedin
</a>
)}

{mentor?.application.website && (
<a
href={mentor.application.website}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
>
Website
</a>
)}
</div>
</div>
<div className="pb-4">
Expand Down
30 changes: 22 additions & 8 deletions src/pages/MentorRegistration/MentorRegistration.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useLoginModalContext } from '../../contexts/LoginModalContext';
import useMentor from '../../hooks/useMentor';
import { Link } from 'react-router-dom';
import TermsAgreementModalMentor from '../../components/TermsAgreementModal';
import useCountries from '../../hooks/useCountries';

const steps = [
{
Expand Down Expand Up @@ -63,6 +64,8 @@ const MentorRegistrationPage: React.FC = () => {
error: categoriesError,
} = useCategories();

const { data: allCountries, isLoading: countriesLoading } = useCountries();

const {
createMentorApplication,
applicationError,
Expand Down Expand Up @@ -265,14 +268,25 @@ const MentorRegistrationPage: React.FC = () => {
register={register}
error={errors.contactNo}
/>
<FormInput
type="text"
placeholder="United States"
name="country"
label="Country"
register={register}
error={errors.country}
/>
<div className="mb-4">
<label className="block text-sm font-medium text-gray-600">
Country
</label>
{!countriesLoading && (
<select
className="mt-1 p-2 w-1/2 border rounded-md"
{...register('country')}
>
{allCountries.map(
(country: { uuid: string; name: string }) => (
<option key={country.uuid} value={country.uuid}>
{country.name}
</option>
)
)}
</select>
)}
</div>
</>
)}
{currentStep === 1 && (
Expand Down
4 changes: 2 additions & 2 deletions src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ export const MentorApplicationSchema = z.object({
});

export const MenteeCheckInSchema = z.object({
title: z.string().min(1, 'Title is required'),
month: z.string().min(1, 'Month is required'),
generalUpdatesAndFeedback: z
.string()
.min(5, 'Please provide general updates'),
progressTowardsGoals: z.string().min(5, 'Please summarize your progress'),
mediaContentLinks: z
.array(z.string().url('Please provide a valid URL'))
.min(1, 'Please provide at least 1 media links'),
.optional(),
});

export const MentorFeedbackSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export type MenteeCheckInForm = z.infer<typeof MenteeCheckInSchema>;

export interface MonthlyCheckIn {
uuid: string;
title: string;
month: string;
checkInDate: string;
mediaContentLinks: string[];
isCheckedByMentor: boolean;
Expand Down
18 changes: 0 additions & 18 deletions tests/example.spec.ts

This file was deleted.

Loading