Skip to content

Conversation

@rknastenka
Copy link
Member

@rknastenka rknastenka commented Dec 19, 2025

Closes #82

  • Resources Count: Added the number of notes/exams to the course page.
    Note: Implemented as inline text rather than a badge for a cleaner, less cluttered UI.
  • Empty States: Tabs(exam or notes) with 0 resources are now disabled.
  • Auto-Switching: If the default tab is empty, the page automatically switches to the non-empty tab.
  • Default tab is always set to exam tab.
  1. Show the number of resources.
    Screenshot_19-12-2025_194345_localhost

  2. Disable and switch tabs
    Screenshot_19-12-2025_194416_localhost

@vercel
Copy link

vercel bot commented Dec 19, 2025

@rknastenka is attempting to deploy a commit to the mrj3 Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Dec 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
psutarchive Ready Ready Preview, Comment Dec 20, 2025 10:45am

);

// Fetch resource counts directly from the resource table
const { data: resourceCounts } = useLazyAsyncData(
Copy link
Member

Choose a reason for hiding this comment

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

@rknastenka I noticed you opted not to use recordCount which actually fetches the count for current tab.
It's currently used to get pages number as you can see in this example. I suggest building on top of it instead of doing duplicate fetches for the count. Let me know if you need any help with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

resourceCounts watches urlId (only re-fetches when course changes)
recordCount watches stateChangeDebounced (re-fetches on every tab/sort/search/page change)

If i used recordCount it would fetch ALL type counts on EVERY state change (tab switch, search, sort, pagination)

the total exam/note counts don't change when you search or sort.
That defeats the purpose of the optimization.

Let's say i made recordCount static (watching only urlId), i'll break pagination for any future search/filtering features because the counts won't update when filters change.

Let me know if you have any other suggestions on how to use only recordCount.

});
});

onMounted(() => {
Copy link
Member

Choose a reason for hiding this comment

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

This was used to handle URLs with ?tab=note/?tab=exam to open the correct tab once page loaded/reloaded. Is there a reason why it was removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before I made this commit, there was a specific bug.
If you clicked on a course that has no exams, then tried to go to another course that has both exams and notes, it would go to the notes tab first, even though the exams tab was set as the default.

That only happens if you follow exactly the steps I mentioned.
Otherwise, it shows the exams tab first.

@itsmohmans itsmohmans changed the base branch from main to dev December 21, 2025 09:17
@rknastenka
Copy link
Member Author

Last commit Closes #92

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.

Show number of notes/exams over the tabs inside a course page

2 participants