Best way to handle theming in my layout?
Unanswered
Atlantic salmon posted this in #help-forum
Atlantic salmonOP
I'm writing a website for hosting competitions. Both users and competitions can have their own themes, and the site uses the following rules to figure out which one to use:
-
-
-
To do this, I've got a really complicated middleware that sets a header based on the URL, and then my main layout makes a database call to fetch the theme depending on the value of the header. This is not only really ugly, but also not very performant.
What would be a better approach to this? I'm using Radix UI's theming if that makes any difference/
-
/comp/[cid]
: use the comp theme-
/user/[uid]
: use uid's user theme-
/...
: anywhere else, use the currently authenticated user's themeTo do this, I've got a really complicated middleware that sets a header based on the URL, and then my main layout makes a database call to fetch the theme depending on the value of the header. This is not only really ugly, but also not very performant.
What would be a better approach to this? I'm using Radix UI's theming if that makes any difference/