Move "Wild West" as part of a Category definition

- Router: no need to specify the route directly anymore (will come from definition), but we still need to disable it for certain regions.
- Sidebar: no need to custom addition anymore.

## Ticket
`odysee-homepages :: 1318`
This commit is contained in:
infinite-persistence 2022-04-19 15:12:54 +08:00
parent f27b68587e
commit d52593f3b2
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
4 changed files with 6 additions and 17 deletions

View file

@ -190,9 +190,9 @@ function AppRouter(props: Props) {
const tagParams = urlParams.get(CS.TAGS_KEY);
const isLargeScreen = useIsLargeScreen();
const homeCategoryPages = React.useMemo(() => {
const categoryPages = React.useMemo(() => {
const dynamicRoutes = GetLinksData(homepageData, isLargeScreen).filter(
(potentialRoute: any) => potentialRoute && potentialRoute.route
(x: any) => x && x.route && (x.id !== 'WILD_WEST' || !wildWestDisabled)
);
return dynamicRoutes.map((dynamicRouteProps: RowDataItem) => (
@ -204,7 +204,7 @@ function AppRouter(props: Props) {
)}
/>
));
}, [homepageData, isLargeScreen]);
}, [homepageData, isLargeScreen, wildWestDisabled]);
// For people arriving at settings page from deeplinks, know whether they can "go back"
useEffect(() => {
@ -291,8 +291,7 @@ function AppRouter(props: Props) {
<Route path={`/`} exact component={HomePage} />
{(!wildWestDisabled || tagParams) && <Route path={`/$/${PAGES.DISCOVER}`} exact component={DiscoverPage} />}
{!wildWestDisabled && <Route path={`/$/${PAGES.WILD_WEST}`} exact component={DiscoverPage} />}
{homeCategoryPages}
{categoryPages}
<Route path={`/$/${PAGES.AUTH_SIGNIN}`} exact component={SignInPage} />
<Route path={`/$/${PAGES.AUTH_PASSWORD_RESET}`} exact component={PasswordResetPage} />

View file

@ -5,7 +5,7 @@ import { doClearClaimSearch } from 'redux/actions/claims';
import { doClearPurchasedUriSuccess } from 'redux/actions/file';
import { selectFollowedTags } from 'redux/selectors/tags';
import { selectUserVerifiedEmail, selectUser, selectOdyseeMembershipName } from 'redux/selectors/user';
import { selectHomepageData, selectWildWestDisabled } from 'redux/selectors/settings';
import { selectHomepageData } from 'redux/selectors/settings';
import { doSignOut } from 'redux/actions/app';
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
import { selectPurchaseUriSuccess, selectOdyseeMembershipForUri } from 'redux/selectors/claims';
@ -21,7 +21,6 @@ const select = (state) => ({
unseenCount: selectUnseenNotificationCount(state),
user: selectUser(state),
homepageData: selectHomepageData(state),
wildWestDisabled: selectWildWestDisabled(state),
odyseeMembership: selectOdyseeMembershipName(state),
odyseeMembershipByUri: (uri) => selectOdyseeMembershipForUri(state, uri),
});

View file

@ -118,12 +118,6 @@ const UNAUTH_LINKS: Array<SideNavLink> = [
},
];
const WILD_WEST: SideNavLink = {
title: 'Wild West',
link: `/$/${PAGES.WILD_WEST}`,
icon: ICONS.WILD_WEST,
};
// ****************************************************************************
// ****************************************************************************
@ -143,7 +137,6 @@ type Props = {
doClearPurchasedUriSuccess: () => void,
user: ?User,
homepageData: any,
wildWestDisabled: boolean,
doClearClaimSearch: () => void,
odyseeMembership: string,
odyseeMembershipByUri: (uri: string) => string,
@ -166,7 +159,6 @@ function SideNavigation(props: Props) {
homepageData,
user,
followedTags,
wildWestDisabled,
doClearClaimSearch,
odyseeMembership,
odyseeMembershipByUri,
@ -549,7 +541,6 @@ function SideNavigation(props: Props) {
<>
{/* $FlowFixMe: GetLinksData type needs an update */}
{EXTRA_SIDEBAR_LINKS.map((linkProps) => getLink(linkProps))}
{!wildWestDisabled && getLink(WILD_WEST)}
</>
)}
</ul>

View file

@ -20,4 +20,4 @@ export function getHomepageLanguage(code) {
export default HOMEPAGE_LANGUAGES;
export const HOMEPAGE_EXCLUDED_CATEGORIES = Object.freeze(['NEWS']);
export const HOMEPAGE_EXCLUDED_CATEGORIES = Object.freeze(['NEWS', 'WILD_WEST']);