Break up user state from portal context global state
To break up the monolithic portal context, we should extract user-related state to its own global context.
How it looks now
currentUserPortal
setCurrentUserPortal
You may notice that the interface exposes the setter for the user. I believe this should not be exposed.
How it should look
const { user, isLoading, login, logout } = useUserStore();
Instead of exposing the setter, we will expose practical functions that handle login and logout.
Benefit
As mentioned, it would be more practical to interface with the user state this way.
Another benefit is performance. By breaking down the PortalContext,
fewer components will depend on it. Therefore, fewer components must be re-render when an unrelated state gets updated.