Skip to content

Conversation

@YuZaGa
Copy link

@YuZaGa YuZaGa commented May 7, 2024

PR Fixes:

  • 1 Disabled tracks after second page
  • 2 Removed existing implementation for hiding tracks
  • 3 Minor UI changes to RedirectToLogin component

Resolves #[371]

Checklist before requesting a review

  • I have performed a self-review of my code
  • I assure there is no similar/duplicate pull request regarding same issue


let totalPages = Array.from({ length: track.problems.length }, (_, i) => i + 1);

localStorage.setItem('problemIndex', (problemIndex+1).toString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why here?
Also why localStorage?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured we could use problemIndex in other places so why not have it on hand in the parent component i.e BlogAppbar.

const { resolvedTheme } = useTheme();
const session = useSession();
const isAuthenticated = session.status === 'authenticated' && session.data !== null;
const storedProblemIndex = localStorage.getItem('problemIndex');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotionRenderer isn't the only renderer we have
There is the coding renderer as well for example
This'll not work if the third page is a coding problem

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I missed that scenario. Mb. I can try implementing similar functionality in LessionView.tsx and pass a variable (trackVisible) to the components(Blog, CodeRenderer, MCQRenderer). That would be a better way of doing this for now and if and when new components are added

@nimit9
Copy link
Contributor

nimit9 commented May 7, 2024

Hey @YuZaGa no need to use localStorage for this. Have implemented the soln in #395

@YuZaGa
Copy link
Author

YuZaGa commented May 7, 2024

Oh, great. LessonView implementation was exactly what I was going to go for.... I'll close my PR

@YuZaGa YuZaGa closed this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants