Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of github.com:tekdi/shiksha-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Nov 29, 2024
2 parents 51c4022 + 88b3bdc commit fe1b0c0
Show file tree
Hide file tree
Showing 22 changed files with 546 additions and 429 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
"PAGE_NOT_FOUND": "Page not found",
"ACCESS_DENIED": "Access Denied",
"YOU_DONT_HAVE_PERMISSION_TO_ACCESS_THIS_PAGE": "You don't have access to this page",
"RETURN_TO_LOGIN": "Return to Login"
"RETURN_TO_LOGIN": "Return to Login",
"COHORT_CODE_EXISTS": "Code already exists"

},
"LOGIN_PAGE": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DeleteUserModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({
);
};

export default DeleteUserModal;
export default DeleteUserModal;
3 changes: 2 additions & 1 deletion src/components/ReassignCenterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
setReassignAlertModal(true);
setAssignedTeamLeader(resp?.userDetails?.length);
setSelectedBlockForTL(checkedCenters[0]);
const userNames = resp?.userDetails?.map((user: any) => user.name);
const userNames = resp?.userDetails?.map((user: any) => firstLetterInUpperCase(user.name));

setSelectedTLUserID(userId);
setAssignedTeamLeaderNames(userNames);
} else {
Expand Down
10 changes: 7 additions & 3 deletions src/components/ResourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { fetchContent } from "@/services/PlayerService";
interface ResourceCardProps {
title: string;
// type: string;
// resource: string;
resource: string;
identifier: string;
appIcon?: string;
}

const ResourceCard: React.FC<ResourceCardProps> = ({
title,
// type,
// resource,
resource,
identifier,
appIcon,
}) => {
Expand All @@ -42,7 +42,11 @@ const ResourceCard: React.FC<ResourceCardProps> = ({

const openPlayers = () => {
sessionStorage.setItem("previousPage", window.location.href);
router.push(`/play/content/${identifier}`);
if (resource === "Course") {
router.push(`/course-hierarchy/${identifier}`);
} else {
router.push(`/play/content/${identifier}`);
}
};

return (
Expand Down
3 changes: 2 additions & 1 deletion src/components/RouteGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const RouteGuard: React.FC<{ children: React.ReactNode }> = ({ children }) => {
"/csvDetails",
"/csvList",
"/play",
"/edit-password"
"/edit-password",
"/course-hierarchy"
];

const isCoursePlannerContent = coursePlannerPaths.some((path) =>
Expand Down
5 changes: 3 additions & 2 deletions src/components/SendCredentialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ const SendCredentialModal: React.FC<SendCredentialModalProps> = ({
<Box
p="18px"
display="flex"
justifyContent="space-between"
alignItems="center"
justifyContent="flex-end"
gap="8px"
alignItems="center"
>
{userType === Role.STUDENT ? (
<Button
Expand Down
18 changes: 9 additions & 9 deletions src/components/layouts/sidebar/MenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ const Menuitems = [
{
title: "SIDEBAR.CENTERS",
icon: centerIcon,
href: "/centers",
href: ["/centers"],
},
{
title: "SIDEBAR.MANAGE_USERS",
icon: userIcon,
subOptions: [
{
title: "SIDEBAR.TEAM_LEADERS",
href: "/team-leader",
href: ["/team-leader"],
},
{
title: "SIDEBAR.FACILITATORS",
href: "/faciliator",
href: ["/faciliator"],
},
{
title: "SIDEBAR.LEARNERS",
href: "/learners",
href: ["/learners"],
},
],
},
Expand All @@ -38,15 +38,15 @@ const Menuitems = [
subOptions: [
{
title: "MASTER.STATE",
href: "/state",
href: ["/state"],
},
{
title: "MASTER.DISTRICTS",
href: "/district",
href: ["/district"],
},
{
title: "MASTER.BLOCKS",
href: "/block",
href: ["/block"],
},
],
},
Expand All @@ -55,7 +55,7 @@ const Menuitems = [
{
title: "SIDEBAR.COURSE_PLANNER",
icon: coursePlannerIcon,
href: "/course-planner",
href: ["/course-planner", "/stateDetails", "/subjectDetails", "/importCsv", "/resourceList", "/play/content/[identifier]"],
},
]
: []),
Expand All @@ -64,7 +64,7 @@ const Menuitems = [
{
title: "SIDEBAR.WORKSPACE",
icon: dashboardIcon,
href: "/workspace/content/create",
href: ["/workspace/content/create"],
},
]
: []),
Expand Down
12 changes: 6 additions & 6 deletions src/components/layouts/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ const Sidebar = ({
if (item.subOptions) {
handleClick(index);
} else {
router.push(item.href);
router.push(item.href[0]);
onSidebarClose();
}
}}
selected={location === item.href}
selected={item.href?.includes(location)}
sx={{
mb: 1,

...(location === item.href && {
...(item.href?.includes(location) && {
color: "black",
backgroundColor: (theme) =>
`${theme.palette.primary.main}!important`,
Expand Down Expand Up @@ -109,15 +109,15 @@ const Sidebar = ({
button
key={subItem.title}
onClick={() => {
router.push(subItem.href);
router.push(subItem.href[0]);
onSidebarClose();
}}
selected={location === subItem.href}
selected={subItem.href.includes(location)}
sx={{
pl: 8,
ml: 2,
mb: 1,
...(location === subItem.href && {
...(subItem.href.includes(location) && {
color: "black",
backgroundColor: (theme) =>
`${theme.palette.primary.main}!important`,
Expand Down
43 changes: 27 additions & 16 deletions src/data/player-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { getDeviceId } from "@/utils/Helper";
import { PlayerConfig } from "@/utils/Interfaces";

let name = "";
if (typeof window !== "undefined" && window.localStorage) {
name = localStorage.getItem("userName") || "";
}

const DeviceId = getDeviceId().then((deviceId) => {
return deviceId;
});

export const V2PlayerConfig: PlayerConfig = {
context: {
mode: "play",
Expand All @@ -9,17 +19,17 @@ export const V2PlayerConfig: PlayerConfig = {
ver: "1.0.0",
pid: "admin-portal",
},
contentId: "do_12345",
contentId: "",
sid: "",
uid: "",
timeDiff: -0.089,
channel: "test-k12-channel",
tags: ["test-k12-channel"],
did: "",
contextRollup: { l1: "test-k12-channel" },
channel: process.env.NEXT_PUBLIC_CHANNEL_ID || "",
tags: [process.env.NEXT_PUBLIC_CHANNEL_ID || ""],
did: DeviceId,
contextRollup: { l1: process.env.NEXT_PUBLIC_CHANNEL_ID || "" },
objectRollup: {},
userData: { firstName: "Guest", lastName: "User" },
host: "https://telemetry.prathamdigital.org",
userData: { firstName: name, lastName: "" },
host: "",
endpoint: "/v1/telemetry",
},
config: {
Expand All @@ -29,7 +39,7 @@ export const V2PlayerConfig: PlayerConfig = {
host: "",
overlay: { showUser: false },
splash: {
text: "",
text: "Powered by Pratham",
icon: "",
bgImage: "assets/icons/splacebackground_1.png",
webLink: "",
Expand All @@ -50,6 +60,7 @@ export const V2PlayerConfig: PlayerConfig = {
},
data: {},
};

export const V1PlayerConfig: PlayerConfig = {
config: {
whiteListUrl: [],
Expand Down Expand Up @@ -110,21 +121,21 @@ export const V1PlayerConfig: PlayerConfig = {
ver: "1.0.0",
pid: "admin-portal",
},
contentId: "do_12345",
contentId: "",
sid: "",
uid: "",
timeDiff: -1.129,
contextRollup: {},
channel: "test-k12-channel",
did: "",
channel: process.env.NEXT_PUBLIC_CHANNEL_ID || "",
did: DeviceId,
dims: [],
tags: ["test-k12-channel"],
app: ["test-k12-channel"],
tags: [process.env.NEXT_PUBLIC_CHANNEL_ID || ""],
app: [process.env.NEXT_PUBLIC_CHANNEL_ID || ""],
cdata: [],
userData: {
firstName: "Guest",
lastName: "User",
firstName: name,
lastName: "",
},
},
data: {}
data: {},
};
4 changes: 2 additions & 2 deletions src/pages/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const setIsArchived = useSubmittedButtonStore(
const blocks = response?.result?.values || [];
setBlocksOptionRead(blocks);

const blockNameArray = blocks.map((item: any) => item.label);
const blockNameArray = blocks.map((item: any) => item.label.toLowerCase());
setBlockNameArr(blockNameArray);

const blockCodeArray = blocks.map((item: any) => item.value);
Expand Down Expand Up @@ -397,7 +397,7 @@ const setIsArchived = useSubmittedButtonStore(
const transformedName = blockDetail.name;

const matchingBlock = blocksOptionRead.find(
(block: BlockOption) => block.label === transformedName
(block: BlockOption) => block?.label?.toLowerCase() === transformedName?.toLowerCase()
);

return {
Expand Down
Loading

0 comments on commit fe1b0c0

Please sign in to comment.