Skip to content

Commit

Permalink
Merge pull request #1614 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
dev server
  • Loading branch information
viraka committed Aug 12, 2024
2 parents cff314c + deb9430 commit 0ffb7e5
Show file tree
Hide file tree
Showing 7 changed files with 281 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Analytics from "./modules/Dashboard/modules/UrlShortener/Pages/Analytics"
import Donation from "./modules/Public/Donation/Donation";
import Refund from "./modules/Public/Donation/pages/Refund";
import DonationSuccess from "./modules/Public/Donation/pages/DonationSuccess";
import OpenGrad from "./modules/Dashboard/modules/OpenGrad";

const Profile = lazy(
() => import("./modules/Dashboard/modules/Profile/pages/Profile")
Expand Down Expand Up @@ -241,7 +242,9 @@ const ConnectedDevices = lazy(
);
const Wadhwani = lazy(() => import("./modules/Dashboard/modules/Wadhwani"));

const Trivial = lazy(() => import("./modules/Public/TrivialIdeas/modules/trivial"));
const Trivial = lazy(
() => import("./modules/Public/TrivialIdeas/modules/trivial")
);

function App() {
const AuthChecker = SecureAuthRoutes();
Expand Down Expand Up @@ -280,8 +283,8 @@ function App() {
element: <Refund />
},
{
path:"trivial-ideas",
element:<Trivial />
path: "trivial-ideas",
element: <Trivial />
},
{
path: "/",
Expand Down Expand Up @@ -325,6 +328,10 @@ function App() {
path: "wadhwani",
element: <Wadhwani />
},
{
path: "opengrad",
element: <OpenGrad />
},
{
path: "refer",
element: <Refer />
Expand Down
6 changes: 6 additions & 0 deletions src/modules/Dashboard/layouts/DashboardRootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const DashboardRootLayout = (props: { component?: any }) => {
hasView: true,
icon: <i className="fi fi-sr-building"></i>
},
{
url: "/dashboard/opengrad",
title: "OpenGrad",
hasView: true,
icon: <i className="fi fi-sr-building"></i>
},
{
url: "/dashboard/refer",
title: "Referrals",
Expand Down
116 changes: 116 additions & 0 deletions src/modules/Dashboard/modules/OpenGrad/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* General Styles */
.wrapper h1 {
font-weight: bold;
font-size: 3rem;
}

.course {
display: grid;
grid-template-columns: repeat(3, 1fr); /* Three cards per row */
gap: 2rem; /* Increased gap */
justify-items: center;
}

/* Course Card Styles */
.containercard {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 1.5rem;
margin: 12px;
border: 1px solid #ccc;
border-radius: 8px;
max-width: 300px; /* Increased max-width */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease-in-out;
font-family: Poppins, sans-serif;
gap: 1.5rem;
}

.containercard:hover {
transform: translateY(-5px);
}

/* Image Styles */
.courseImage {
width: 100%;
height: auto;
border-radius: 8px;
margin-bottom: 16px;
}

/* Text Styles */
.title {
font-weight: 500;
font-size: 24px;
margin-bottom: 0.5rem;
}

.desc {
color: #404d61;
font-size: 0.9rem;
}

.duration,
.lessons {
color: #404d61;
opacity: 0.5;
font-weight: 500;
margin-top: 0.5rem;
font-size: 0.9rem;
}

.cta {
background: #456ff6;
color: white;
padding: 0.5rem 1rem;
border-radius: 5px;
cursor: pointer;
border: none;
transition: background-color 0.3s ease-in-out;
}

.cta:hover {
background: #3457d5;
}

/* Responsive Styles */
@media screen and (max-width: 1300px) {
.course {
grid-template-columns: repeat(2, 1fr); /* Two cards per row */
}
.containercard {
width: 45vw;
height: auto; /* Adjust height to maintain aspect ratio */
}
}

@media screen and (max-width: 700px) {
.wrapper h1 {
font-size: 2rem;
}
.course {
grid-template-columns: repeat(1, 1fr); /* One card per row */
}
.containercard {
width: 70vw;
height: auto; /* Adjust height to maintain aspect ratio */
}
}

@media screen and (max-width: 500px) {
.course {
grid-template-columns: repeat(1, 1fr); /* One card per row */
}
.containercard {
width: 85vw;
height: auto; /* Adjust height to maintain aspect ratio */
}
}

.second_view_container {
margin-top: 3rem;
padding: 2rem;
background-color: #ffffff;
}
139 changes: 139 additions & 0 deletions src/modules/Dashboard/modules/OpenGrad/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import React from "react";
import styles from "./index.module.css";
import MuLoader from "@/MuLearnComponents/MuLoader/MuLoader";

interface CourseCardProps {
title: string;
// desc: string;
// duration: string;
url: string;
imageUrl: string;
lessons: string;
}

const OpenGrad: React.FC = () => {
const isLoading = false; // Set to true if you want to show the loader

const hardcodedCourses = [
{
courseId: "1",
url: "home/test",
courseName: "MBA Bundle",
// description:
// "This is a description of course 1. It provides an overview of the course content.",
// CourseDuration: "10",
imageUrl:
"https://imgproxy.learnyst.com/learnyst-user-assets/school-assets/schools/157986/courses/189940/17128570399041564c161_efc4_475b_9151_8549c1ac8969_lyst1712857039920.jpg",
lessons: " "
},
{
courseId: "1",
url: "CAT-Malayalam",
courseName: "CAT (Malayalam)",
// description:
// "This is a description of course 1. It provides an overview of the course content.",
// CourseDuration: "10",
imageUrl:
"https://imgproxy.learnyst.com/learnyst-user-assets/school-assets/schools/157986/courses/195295/1718119061947Screenshot_2024_06_11_at_81501_PMpng_lyst1718119061974.png",
lessons: "17 lessons"
},
{
courseId: "3",
url: "CUET-UG-Malayalam",
courseName: "CUET UG (Malayalam)",
// description:
// "This is a description of course 1. It provides an overview of the course content.",
// CourseDuration: "10",
imageUrl:
"https://imgproxy.learnyst.com/learnyst-user-assets/school-assets/schools/157986/courses/189121/1712066546664ddd958be_3b42_4082_84de_893bf0061a32_lyst1786.jpg",
lessons: "60 lessons"
},
{
courseId: "4",
url: "CUET-UG-Mock-Tests-test",
courseName: "CUET UG Questions & Mocks",
// description:
// "This is a description of course 1. It provides an overview of the course content.",
// CourseDuration: "10",
imageUrl:
"https://imgproxy.learnyst.com/learnyst-user-assets/school-assets/schools/157986/courses/186487/1711619074132fc94d707_d408_4c2d_aeaa_446cd850b7f4_lyst9700.jpg",
lessons: " "
}
// {
// courseId: "",
// url: "root",
// courseName: "",
// // description:
// // "This is a description of course 1. It provides an overview of the course content.",
// // CourseDuration: "10",
// imageUrl: "",
// lessons:
// },
];

const handleCourseSelection = (id: string) => {
// Replace with actual course link if necessary
const courseLink = `https://opengrad-foundation.learnyst.com/learn/${id}`;
window.open(courseLink, "_blank");
};

const CourseCard: React.FC<CourseCardProps> = ({
title,
// desc,
// duration,
url,
imageUrl,
lessons
}) => {
return (
<div className={styles.containercard}>
<img
src={imageUrl}
alt={title}
className={styles.courseImage}
/>
<div className={styles.details}>
<p className={styles.title}>{title}</p>
{/* <p className={styles.desc}>{desc}</p>
<p className={styles.duration}>{duration}hrs</p> */}
<p className={styles.lessons}>{lessons}</p>
</div>
<button
onClick={() => handleCourseSelection(url)}
className={styles.cta}
>
Checkout Course
</button>
</div>
);
};
if (isLoading) {
return <MuLoader />;
}
return (
<div className={styles.wrapper}>
<h1>OpenGrad Courses</h1>
<div className={styles.second_view_container}>
<div className={styles.second_view}>
<div className={styles.courses_container}>
<div className={styles.course}>
{hardcodedCourses.map(course => (
<CourseCard
key={course.courseId}
title={course.courseName}
// desc={course.description}
// duration={course.CourseDuration}
url={course.url}
imageUrl={course.imageUrl}
lessons={course.lessons}
/>
))}
</div>
</div>
</div>
</div>
</div>
);
};

export default OpenGrad;
2 changes: 1 addition & 1 deletion src/modules/Dashboard/modules/Tasks/TaskApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const editTask = async (
bonus_karma?: string
) => {
try {
const formattedBonusTime = bonus_time
const formattedBonusTime = (bonus_time && bonus_time != "")
? new Date(bonus_time).toISOString() // Convert bonus_time to ISO format
: null;

Expand Down
9 changes: 7 additions & 2 deletions src/services/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ export const dashboardRoutes = {
getWadhwaniClientToken: "api/v1/integrations/wadhwani/auth-token/",
getWadhwaniCourses: "api/v1/integrations/wadhwani/course-details/",
getWadhwaniCourseLink: "api/v1/integrations/wadhwani/user-login/",

//OpenGrad
getOpenGradClientToken: "api/v1/integrations/OpenGrad/auth-token/",
getOpenGradCourses: "api/v1/integrations/OpenGrad/course-details/",
getOpenGradCourseLink: "api/v1/integrations/OpenGrad/user-login/"
} as const;

export const organizationRoutes = {
Expand Down Expand Up @@ -244,5 +249,5 @@ export const googleSheetRoutes = {

export const donationRoutes = {
order: "api/v1/donate/order/",
verify : "api/v1/donate/verify/",
}
verify: "api/v1/donate/verify/"
};

0 comments on commit 0ffb7e5

Please sign in to comment.