From 778ef649e8f428bbacdc0a917cc65f0251118d21 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 19 Apr 2022 19:29:39 +0800 Subject: [PATCH] Wild West is now a real category, so can't use `dynamicRouteProps === null` to identify it. A bit troublesome to handle, but at least the code is clearer now. --- ui/component/router/view.jsx | 4 +--- ui/page/discover/view.jsx | 19 ++++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index 11f873a62..5d8cee40c 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -199,9 +199,7 @@ function AppRouter(props: Props) { ( - - )} + component={(routerProps) => } /> )); }, [homepageData, isLargeScreen, wildWestDisabled]); diff --git a/ui/page/discover/view.jsx b/ui/page/discover/view.jsx index bfc3f8955..9374b5964 100644 --- a/ui/page/discover/view.jsx +++ b/ui/page/discover/view.jsx @@ -25,7 +25,6 @@ type Props = { followedTags: Array, repostedUri: string, repostedClaim: ?GenericClaim, - hideRepostRibbon?: boolean, languageSetting: string, searchInLanguage: boolean, doToggleTagFollowDesktop: (string) => void, @@ -41,7 +40,6 @@ function DiscoverPage(props: Props) { followedTags, repostedClaim, repostedUri, - hideRepostRibbon, languageSetting, searchInLanguage, doToggleTagFollowDesktop, @@ -55,7 +53,7 @@ function DiscoverPage(props: Props) { const buttonRef = useRef(); const isHovering = useHover(buttonRef); const isMobile = useIsMobile(); - const isWildWest = window.location.pathname === `/$/${PAGES.WILD_WEST}`; + const isWildWest = dynamicRouteProps && dynamicRouteProps.id === 'WILD_WEST'; const urlParams = new URLSearchParams(search); const langParam = urlParams.get(CS.LANGUAGE_KEY) || null; @@ -63,9 +61,8 @@ function DiscoverPage(props: Props) { const tagsQuery = urlParams.get('t') || null; const tags = tagsQuery ? tagsQuery.split(',') : null; const repostedClaimIsResolved = repostedUri && repostedClaim; + const hideRepostRibbon = !isWildWest; - const discoverIcon = SIMPLE_SITE ? ICONS.WILD_WEST : ICONS.DISCOVER; - const discoverLabel = SIMPLE_SITE ? __('Wild West') : __('All Content'); // Eventually allow more than one tag on this page // Restricting to one to make follow/unfollow simpler const tag = (tags && tags[0]) || null; @@ -172,15 +169,15 @@ function DiscoverPage(props: Props) { } else { headerLabel = ( - - {(dynamicRouteProps && __(`${dynamicRouteProps.title}`)) || discoverLabel} + + {(dynamicRouteProps && __(`${dynamicRouteProps.title}`)) || __('All Content')} ); } let releaseTime = dynamicRouteProps && dynamicRouteProps.options && dynamicRouteProps.options.releaseTime ? dynamicRouteProps.options.releaseTime - : !dynamicRouteProps && !tags && `>${Math.floor(moment().subtract(0, 'hour').startOf('week').unix())}`; + : !isWildWest && `>${Math.floor(moment().subtract(0, 'hour').startOf('week').unix())}`; return ( : undefined} subSection={getSubSection()} tileLayout={repostedUri ? false : tileLayout} - defaultOrderBy={SIMPLE_SITE ? (dynamicRouteProps ? undefined : CS.ORDER_BY_TRENDING) : undefined} + defaultOrderBy={isWildWest || tags ? CS.ORDER_BY_TRENDING : undefined} claimType={claimType ? [claimType] : undefined} headerLabel={headerLabel} tags={tags} @@ -207,7 +204,7 @@ function DiscoverPage(props: Props) { // TODO: find a better way to determine discover / wild west vs other modes release times // for now including && !tags so that releaseTime={releaseTime || undefined} - feeAmount={SIMPLE_SITE ? !dynamicRouteProps && CS.FEE_AMOUNT_ANY : undefined} + feeAmount={isWildWest || tags ? CS.FEE_AMOUNT_ANY : undefined} channelIds={channelIds} limitClaimsPerChannel={ SIMPLE_SITE