mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: migrate activity page to server component
This commit is contained in:
parent
9b224a4331
commit
b6e5b1b616
6 changed files with 369 additions and 303 deletions
|
|
@ -0,0 +1,220 @@
|
|||
"use client";
|
||||
import Link from "next/link";
|
||||
import React, { useMemo } 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/UI/Tooltip/Tooltip";
|
||||
import DocumentPdfActivity from "@components/Pages/Activities/DocumentPdf/DocumentPdf";
|
||||
|
||||
interface ActivityClientProps {
|
||||
activityid: string;
|
||||
courseid: string;
|
||||
orgslug: string;
|
||||
activity: any;
|
||||
course: any;
|
||||
}
|
||||
|
||||
function ActivityClient(props: ActivityClientProps) {
|
||||
const activityid = props.activityid;
|
||||
const courseid = props.courseid;
|
||||
const orgslug = props.orgslug;
|
||||
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}`);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ActivityLayout>
|
||||
<pre style={{ display: "none" }}>{JSON.stringify(activity, null, 2)}</pre>
|
||||
<ActivityTopWrapper>
|
||||
<ActivityThumbnail>
|
||||
<Link href={getUriWithOrg(orgslug, "") + `/course/${courseid}`}>
|
||||
<img src={`${getBackendUrl()}content/uploads/img/${course.course.thumbnail}`} alt="" />
|
||||
</Link>
|
||||
</ActivityThumbnail>
|
||||
<ActivityInfo>
|
||||
<p>Course</p>
|
||||
<h1>{course.course.name}</h1>
|
||||
</ActivityInfo>
|
||||
</ActivityTopWrapper>
|
||||
<ChaptersWrapper>
|
||||
{course.chapters.map((chapter: any) => {
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: "flex", flexDirection: "row" }} key={chapter.chapter_id}>
|
||||
{chapter.activities.map((activity: any) => {
|
||||
return (
|
||||
<ToolTip sideOffset={-5} slateBlack content={activity.name} key={activity.id}>
|
||||
<Link href={getUriWithOrg(orgslug, "") + `/course/${courseid}/activity/${activity.id.replace("activity_", "")}`}>
|
||||
<ChapterIndicator
|
||||
done={course.trail.activities_marked_complete && course.trail.activities_marked_complete.includes(activity.id) && course.trail.status == "ongoing"}
|
||||
active={"activity_" + activityid === activity.id ? true : false} key={activity.id}
|
||||
/>
|
||||
</Link>
|
||||
</ToolTip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
</>
|
||||
);
|
||||
})}
|
||||
</ChaptersWrapper>
|
||||
|
||||
{activity ? (
|
||||
<CourseContent>
|
||||
{activity.type == "dynamic" && <Canva content={activity.content} activity={activity} />}
|
||||
{/* todo : use apis & streams instead of this */}
|
||||
{activity.type == "video" && <VideoActivity course={course} activity={activity} />}
|
||||
|
||||
{activity.type == "documentpdf" && <DocumentPdfActivity course={course} activity={activity} />}
|
||||
|
||||
<ActivityMarkerWrapper className="py-10">
|
||||
|
||||
{course.trail.activities_marked_complete &&
|
||||
course.trail.activities_marked_complete.includes("activity_" + activityid) &&
|
||||
course.trail.status == "ongoing" ? (
|
||||
<button style={{ backgroundColor: "green" }}>
|
||||
<i>
|
||||
<Check size={20}></Check>
|
||||
</i>{" "}
|
||||
Already completed
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={markActivityAsCompleteFront}>
|
||||
{" "}
|
||||
<i>
|
||||
<Check size={20}></Check>
|
||||
</i>{" "}
|
||||
Mark as complete
|
||||
</button>
|
||||
)}
|
||||
</ActivityMarkerWrapper>
|
||||
</CourseContent>
|
||||
) : (<div></div>)}
|
||||
{<div style={{ height: "100px" }}></div>}
|
||||
</ActivityLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const ActivityLayout = styled.div``;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
font-weight: 700;
|
||||
}
|
||||
`;
|
||||
|
||||
const ChaptersWrapper = styled.div`
|
||||
display: flex;
|
||||
// row
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
width: 1300px;
|
||||
margin: 0 auto;
|
||||
`;
|
||||
|
||||
const ChapterIndicator = styled.div < { active?: boolean, done?: boolean } > `
|
||||
border-radius: 20px;
|
||||
height: 5px;
|
||||
background: #151515;
|
||||
border-radius: 3px;
|
||||
|
||||
width: 35px;
|
||||
background-color: ${props => props.done ? "green" : (props.active ? "#9d9d9d" : "black")};
|
||||
margin: 10px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: #9d9d9d;
|
||||
}
|
||||
`;
|
||||
|
||||
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;
|
||||
min-height: 600px;
|
||||
`;
|
||||
|
||||
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;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import PageLoading from "@components/Pages/PageLoading";
|
||||
|
||||
export default function Loading() {
|
||||
// Or a custom loading skeleton component
|
||||
return (
|
||||
<PageLoading></PageLoading>
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -1,221 +1,52 @@
|
|||
"use client";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import React, { useMemo } from "react";
|
||||
import { getActivity } from "@services/courses/activities";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import Canva from "@components/Pages/Activities/DynamicCanva/DynamicCanva";
|
||||
import styled from "styled-components";
|
||||
import { getCourse } from "@services/courses/courses";
|
||||
import VideoActivity from "@components/Pages/Activities/Video/Video";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { Check } from "lucide-react";
|
||||
import { swrFetcher } from "@services/utils/ts/requests";
|
||||
import { markActivityAsComplete } from "@services/courses/activity";
|
||||
import ToolTip from "@components/UI/Tooltip/Tooltip";
|
||||
import DocumentPdfActivity from "@components/Pages/Activities/DocumentPdf/DocumentPdf";
|
||||
|
||||
function ActivityPage(params: any) {
|
||||
const activityid = params.params.activityid;
|
||||
const courseid = params.params.courseid;
|
||||
const orgslug = params.params.orgslug;
|
||||
|
||||
const { data: course, error: error_course } = useSWR(`${getAPIUrl()}courses/meta/course_${courseid}`, swrFetcher);
|
||||
const { data: activity, error: error_activity } = useSWR(`${getAPIUrl()}activities/activity_${activityid}`, swrFetcher);
|
||||
import { getActivityWithAuthHeader } from "@services/courses/activities";
|
||||
import { getCourseMetadataWithAuthHeader } from "@services/courses/courses";
|
||||
import { cookies } from "next/headers";
|
||||
import ActivityClient from "./activity";
|
||||
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||
import { Metadata } from "next";
|
||||
|
||||
|
||||
async function markActivityAsCompleteFront() {
|
||||
const trail = await markActivityAsComplete(orgslug, courseid, activityid);
|
||||
mutate(`${getAPIUrl()}activities/activity_${activityid}`);
|
||||
mutate(`${getAPIUrl()}courses/meta/course_${courseid}`);
|
||||
}
|
||||
type MetadataProps = {
|
||||
params: { orgslug: string, courseid: string, activityid: string };
|
||||
searchParams: { [key: string]: string | string[] | undefined };
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{error_course && <p>Failed to load</p>}
|
||||
{!course || !activity ? (
|
||||
<div>Loading...</div>
|
||||
) : (
|
||||
<ActivityLayout>
|
||||
<ActivityTopWrapper>
|
||||
<ActivityThumbnail>
|
||||
<Link href={getUriWithOrg(orgslug, "") + `/course/${courseid}`}>
|
||||
<img src={`${getBackendUrl()}content/uploads/img/${course.course.thumbnail}`} alt="" />
|
||||
</Link>
|
||||
</ActivityThumbnail>
|
||||
<ActivityInfo>
|
||||
<p>Course</p>
|
||||
<h1>{course.course.name}</h1>
|
||||
</ActivityInfo>
|
||||
</ActivityTopWrapper>
|
||||
<ChaptersWrapper>
|
||||
{course.chapters.map((chapter: any) => {
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: "flex", flexDirection: "row" }} key={chapter.chapter_id}>
|
||||
{chapter.activities.map((activity: any) => {
|
||||
return (
|
||||
<ToolTip sideOffset={-5} slateBlack content={activity.name} key={activity.id}>
|
||||
<Link href={getUriWithOrg(orgslug, "") + `/course/${courseid}/activity/${activity.id.replace("activity_", "")}`}>
|
||||
<ChapterIndicator
|
||||
done={course.trail.activities_marked_complete && course.trail.activities_marked_complete.includes(activity.id) && course.trail.status == "ongoing"}
|
||||
active={"activity_" + activityid === activity.id ? true : false} key={activity.id}
|
||||
/>
|
||||
</Link>
|
||||
</ToolTip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
</>
|
||||
);
|
||||
})}
|
||||
</ChaptersWrapper>
|
||||
export async function generateMetadata(
|
||||
{ params }: MetadataProps,
|
||||
): Promise<Metadata> {
|
||||
const cookieStore = cookies();
|
||||
const access_token_cookie: any = cookieStore.get('access_token_cookie');
|
||||
|
||||
{activity ? (
|
||||
<CourseContent>
|
||||
{activity.type == "dynamic" && <Canva content={activity.content} activity={activity} />}
|
||||
{/* todo : use apis & streams instead of this */}
|
||||
{activity.type == "video" && <VideoActivity course={course} activity={activity} />}
|
||||
// Get Org context information
|
||||
const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] });
|
||||
const course_meta = await getCourseMetadataWithAuthHeader(params.courseid, { revalidate: 360, tags: ['courses'] }, access_token_cookie.value)
|
||||
const activity = await getActivityWithAuthHeader(params.activityid, { revalidate: 0, tags: ['activities'] }, access_token_cookie.value)
|
||||
|
||||
{activity.type == "documentpdf" && <DocumentPdfActivity course={course} activity={activity} />}
|
||||
|
||||
<ActivityMarkerWrapper className="py-10">
|
||||
|
||||
{course.trail.activities_marked_complete &&
|
||||
course.trail.activities_marked_complete.includes("activity_" + activityid) &&
|
||||
course.trail.status == "ongoing" ? (
|
||||
<button style={{ backgroundColor: "green" }}>
|
||||
<i>
|
||||
<Check size={20}></Check>
|
||||
</i>{" "}
|
||||
Already completed
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={markActivityAsCompleteFront}>
|
||||
{" "}
|
||||
<i>
|
||||
<Check size={20}></Check>
|
||||
</i>{" "}
|
||||
Mark as complete
|
||||
</button>
|
||||
)}
|
||||
</ActivityMarkerWrapper>
|
||||
</CourseContent>
|
||||
) : (<div></div>)}
|
||||
{error_activity && <p>Failed to load {error_activity.message}</p>}
|
||||
</ActivityLayout>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
return {
|
||||
title: activity.name + ` — ${course_meta.course.name} Course`,
|
||||
description: course_meta.course.mini_description,
|
||||
};
|
||||
}
|
||||
|
||||
const ActivityLayout = styled.div``;
|
||||
const ActivityPage = async (params: any) => {
|
||||
const cookieStore = cookies();
|
||||
const access_token_cookie: any = cookieStore.get('access_token_cookie');
|
||||
const activityid = params.params.activityid;
|
||||
const courseid = params.params.courseid;
|
||||
const orgslug = params.params.orgslug;
|
||||
|
||||
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;
|
||||
}
|
||||
const course_meta = await getCourseMetadataWithAuthHeader(courseid, { revalidate: 0, tags: ['courses'] }, access_token_cookie.value)
|
||||
const activity = await getActivityWithAuthHeader(activityid, { revalidate: 0, tags: ['activities'] }, access_token_cookie.value)
|
||||
return (
|
||||
<>
|
||||
<ActivityClient
|
||||
activityid={activityid}
|
||||
courseid={courseid}
|
||||
orgslug={orgslug}
|
||||
activity={activity}
|
||||
course={course_meta}
|
||||
/></>
|
||||
)
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
font-weight: 700;
|
||||
}
|
||||
`;
|
||||
|
||||
const ChaptersWrapper = styled.div`
|
||||
display: flex;
|
||||
// row
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
width: 1300px;
|
||||
margin: 0 auto;
|
||||
`;
|
||||
|
||||
const ChapterIndicator = styled.div < { active?: boolean, done?: boolean } > `
|
||||
border-radius: 20px;
|
||||
height: 5px;
|
||||
background: #151515;
|
||||
border-radius: 3px;
|
||||
|
||||
width: 35px;
|
||||
background-color: ${props => props.done ? "green" : (props.active ? "#9d9d9d" : "black")};
|
||||
margin: 10px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: #9d9d9d;
|
||||
}
|
||||
`;
|
||||
|
||||
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;
|
||||
min-height: 600px;
|
||||
`;
|
||||
|
||||
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 ActivityPage;
|
||||
export default ActivityPage
|
||||
174
front/package-lock.json
generated
174
front/package-lock.json
generated
|
|
@ -26,7 +26,7 @@
|
|||
"formik": "^2.2.9",
|
||||
"framer-motion": "^7.3.6",
|
||||
"lucide-react": "^0.104.1",
|
||||
"next": "^13.4.2",
|
||||
"next": "^13.4.3",
|
||||
"re-resizable": "^6.9.9",
|
||||
"react": "^18.2.0",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
|
|
@ -2123,9 +2123,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.2.tgz",
|
||||
"integrity": "sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw=="
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.3.tgz",
|
||||
"integrity": "sha512-pa1ErjyFensznttAk3EIv77vFbfSYT6cLzVRK5jx4uiRuCQo+m2wCFAREaHKIy63dlgvOyMlzh6R8Inu8H3KrQ=="
|
||||
},
|
||||
"node_modules/@next/eslint-plugin-next": {
|
||||
"version": "13.0.6",
|
||||
|
|
@ -2137,9 +2137,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-arm64": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.2.tgz",
|
||||
"integrity": "sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.3.tgz",
|
||||
"integrity": "sha512-yx18udH/ZmR4Bw4M6lIIPE3JxsAZwo04iaucEfA2GMt1unXr2iodHUX/LAKNyi6xoLP2ghi0E+Xi1f4Qb8f1LQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -2152,9 +2152,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-x64": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.2.tgz",
|
||||
"integrity": "sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.3.tgz",
|
||||
"integrity": "sha512-Mi8xJWh2IOjryAM1mx18vwmal9eokJ2njY4nDh04scy37F0LEGJ/diL6JL6kTXi0UfUCGbMsOItf7vpReNiD2A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -2167,9 +2167,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.2.tgz",
|
||||
"integrity": "sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.3.tgz",
|
||||
"integrity": "sha512-aBvtry4bxJ1xwKZ/LVPeBGBwWVwxa4bTnNkRRw6YffJnn/f4Tv4EGDPaVeYHZGQVA56wsGbtA6nZMuWs/EIk4Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -2182,9 +2182,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-musl": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.2.tgz",
|
||||
"integrity": "sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.3.tgz",
|
||||
"integrity": "sha512-krT+2G3kEsEUvZoYte3/2IscscDraYPc2B+fDJFipPktJmrv088Pei/RjrhWm5TMIy5URYjZUoDZdh5k940Dyw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -2197,9 +2197,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-gnu": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.2.tgz",
|
||||
"integrity": "sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.3.tgz",
|
||||
"integrity": "sha512-AMdFX6EKJjC0G/CM6hJvkY8wUjCcbdj3Qg7uAQJ7PVejRWaVt0sDTMavbRfgMchx8h8KsAudUCtdFkG9hlEClw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -2212,9 +2212,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-musl": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.2.tgz",
|
||||
"integrity": "sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.3.tgz",
|
||||
"integrity": "sha512-jySgSXE48shaLtcQbiFO9ajE9mqz7pcAVLnVLvRIlUHyQYR/WyZdK8ehLs65Mz6j9cLrJM+YdmdJPyV4WDaz2g==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -2227,9 +2227,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-5DxHo8uYcaADiE9pHrg8o28VMt/1kR8voDehmfs9AqS0qSClxAAl+CchjdboUvbCjdNWL1MISCvEfKY2InJ3JA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -2242,9 +2242,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-ia32-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-LaqkF3d+GXRA5X6zrUjQUrXm2MN/3E2arXBtn5C7avBCNYfm9G3Xc646AmmmpN3DJZVaMYliMyCIQCMDEzk80w==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
|
|
@ -2257,9 +2257,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-x64-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-jglUk/x7ZWeOJWlVoKyIAkHLTI+qEkOriOOV+3hr1GyiywzcqfI7TpFSiwC7kk1scOiH7NTFKp8mA3XPNO9bDw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -6371,11 +6371,11 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/next": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-13.4.2.tgz",
|
||||
"integrity": "sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-13.4.3.tgz",
|
||||
"integrity": "sha512-FV3pBrAAnAIfOclTvncw9dDohyeuEEXPe5KNcva91anT/rdycWbgtu3IjUj4n5yHnWK8YEPo0vrUecHmnmUNbA==",
|
||||
"dependencies": {
|
||||
"@next/env": "13.4.2",
|
||||
"@next/env": "13.4.3",
|
||||
"@swc/helpers": "0.5.1",
|
||||
"busboy": "1.6.0",
|
||||
"caniuse-lite": "^1.0.30001406",
|
||||
|
|
@ -6390,15 +6390,15 @@
|
|||
"node": ">=16.8.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@next/swc-darwin-arm64": "13.4.2",
|
||||
"@next/swc-darwin-x64": "13.4.2",
|
||||
"@next/swc-linux-arm64-gnu": "13.4.2",
|
||||
"@next/swc-linux-arm64-musl": "13.4.2",
|
||||
"@next/swc-linux-x64-gnu": "13.4.2",
|
||||
"@next/swc-linux-x64-musl": "13.4.2",
|
||||
"@next/swc-win32-arm64-msvc": "13.4.2",
|
||||
"@next/swc-win32-ia32-msvc": "13.4.2",
|
||||
"@next/swc-win32-x64-msvc": "13.4.2"
|
||||
"@next/swc-darwin-arm64": "13.4.3",
|
||||
"@next/swc-darwin-x64": "13.4.3",
|
||||
"@next/swc-linux-arm64-gnu": "13.4.3",
|
||||
"@next/swc-linux-arm64-musl": "13.4.3",
|
||||
"@next/swc-linux-x64-gnu": "13.4.3",
|
||||
"@next/swc-linux-x64-musl": "13.4.3",
|
||||
"@next/swc-win32-arm64-msvc": "13.4.3",
|
||||
"@next/swc-win32-ia32-msvc": "13.4.3",
|
||||
"@next/swc-win32-x64-msvc": "13.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
|
|
@ -10043,9 +10043,9 @@
|
|||
}
|
||||
},
|
||||
"@next/env": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.2.tgz",
|
||||
"integrity": "sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw=="
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.3.tgz",
|
||||
"integrity": "sha512-pa1ErjyFensznttAk3EIv77vFbfSYT6cLzVRK5jx4uiRuCQo+m2wCFAREaHKIy63dlgvOyMlzh6R8Inu8H3KrQ=="
|
||||
},
|
||||
"@next/eslint-plugin-next": {
|
||||
"version": "13.0.6",
|
||||
|
|
@ -10057,57 +10057,57 @@
|
|||
}
|
||||
},
|
||||
"@next/swc-darwin-arm64": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.2.tgz",
|
||||
"integrity": "sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.3.tgz",
|
||||
"integrity": "sha512-yx18udH/ZmR4Bw4M6lIIPE3JxsAZwo04iaucEfA2GMt1unXr2iodHUX/LAKNyi6xoLP2ghi0E+Xi1f4Qb8f1LQ==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-darwin-x64": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.2.tgz",
|
||||
"integrity": "sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.3.tgz",
|
||||
"integrity": "sha512-Mi8xJWh2IOjryAM1mx18vwmal9eokJ2njY4nDh04scy37F0LEGJ/diL6JL6kTXi0UfUCGbMsOItf7vpReNiD2A==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-linux-arm64-gnu": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.2.tgz",
|
||||
"integrity": "sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.3.tgz",
|
||||
"integrity": "sha512-aBvtry4bxJ1xwKZ/LVPeBGBwWVwxa4bTnNkRRw6YffJnn/f4Tv4EGDPaVeYHZGQVA56wsGbtA6nZMuWs/EIk4Q==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-linux-arm64-musl": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.2.tgz",
|
||||
"integrity": "sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.3.tgz",
|
||||
"integrity": "sha512-krT+2G3kEsEUvZoYte3/2IscscDraYPc2B+fDJFipPktJmrv088Pei/RjrhWm5TMIy5URYjZUoDZdh5k940Dyw==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-linux-x64-gnu": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.2.tgz",
|
||||
"integrity": "sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.3.tgz",
|
||||
"integrity": "sha512-AMdFX6EKJjC0G/CM6hJvkY8wUjCcbdj3Qg7uAQJ7PVejRWaVt0sDTMavbRfgMchx8h8KsAudUCtdFkG9hlEClw==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-linux-x64-musl": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.2.tgz",
|
||||
"integrity": "sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.3.tgz",
|
||||
"integrity": "sha512-jySgSXE48shaLtcQbiFO9ajE9mqz7pcAVLnVLvRIlUHyQYR/WyZdK8ehLs65Mz6j9cLrJM+YdmdJPyV4WDaz2g==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-win32-arm64-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-5DxHo8uYcaADiE9pHrg8o28VMt/1kR8voDehmfs9AqS0qSClxAAl+CchjdboUvbCjdNWL1MISCvEfKY2InJ3JA==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-win32-ia32-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-LaqkF3d+GXRA5X6zrUjQUrXm2MN/3E2arXBtn5C7avBCNYfm9G3Xc646AmmmpN3DJZVaMYliMyCIQCMDEzk80w==",
|
||||
"optional": true
|
||||
},
|
||||
"@next/swc-win32-x64-msvc": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.2.tgz",
|
||||
"integrity": "sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.3.tgz",
|
||||
"integrity": "sha512-jglUk/x7ZWeOJWlVoKyIAkHLTI+qEkOriOOV+3hr1GyiywzcqfI7TpFSiwC7kk1scOiH7NTFKp8mA3XPNO9bDw==",
|
||||
"optional": true
|
||||
},
|
||||
"@nicolo-ribaudo/chokidar-2": {
|
||||
|
|
@ -13076,20 +13076,20 @@
|
|||
"dev": true
|
||||
},
|
||||
"next": {
|
||||
"version": "13.4.2",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-13.4.2.tgz",
|
||||
"integrity": "sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==",
|
||||
"version": "13.4.3",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-13.4.3.tgz",
|
||||
"integrity": "sha512-FV3pBrAAnAIfOclTvncw9dDohyeuEEXPe5KNcva91anT/rdycWbgtu3IjUj4n5yHnWK8YEPo0vrUecHmnmUNbA==",
|
||||
"requires": {
|
||||
"@next/env": "13.4.2",
|
||||
"@next/swc-darwin-arm64": "13.4.2",
|
||||
"@next/swc-darwin-x64": "13.4.2",
|
||||
"@next/swc-linux-arm64-gnu": "13.4.2",
|
||||
"@next/swc-linux-arm64-musl": "13.4.2",
|
||||
"@next/swc-linux-x64-gnu": "13.4.2",
|
||||
"@next/swc-linux-x64-musl": "13.4.2",
|
||||
"@next/swc-win32-arm64-msvc": "13.4.2",
|
||||
"@next/swc-win32-ia32-msvc": "13.4.2",
|
||||
"@next/swc-win32-x64-msvc": "13.4.2",
|
||||
"@next/env": "13.4.3",
|
||||
"@next/swc-darwin-arm64": "13.4.3",
|
||||
"@next/swc-darwin-x64": "13.4.3",
|
||||
"@next/swc-linux-arm64-gnu": "13.4.3",
|
||||
"@next/swc-linux-arm64-musl": "13.4.3",
|
||||
"@next/swc-linux-x64-gnu": "13.4.3",
|
||||
"@next/swc-linux-x64-musl": "13.4.3",
|
||||
"@next/swc-win32-arm64-msvc": "13.4.3",
|
||||
"@next/swc-win32-ia32-msvc": "13.4.3",
|
||||
"@next/swc-win32-x64-msvc": "13.4.3",
|
||||
"@swc/helpers": "0.5.1",
|
||||
"busboy": "1.6.0",
|
||||
"caniuse-lite": "^1.0.30001406",
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
"formik": "^2.2.9",
|
||||
"framer-motion": "^7.3.6",
|
||||
"lucide-react": "^0.104.1",
|
||||
"next": "^13.4.2",
|
||||
"next": "^13.4.3",
|
||||
"re-resizable": "^6.9.9",
|
||||
"react": "^18.2.0",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/ts/requests";
|
||||
import { RequestBody, RequestBodyForm, RequestBodyWithAuthHeader } from "@services/utils/ts/requests";
|
||||
|
||||
export async function createActivity(data: any, chapter_id: any, org_id: any) {
|
||||
data.content = {};
|
||||
|
|
@ -47,7 +47,13 @@ export async function createExternalVideoActivity(data: any, activity: any, chap
|
|||
}
|
||||
|
||||
export async function getActivity(activity_id: any, next: any) {
|
||||
const result = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("GET", null,next));
|
||||
const result = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("GET", null, next));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getActivityWithAuthHeader(activity_id: any, next: any, access_token: string) {
|
||||
const result = await fetch(`${getAPIUrl()}activities/activity_${activity_id}`, RequestBodyWithAuthHeader("GET", null, next, access_token));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue