Skip to content

Commit

Permalink
Merge pull request #802 from paritshivani/prod-main
Browse files Browse the repository at this point in the history
Prod main
  • Loading branch information
paritshivani authored Dec 2, 2024
2 parents 48739ad + a63e135 commit 6cc4ce4
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 27 deletions.
7 changes: 6 additions & 1 deletion packages/common-lib/src/components/SunbirdPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ const SunbirdPlayer = ({
telemetryData,
...props
}) => {
console.log('props----', props)
const { mimeType } = props
let trackData = []
const [url, setUrl] = React.useState()
const questionListUrl =
window.location.origin != 'http://localhost:3000'
? `${window.location.origin}/api/question/v1/list`
: 'https://devnulp.niua.org/api/question/v1/list'
React.useEffect(() => {
if (mimeType === 'application/pdf') {
setUrl(`/pdf`)
Expand Down Expand Up @@ -176,7 +181,7 @@ const SunbirdPlayer = ({
width='100%'
name={JSON.stringify({
...props,
questionListUrl: 'https://nulp.niua.org/api/question/v1/list'
questionListUrl: questionListUrl
// questionListUrl: `${process.env.REACT_APP_API_URL}/course/questionset`
})}
src={`${public_url ? public_url : process.env.PUBLIC_URL}${url}`}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/nulp_elite/src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export default function BoxCard({ items, index, onClick, continueLearning }) {
)}
</Box>
<Box>
{" "}
{items?.medium ||
(items?.se_mediums && (
<>
Expand Down
4 changes: 2 additions & 2 deletions packages/nulp_elite/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ function Header({ globalSearchQuery }) {
)}

{/* Check if roles array is empty or contains "PUBLIC" */}



<Link
target="_blank"
href="/workspace/content/create"
Expand All @@ -572,7 +573,6 @@ function Header({ globalSearchQuery }) {
>
<MenuItem>{t("WORKSPACE")}</MenuItem>
</Link>


<MenuItem
onClick={handleSubmenuToggle}
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/configs/appConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@
}
},
"config": {
"showEndPage": false,
"showEndPage": true,
"endPage": [
{
"template": "assessment",
Expand Down
89 changes: 66 additions & 23 deletions packages/nulp_elite/src/pages/LearnathonDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { Pagination } from "@mui/material";

import Footer from "components/Footer";
import Header from "components/header";
import { Button } from "native-base";
const routeConfig = require("../configs/routeConfig.json");

const LearnathonDashboard = () => {
Expand All @@ -43,6 +44,8 @@ const LearnathonDashboard = () => {
const [theme, setTheme] = useState("");
const [state, setState] = useState("");
const [status, setStatus] = useState("");
const [totalParticipants, setTotalParticipants] = useState("");

const { t } = useTranslation();

const themeOptions = [
Expand Down Expand Up @@ -178,6 +181,7 @@ const LearnathonDashboard = () => {
// setIsLoading(false);
}
};

const fetchPublishedContent = async () => {
const assetBody = {
request: {
Expand Down Expand Up @@ -213,11 +217,26 @@ const LearnathonDashboard = () => {
};
fetchTotalSubmissions();
fetchPublishedContent();
totalParticipations();
}, [currentPage, rowsPerPage, search, theme, state, status]);
const handleClick = (contentId) => {
navigate(
`${routeConfig.ROUTES.PLAYER_PAGE.PLAYER}?id=${contentId}&page=vote`
);
const totalParticipations = async () => {
try {
const url = `${urlConfig.URLS.CHECK_USER_ACCESS}`;
const response = await fetch(url);
const data = await response.json();
setTotalParticipants(data.result.totalCount);
} catch (error) {
console.error("Error fetching user data:", error);
}
};

const formatDate = (dateString) => {
const date = new Date(dateString);
return date.toLocaleDateString("en-GB", {
day: "2-digit",
month: "2-digit",
year: "numeric",
});
};
// Inline CSS for the component
const dashboardStyle = {
Expand Down Expand Up @@ -251,12 +270,25 @@ const LearnathonDashboard = () => {
setSearch(e.target.value);
setCurrentPage(1); // Reset to first page on search
};
const handleClearAll = () => {
setTheme("");
setState("");
setStatus("");
setSearch("");
fetchTotalSubmissions();
fetchPublishedContent();
};

return (
<>
<Header />
<div style={dashboardStyle}>
<h1>{t("LERN_DASHBOARD")}</h1>
<div style={gridStyle}>
<div style={boxStyle}>
<h3>{t("TOTAL_PARTICIPANTS")}</h3>
<p style={countStyle}>{totalParticipants}</p>
</div>
<div style={boxStyle}>
<h3>{t("TOTAL_SUBMISSION")}</h3>
<p style={countStyle}>{totalSubmissions}</p>
Expand Down Expand Up @@ -288,9 +320,14 @@ const LearnathonDashboard = () => {
</div>
</div>

<Grid xs={12} style={dashboardStyle}>
<Grid item xs={5}>
<Box display="flex" alignItems="center" mb={2}>
<Grid xs={12} sm={12} style={dashboardStyle}>
<Grid item xs={6}>
<Box
display="flex"
sx={{ minWidth: "100px" }}
gap={1}
alignItems="center"
>
<TextField
variant="outlined"
placeholder={t("SEARCH_SUBMISSION")}
Expand All @@ -300,12 +337,19 @@ const LearnathonDashboard = () => {
endAdornment: <SearchIcon />,
}}
size="small"
sx={{ background: "#fff" }}
sx={{ minWidth: "70px", background: "#fff" }}
/>

<ExportToCSV
sx={{ minWidth: "30px" }}
data={data}
fileName="table_data"
/>
</Box>
</Grid>

{/* Filter Dropdowns */}
<Grid item xs={5}>
<Grid item xs={6}>
<Box display="flex" gap={2} alignItems="center">
<TextField
select
Expand Down Expand Up @@ -354,20 +398,19 @@ const LearnathonDashboard = () => {
</MenuItem>
))}
</TextField>
<Button
type="button"
className="viewAll mb-20"
onClick={handleClearAll}
>
{t("CLEAR_ALL")}
</Button>
</Box>
</Grid>

<Grid item xs={2}>
{/* <Button
className="viewAll"
onClick={() => exportTable()}
sx={{ padding: "7px 45px", borderRadius: "90px !important" }}
>
{t("EXPORT_TABLE")}
</Button> */}

<ExportToCSV data={data} fileName="table_data" />
</Grid>
{/* <Grid item xs={2}>
<ExportToCSV data={data} fileName="table_data" />
</Grid> */}
</Grid>

<TableContainer component={Paper}>
Expand Down Expand Up @@ -395,7 +438,7 @@ const LearnathonDashboard = () => {
<TableCell>{row.city}</TableCell>
<TableCell>{row.name_of_organisation}</TableCell>
<TableCell>
{row.updated_on ? row.updated_on : row.created_on}
{formatDate(row.updated_on ? row.updated_on : row.created_on)}
</TableCell>
<TableCell>{row.status}</TableCell>
<TableCell>
Expand All @@ -407,7 +450,7 @@ const LearnathonDashboard = () => {
routeConfig.ROUTES.PLAYER_PAGE.PLAYER +
"?id=" +
row.learnathon_content_id +
"&page=vote")
"&page=dashboard")
}
sx={{ color: "#054753" }}
className="table-icon"
Expand All @@ -422,7 +465,7 @@ const LearnathonDashboard = () => {
routeConfig.ROUTES.PLAYER_PAGE.PLAYER +
"?id=" +
row.learnathon_content_id +
"&page=lernpreview")
"&page=dashboard")
}
sx={{ color: "#054753" }}
className="table-icon"
Expand Down
7 changes: 7 additions & 0 deletions packages/players/quml/demoData.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ const playerConfig = {
},
metadata: metadata,
config: {
showEndPage: true,
endPage: [
{
template: "assessment",
contentType: ["SelfAssess"],
},
],
traceId: "1234",
sideMenu: {
enable: false,
Expand Down

0 comments on commit 6cc4ce4

Please sign in to comment.