mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(themes): inherit selected theme in pending post page
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import useThemeStore from '../stores/use-theme-store';
|
||||
import useDefaultSubplebbits from './use-default-subplebbits';
|
||||
import { isAllView, isHomeView, isNotFoundView, isSubscriptionsView } from '../lib/utils/view-utils';
|
||||
import { isAllView, isHomeView, isNotFoundView, isPendingPostView, isSubscriptionsView } from '../lib/utils/view-utils';
|
||||
import { nsfwTags } from '../views/home/home';
|
||||
|
||||
const useInitialTheme = () => {
|
||||
const location = useLocation();
|
||||
const { subplebbitAddress } = useParams<{ subplebbitAddress: string }>();
|
||||
const getTheme = useThemeStore((state) => state.getTheme);
|
||||
const currentTheme = useThemeStore((state) => state.currentTheme);
|
||||
const subplebbits = useDefaultSubplebbits();
|
||||
const params = useParams();
|
||||
const isInHomeView = isHomeView(location.pathname);
|
||||
const isInNotFoundView = isNotFoundView(location.pathname, params);
|
||||
const isInAllView = isAllView(location.pathname, params);
|
||||
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
|
||||
const isInPendingPostView = isPendingPostView(location.pathname, params);
|
||||
|
||||
if (isInAllView) {
|
||||
if (isInPendingPostView) {
|
||||
return currentTheme || 'yotsuba';
|
||||
} else if (isInAllView) {
|
||||
return getTheme('all') || 'yotsuba-b';
|
||||
} else if (isInSubscriptionsView) {
|
||||
return getTheme('subscriptions') || 'yotsuba-b';
|
||||
|
||||
Reference in New Issue
Block a user