Skip to content

Commit

Permalink
issue #PS-0000 fix: Resolved undefined username on player issue
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Dec 2, 2024
1 parent a99a24e commit 02263ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/components/players/PlayerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const playerConfig = {
userData: { firstName: "Guest", lastName: "User"},

//telemetry
host: "https://telemetry.prathamdigital.org",
host: "",
endpoint: "/v1/telemetry",
},
config: {
Expand Down Expand Up @@ -82,7 +82,7 @@ export const V1PlayerConfig = {
bgImage: "assets/icons/splacebackground_1.png",
webLink: "",
},
apislug: "/action",
apislug: "",
repos: ["/sunbird-plugins/renderer"],
plugins: [
{
Expand Down
68 changes: 30 additions & 38 deletions src/pages/workspace/content/review/index.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
import React, { useEffect, useState } from "react";
import Players from "@/components/players/Players";
import V1Player from "@/components/V1-Player/V1Player";
import { publishContent, submitComment } from "@/services/ContentService";
import { getLocalStoredUserName, getLocalStoredUserRole } from "@/services/LocalStorageService";
import { fetchContent } from "@/services/PlayerService";
import { CHANNEL_ID, MIME_TYPE } from "@/utils/app.config";
import { Role } from "@/utils/app.constant";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import CloseIcon from "@mui/icons-material/Close";
import {
Box,
Button,
Card,
CardContent,
CardActions,
Typography,
IconButton,
Grid,
IconButton,
Typography
} from "@mui/material";
import CloseIcon from "@mui/icons-material/Close";
import { fetchContent } from "@/services/PlayerService";
import $ from "jquery";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import ConfirmActionPopup from "../../../../components/ConfirmActionPopup";
import ReviewCommentPopup from "../../../../components/ReviewCommentPopup";
import { publishContent, submitComment } from "@/services/ContentService";
import Players from "@/components/players/Players";
import V1Player from "@/components/V1-Player/V1Player";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import {
playerConfig,
V1PlayerConfig,
} from "../../../../components/players/PlayerConfig";
import {
pdfMetadata,
videoMetadata,
quMLMetadata,
epubMetadata,
} from "../../../../components/players/playerMetadata";
import $ from "jquery";
import { MIME_TYPE, CHANNEL_ID } from "@/utils/app.config";
import { getLocalStoredUserName , getLocalStoredUserRole} from "@/services/LocalStorageService";
import { Role } from "@/utils/app.constant";
import ReviewCommentPopup from "../../../../components/ReviewCommentPopup";

const userFullName = getLocalStoredUserName() || "Anonymous User";
const [firstName, lastName] = userFullName.split(" ");
Expand Down Expand Up @@ -73,7 +65,7 @@ const ReviewContentSubmissions = () => {
V1PlayerConfig.context.tags = [CHANNEL_ID];
V1PlayerConfig.context.app = [CHANNEL_ID];
V1PlayerConfig.context.userData.firstName = firstName;
V1PlayerConfig.context.userData.lastName = lastName;
V1PlayerConfig.context.userData.lastName = lastName || '';
setIsContentInteractiveType(true);
} else {
setIsContentInteractiveType(false);
Expand All @@ -82,7 +74,7 @@ const ReviewContentSubmissions = () => {
playerConfig.context.channel = CHANNEL_ID;
playerConfig.context.tags = [CHANNEL_ID];
playerConfig.context.userData.firstName = firstName;
playerConfig.context.userData.lastName = lastName;
playerConfig.context.userData.lastName = lastName || '';
}
setContentDetails(data);
}
Expand All @@ -97,16 +89,16 @@ const ReviewContentSubmissions = () => {
}, [identifier]);

const redirectToReviewPage = () => {
if(isDiscoverContent === "true"){
if (isDiscoverContent === "true") {
router.push({ pathname: `/workspace/content/discover-contents` });

}
else if(getLocalStoredUserRole() === Role.CCTA){
else if (getLocalStoredUserRole() === Role.CCTA) {
router.push({ pathname: `/workspace/content/up-review` });

}
else
router.push({ pathname: `/workspace/content/submitted` });
router.push({ pathname: `/workspace/content/submitted` });
};

const closePublishPopup = () => {
Expand Down Expand Up @@ -134,14 +126,14 @@ const ReviewContentSubmissions = () => {
console.log("Published successfully:", response);
// Add toaster success message here
setOpenConfirmationPopup(false);
await delay(2000);
await delay(2000);

if(getLocalStoredUserRole() === Role.CCTA){
if (getLocalStoredUserRole() === Role.CCTA) {
router.push({ pathname: `/workspace/content/up-review` });

}
else
router.push({ pathname: `/workspace/content/submitted` });
router.push({ pathname: `/workspace/content/submitted` });
} catch (error) {
console.error("Error during publishing:", error);
// Add toaster error message here
Expand All @@ -154,12 +146,12 @@ const ReviewContentSubmissions = () => {
console.log("Comment submitted successfully:", response);
// Add toaster success message here
setOpenCommentPopup(false);
if(getLocalStoredUserRole() === Role.CCTA){
if (getLocalStoredUserRole() === Role.CCTA) {
router.push({ pathname: `/workspace/content/up-review` });

}
else
router.push({ pathname: `/workspace/content/submitted` });
router.push({ pathname: `/workspace/content/submitted` });
} catch (error) {
console.error("Error submitting comment:", error);
// Add toaster error message here
Expand All @@ -185,9 +177,9 @@ const ReviewContentSubmissions = () => {
alignItems="center"
mb={2}
>
<IconButton onClick={handleBackClick}>
<ArrowBackIcon />
</IconButton>
<IconButton onClick={handleBackClick}>
<ArrowBackIcon />
</IconButton>
<Typography
variant="h5"
sx={{
Expand Down Expand Up @@ -413,7 +405,7 @@ const ReviewContentSubmissions = () => {
</Grid>
</Grid>

{getLocalStoredUserRole() === Role.CCTA && isDiscoverContent !== "true" && isReadOnly !== "true" &&(<Box
{getLocalStoredUserRole() === Role.CCTA && isDiscoverContent !== "true" && isReadOnly !== "true" && (<Box
sx={{
display: "flex",
justifyContent: "flex-end",
Expand Down

0 comments on commit 02263ba

Please sign in to comment.