diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/activity/[activityid]/activity.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/activity/[activityid]/activity.tsx
index 068cd078..1501d19f 100644
--- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/activity/[activityid]/activity.tsx
+++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/activity/[activityid]/activity.tsx
@@ -1,16 +1,15 @@
"use client";
import Link from "next/link";
-import React, { useMemo } from "react";
+import React from "react";
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
import Canva from "@components/Pages/Activities/DynamicCanva/DynamicCanva";
-import styled from "styled-components";
import VideoActivity from "@components/Pages/Activities/Video/Video";
-import useSWR, { mutate } from "swr";
import { Check } from "lucide-react";
import { markActivityAsComplete } from "@services/courses/activity";
-import ToolTip from "@components/StyledElements/Tooltip/Tooltip";
import DocumentPdfActivity from "@components/Pages/Activities/DocumentPdf/DocumentPdf";
import ActivityIndicators from "@components/Pages/Courses/ActivityIndicators";
+import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper";
+import { useRouter } from "next/navigation";
interface ActivityClientProps {
activityid: string;
@@ -20,6 +19,8 @@ interface ActivityClientProps {
course: any;
}
+
+
function ActivityClient(props: ActivityClientProps) {
const activityid = props.activityid;
const courseid = props.courseid;
@@ -27,149 +28,104 @@ function ActivityClient(props: ActivityClientProps) {
const activity = props.activity;
const course = props.course;
-
- async function markActivityAsCompleteFront() {
- const trail = await markActivityAsComplete(orgslug, courseid, activityid);
- mutate(`${getAPIUrl()}activities/activity_${activityid}`);
- mutate(`${getAPIUrl()}courses/meta/course_${courseid}`);
+ function getChapterName(chapterId: string) {
+ let chapterName = "";
+ course.chapters.forEach((chapter: any) => {
+ if (chapter.chapter_id === chapterId) {
+ chapterName = chapter.name;
+ }
+ });
+ return chapterName;
}
+
+
+
+
return (
<>
-
-
{JSON.stringify(activity, null, 2)}
-
-
-
-
-
-
-
- Course
- {course.course.name}
-
-
-
-
- {activity ? (
-
-
- {activity.type == "dynamic" && }
- {/* todo : use apis & streams instead of this */}
- {activity.type == "video" && }
-
- {activity.type == "documentpdf" && }
-
-
-
- {course.trail.activities_marked_complete &&
- course.trail.activities_marked_complete.includes("activity_" + activityid) &&
- course.trail.status == "ongoing" ? (
-
- ) : (
-
- )}
-
-
+
+
+
+
+
+
}content/uploads/img/${course.course.thumbnail}`})
+
+
+
+
Course
+
{course.course.name}
+
- ) : (
)}
- {
}
-
+
+
+
+
+
Chapter : {getChapterName(activity.chapter_id)}
+
{activity.name}
+
+
+
+
+
+
+
+ {activity ? (
+
+
+ {activity.type == "dynamic" &&
}
+ {/* todo : use apis & streams instead of this */}
+ {activity.type == "video" &&
}
+
+ {activity.type == "documentpdf" &&
}
+
+
+
+
+
+
+
+ ) : ()}
+ {}
+
+
>
);
}
-const ActivityThumbnail = styled.div`
- padding-right: 30px;
- justify-self: center;
- img {
- box-shadow: 0px 13px 33px -13px rgba(0, 0, 0, 0.42);
- border-radius: 7px;
- width: 100px;
- height: 57px;
- }
-`;
-const ActivityInfo = styled.div`
- h1 {
- margin-top: 0px;
+
+export function MarkStatus(props: { activityid: string, course: any, orgslug: string, courseid: string }) {
+ const router = useRouter();
+
+
+ async function markActivityAsCompleteFront() {
+ const trail = await markActivityAsComplete(props.orgslug, props.courseid, props.activityid);
+ router.refresh();
}
- p {
- margin-top: 0;
- margin-bottom: 0;
- font-weight: 700;
- }
-`;
+ return (
+ <>{props.course.trail.activities_marked_complete &&
+ props.course.trail.activities_marked_complete.includes("activity_" + props.activityid) &&
+ props.course.trail.status == "ongoing" ? (
+
+
+
+ {" "}
+ Already completed
+
+ ) : (
+
+ {" "}
+
+
+ {" "}
+ Mark as complete
+
+ )}>
+ )
+}
-
-const ActivityTopWrapper = styled.div`
- width: 1300px;
- padding-top: 50px;
- margin: 0 auto;
- display: flex;
-`;
-
-const CourseContent = styled.div`
- display: flex;
- flex-direction: column;
- background-color: white;
-`;
-
-const ActivityMarkerWrapper = styled.div`
- display: block;
- width: 1300px;
- justify-content: flex-end;
- margin: 0 auto;
- align-items: center;
-
- button {
- background-color: #151515;
- border: none;
- padding: 18px;
- border-radius: 15px;
- margin: 15px;
- margin-left: 20px;
- margin-top: 20px;
- cursor: pointer;
- transition: all 0.2s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: auto;
- color: white;
- font-weight: 700;
- font-family: "DM Sans";
- font-size: 16px;
- letter-spacing: -0.05em;
- box-shadow: 0px 13px 33px -13px rgba(0, 0, 0, 0.42);
-
- i {
- margin-right: 5px;
-
- // center the icon
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- &:hover {
- background-color: #000000;
- }
- }
-`;
-
export default ActivityClient;
diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx
index 2e2580a4..fc323f5c 100644
--- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx
+++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx
@@ -56,7 +56,7 @@ const CourseClient = (props: any) => {
-
+
Description
diff --git a/front/components/Pages/Activities/DocumentPdf/DocumentPdf.tsx b/front/components/Pages/Activities/DocumentPdf/DocumentPdf.tsx
index 4c907a5e..bdd1c56d 100644
--- a/front/components/Pages/Activities/DocumentPdf/DocumentPdf.tsx
+++ b/front/components/Pages/Activities/DocumentPdf/DocumentPdf.tsx
@@ -1,75 +1,18 @@
import { getBackendUrl } from "@services/config/config";
import React from "react";
-import styled from "styled-components";
function DocumentPdfActivity({ activity, course }: { activity: any; course: any }) {
- function getChapterName() {
- let chapterName = "";
- let chapterId = activity.chapter_id;
- course.chapters.forEach((chapter: any) => {
- if (chapter.chapter_id === chapterId) {
- chapterName = chapter.name;
- }
- });
- return chapterName;
- }
-
+
return (
-
-
- Chapter : {getChapterName()}
- {activity.name}
-
-
-
-
-
+
+
+
);
}
export default DocumentPdfActivity;
-const DocumentPdfActivityLayout = styled.div`
- display: flex;
- flex-direction: column;
- margin-top: 10px;
- background: #141414;
- min-width: 100%;
- min-height: 1200px;
-`;
-const DocumentPdfTitle = styled.div`
- display: flex;
- width: 1300px;
- margin: 0 auto;
- padding-top: 20px;
- font-size: 24px;
- font-weight: 700;
- color: #fff;
- flex-direction: column;
-
- p {
- font-size: 14px;
- padding: 0;
- margin: 0;
- color: #ffffffaa;
- }
-`;
-
-const DocumentPdfPlayerWrapper = styled.div`
- display: flex;
- width: 1300px;
- margin: 0 auto;
- justify-content: center;
- padding-top: 20px;
-
- iframe {
- width: 1300px;
- height: 500px;
- border-radius: 7px;
- background-color: black;
- border: none;
- }
-`;
diff --git a/front/components/Pages/Activities/Video/Video.tsx b/front/components/Pages/Activities/Video/Video.tsx
index f232e3d5..79ae5e50 100644
--- a/front/components/Pages/Activities/Video/Video.tsx
+++ b/front/components/Pages/Activities/Video/Video.tsx
@@ -7,9 +7,10 @@ function VideoActivity({ activity, course }: { activity: any; course: any }) {
const [videoId, setVideoId] = React.useState('');
const [videoType, setVideoType] = React.useState('');
- function getChapterName() {
+ let chapterId = activity.chapter_id;
+
+ function getChapterName(chapterId: string) {
let chapterName = "";
- let chapterId = activity.chapter_id;
course.chapters.forEach((chapter: any) => {
if (chapter.chapter_id === chapterId) {
chapterName = chapter.name;
@@ -45,18 +46,14 @@ function VideoActivity({ activity, course }: { activity: any; course: any }) {
}, [activity]);
return (
-
-
- {getChapterName()}
- {activity.name}
-
+
{videoType === 'video' && (
-
-
-
+
+
+
)}
{videoType === 'external_video' && (
-
+
-
+
)}
-
+
);
}
@@ -82,44 +79,4 @@ function VideoActivity({ activity, course }: { activity: any; course: any }) {
export default VideoActivity;
-const VideoActivityLayout = styled.div`
- display: flex;
- flex-direction: column;
- margin-top: 10px;
- background: #141414;
- min-width: 100%;
- min-height: 1200px;
-`;
-const VideoTitle = styled.div`
- display: flex;
- width: 1300px;
- margin: 0 auto;
- padding-top: 20px;
- font-size: 24px;
- font-weight: 700;
- color: #fff;
- flex-direction: column;
-
- p {
- font-size: 14px;
- padding: 0;
- margin: 0;
- color: #ffffffaa;
- }
-`;
-
-const VideoPlayerWrapper = styled.div`
- display: flex;
- width: 1300px;
- margin: 0 auto;
- justify-content: center;
- padding-top: 20px;
-
- video {
- width: 1300px;
- height: 500px;
- border-radius: 7px;
- background-color: black;
- }
-`;
diff --git a/front/components/Pages/Courses/ActivityIndicators.tsx b/front/components/Pages/Courses/ActivityIndicators.tsx
index 9e738e54..5749afda 100644
--- a/front/components/Pages/Courses/ActivityIndicators.tsx
+++ b/front/components/Pages/Courses/ActivityIndicators.tsx
@@ -54,7 +54,7 @@ function ActivityIndicators(props: Props) {
{chapter.activities.map((activity: any) => {
return (
-
+
diff --git a/front/components/StyledElements/Tooltip/Tooltip.tsx b/front/components/StyledElements/Tooltip/Tooltip.tsx
index 8a8cf0fe..4c33501c 100644
--- a/front/components/StyledElements/Tooltip/Tooltip.tsx
+++ b/front/components/StyledElements/Tooltip/Tooltip.tsx
@@ -2,8 +2,6 @@
import React from 'react';
import * as Tooltip from '@radix-ui/react-tooltip';
import { styled, keyframes } from '@stitches/react';
-import { violet, blackA } from '@radix-ui/colors';
-import { PlusIcon } from '@radix-ui/react-icons';
type TooltipProps = {
@@ -24,7 +22,6 @@ const ToolTip = (props: TooltipProps) => {
{props.content}
-
@@ -62,7 +59,7 @@ const TooltipContent = styled(Tooltip.Content, {
variants: {
slateBlack: {
true: {
- backgroundColor: " #5a5a5a",
+ backgroundColor: " #0d0d0d",
color: 'white',
},
},
@@ -96,25 +93,6 @@ const TooltipContent = styled(Tooltip.Content, {
},
});
-const TooltipArrow = styled(Tooltip.Arrow, {
- fill: 'white',
-});
-
-const IconButton = styled('button', {
- all: 'unset',
- fontFamily: 'inherit',
- borderRadius: '100%',
- height: 35,
- width: 35,
- display: 'inline-flex',
- alignItems: 'center',
- justifyContent: 'center',
- color: violet.violet11,
- backgroundColor: 'white',
- boxShadow: `0 2px 10px ${blackA.blackA7}`,
- '&:hover': { backgroundColor: violet.violet3 },
- '&:focus': { boxShadow: `0 0 0 2px black` },
-});
export default ToolTip;
\ No newline at end of file