Skip to content

Commit

Permalink
Merge pull request #306 from Rushikesh-Sonawane99/release-1.0.0
Browse files Browse the repository at this point in the history
Issue #PS-2416 chore: Resolved option dispay issue and restricted direct route hit to redirect centers page
  • Loading branch information
itsvick authored Nov 10, 2024
2 parents 8a6c991 + 5ed3bdf commit 32f5212
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/pages/course-planner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ import coursePlannerStore from "@/store/coursePlannerStore";
import taxonomyStore from "@/store/tanonomyStore";
import { telemetryFactory } from "@/utils/telemetry";
import { TelemetryEventType } from "@/utils/app.constant";
import useStore from "@/store/store";

const Foundation = () => {
const router = useRouter();
const { t } = useTranslation();
const theme = useTheme();
const userStore = useStore();
const isActiveYear = userStore.isActiveYearSelected;
const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm"));
const isMediumScreen = useMediaQuery(theme.breakpoints.between("sm", "md"));
const store = coursePlannerStore();
Expand Down Expand Up @@ -116,7 +119,8 @@ const Foundation = () => {
if (userStateName) {
getFrameworkDetails();
}
}, [userStateName]);
!isActiveYear && router.push("/centers");
}, [userStateName, isActiveYear]);

const handleCardClick = (id: any) => {
router.push(`/stateDetails?cardId=${id}`);
Expand Down
6 changes: 5 additions & 1 deletion src/pages/play/content/[identifier].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { V1PlayerConfig, V2PlayerConfig } from "../../../data/player-config";
import Loader from "@/components/Loader";
import { useTranslation } from "react-i18next";
import useStore from "@/store/store";

// @ts-ignore
const SunbirdPlayers = dynamic(() => import("editor/SunbirdPlayers"), {
Expand All @@ -34,6 +35,8 @@ const Players: React.FC<SunbirdPlayerProps> = () => {
const { t } = useTranslation();
const { identifier } = router.query;
const [loading, setLoading] = useState(true);
const store = useStore();
const isActiveYear = store.isActiveYearSelected;

useEffect(() => {
const loadContent = async () => {
Expand Down Expand Up @@ -66,7 +69,8 @@ const Players: React.FC<SunbirdPlayerProps> = () => {
}
};
loadContent();
}, [identifier]);
!isActiveYear && router.push("/centers");
}, [identifier, isActiveYear]);

return (
<Box>
Expand Down
2 changes: 1 addition & 1 deletion src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useStore = create(
// state: "",
// district: "",
// block: "",
isActiveYearSelected: '',
isActiveYearSelected: true,
// setPid: (newPid) => set((state) => ({ pid: newPid })),
// setPid: (newPid) => set((state) => ({ pid: newPid })),
// setPid: (newPid) => set((state) => ({ pid: newPid })),
Expand Down

0 comments on commit 32f5212

Please sign in to comment.