Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of https://github.com/tekdi/shiksha-work…
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Dec 12, 2024
2 parents d82abf8 + 75c750f commit 5536071
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 59 deletions.
1 change: 1 addition & 0 deletions src/components/CollectionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const CollectionEditor: React.FC = () => {
event.detail?.action === "publishContent" ||
event.detail?.action === "rejectContent"
) {
localStorage.removeItem("contentMode");
window.history.back();
window.addEventListener(
"popstate",
Expand Down
1 change: 1 addition & 0 deletions src/components/QuestionSetEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const QuestionSetEditor: React.FC = () => {
event.detail?.action === "publishContent" ||
event.detail?.action === "rejectContent"
) {
localStorage.removeItem("contentMode");
window.history.back();
window.addEventListener(
"popstate",
Expand Down
11 changes: 8 additions & 3 deletions src/components/V1-Player/V1Player.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getTelemetryEvents } from "@/utils/Helper";
import React, { useRef, useEffect } from "react";

interface PlayerProps {
Expand All @@ -17,7 +18,10 @@ const V1Player = ({ playerConfig }: PlayerProps) => {

const handleLoad = () => {
setTimeout(() => {
if (preview.contentWindow && preview.contentWindow.initializePreview) {
if (
preview.contentWindow &&
preview.contentWindow.initializePreview
) {
preview.contentWindow.initializePreview(playerConfig);
}
preview.contentWindow.addEventListener("message", (event: any) => {
Expand All @@ -26,12 +30,13 @@ const V1Player = ({ playerConfig }: PlayerProps) => {

preview.addEventListener("renderer:telemetry:event", (event: any) => {
console.log("V1 player telemetry event ===>", event);
if (event.detail.telemetryData.eid === 'START') {
if (event.detail.telemetryData.eid === "START") {
console.log("V1 player telemetry START event ===>", event);
}
if (event.detail.telemetryData.eid === 'END') {
if (event.detail.telemetryData.eid === "END") {
console.log("V1 player telemetry END event ===>", event);
}
getTelemetryEvents(event.detail.telemetryData, "v1");
});
}, 100);
};
Expand Down
5 changes: 4 additions & 1 deletion src/pages/workspace/content/up-review/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ const UpForReviewPage = () => {
mimeType: item.mimeType,
mode: item.mode,
createdBy: item.createdBy,
creator: item.creator
creator: item.creator,
author: item.author




}));
Expand Down
114 changes: 59 additions & 55 deletions src/services/ContentService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { getLocalStoredUserId , getLocalStoredUserRole} from "./LocalStorageService";
import {
getLocalStoredUserId,
getLocalStoredUserRole,
} from "./LocalStorageService";
import { delApi, get, post } from "./RestClient";
import axios from "axios";
import { MIME_TYPE, CHANNEL_ID, TENANT_ID, FRAMEWORK_ID } from "@/utils/app.config";
import {
MIME_TYPE,
CHANNEL_ID,
TENANT_ID,
FRAMEWORK_ID,
} from "@/utils/app.config";
import { v4 as uuidv4 } from "uuid";
import { PrimaryCategoryValue, Role } from "@/utils/app.constant";

Expand Down Expand Up @@ -44,13 +52,13 @@ const defaultReqBody = {
const upForReviewReqBody = {
request: {
filters: {
// createdBy: { userId},
// createdBy: { userId},
},
sort_by: {
lastUpdatedOn: "desc",
},
},
}
};
const getReqBodyWithStatus = (
status: string[],
query: string,
Expand All @@ -68,12 +76,30 @@ const getReqBodyWithStatus = (
}
primaryCategory =
primaryCategory.length === 0 ? PrimaryCategory : primaryCategory;
if(contentType==="discover-contents")
{
const userRole = getLocalStoredUserRole();
if (contentType === "discover-contents") {
const userRole = getLocalStoredUserRole();

if (state) {
return {
...upForReviewReqBody,
request: {
...upForReviewReqBody.request,
filters: {
...upForReviewReqBody.request.filters,
status,
primaryCategory,
createdBy: { "!=": getLocalStoredUserId() },
state: state,
},

query,
limit,
offset,
sort_by,
},
};
}

if(state)
{
return {
...upForReviewReqBody,
request: {
Expand All @@ -82,56 +108,32 @@ const getReqBodyWithStatus = (
...upForReviewReqBody.request.filters,
status,
primaryCategory,
createdBy:{"!=": getLocalStoredUserId()},
state:state

createdBy: { "!=": getLocalStoredUserId() },
},

query,
limit,
offset,
sort_by,
},
};
}

return {
...upForReviewReqBody,
request: {
...upForReviewReqBody.request,
filters: {
...upForReviewReqBody.request.filters,
status,
primaryCategory,
createdBy:{"!=":getLocalStoredUserId()}

},

query,
limit,
offset,
sort_by,
},
};
}
else if(contentType==="upReview")
{
return {
...upForReviewReqBody,
request: {
...upForReviewReqBody.request,
filters: {
...upForReviewReqBody.request.filters,
status,
primaryCategory,
} else if (contentType === "upReview") {
return {
...upForReviewReqBody,
request: {
...upForReviewReqBody.request,
filters: {
...upForReviewReqBody.request.filters,
status,
primaryCategory,
},
query,
limit,
offset,
sort_by,
},
query,
limit,
offset,
sort_by,
},
};
}
};
}

return {
...defaultReqBody,
Expand Down Expand Up @@ -189,6 +191,7 @@ export const createQuestionSet = async () => {
primaryCategory: "Practice Question Set",
code: uuidv4(),
createdBy: userId,
framework: FRAMEWORK_ID,
},
},
};
Expand All @@ -197,7 +200,7 @@ export const createQuestionSet = async () => {
const response = await axios.post(apiURL, reqBody, {
headers: {
"Content-Type": "application/json",
"tenantId": TENANT_ID,
tenantId: TENANT_ID,
},
});
return response?.data;
Expand Down Expand Up @@ -241,6 +244,7 @@ export const createCourse = async (userId: any) => {
resourceType: "Course",
primaryCategory: "Course",
contentType: "Course",
framework: FRAMEWORK_ID,
},
},
};
Expand Down Expand Up @@ -304,12 +308,12 @@ export const getContentHierarchy = async ({
const apiUrl: string = `/action/content/v3/hierarchy/${doId}`;

try {
console.log('Request data', apiUrl);
console.log("Request data", apiUrl);
const response = await get(apiUrl);
// console.log('response', response);
return response;
} catch (error) {
console.error('Error in getContentHierarchy Service', error);
console.error("Error in getContentHierarchy Service", error);
throw error;
}
};
Expand All @@ -320,7 +324,7 @@ export const getFrameworkDetails = async (): Promise<any> => {
const response = await axios.get(apiUrl);
return response?.data;
} catch (error) {
console.error('Error in getting Framework Details', error);
console.error("Error in getting Framework Details", error);
return error;
}
};

0 comments on commit 5536071

Please sign in to comment.