This commit is contained in:
		
						commit
						c336ec7728
					
				|  | @ -62,9 +62,11 @@ import { Post } from 'common/post' | ||||||
| import { isAdmin } from 'common/envs/constants' | import { isAdmin } from 'common/envs/constants' | ||||||
| import { useAllPosts } from 'web/hooks/use-post' | import { useAllPosts } from 'web/hooks/use-post' | ||||||
| import { useGlobalConfig } from 'web/hooks/use-global-config' | import { useGlobalConfig } from 'web/hooks/use-global-config' | ||||||
|  | import { useAdmin } from 'web/hooks/use-admin' | ||||||
| 
 | 
 | ||||||
| export default function Home() { | export default function Home() { | ||||||
|   const user = useUser() |   const user = useUser() | ||||||
|  |   const isAdmin = useAdmin() | ||||||
| 
 | 
 | ||||||
|   useTracking('view home') |   useTracking('view home') | ||||||
| 
 | 
 | ||||||
|  | @ -131,12 +133,16 @@ export default function Home() { | ||||||
|           <LoadingIndicator /> |           <LoadingIndicator /> | ||||||
|         ) : ( |         ) : ( | ||||||
|           <> |           <> | ||||||
|             {renderSections(sections, { |             {renderSections( | ||||||
|               score: trendingContracts, |               sections, | ||||||
|               newest: newContracts, |               { | ||||||
|               'daily-trending': dailyTrendingContracts, |                 score: trendingContracts, | ||||||
|               'daily-movers': contractMetricsByProfit, |                 newest: newContracts, | ||||||
|             })} |                 'daily-trending': dailyTrendingContracts, | ||||||
|  |                 'daily-movers': contractMetricsByProfit, | ||||||
|  |               }, | ||||||
|  |               isAdmin | ||||||
|  |             )} | ||||||
| 
 | 
 | ||||||
|             {groups && groupContracts && trendingGroups.length > 0 ? ( |             {groups && groupContracts && trendingGroups.length > 0 ? ( | ||||||
|               <> |               <> | ||||||
|  | @ -209,7 +215,8 @@ function renderSections( | ||||||
|     'daily-trending': CPMMBinaryContract[] |     'daily-trending': CPMMBinaryContract[] | ||||||
|     newest: CPMMBinaryContract[] |     newest: CPMMBinaryContract[] | ||||||
|     score: CPMMBinaryContract[] |     score: CPMMBinaryContract[] | ||||||
|   } |   }, | ||||||
|  |   isAdmin: boolean | ||||||
| ) { | ) { | ||||||
|   type sectionTypes = typeof HOME_SECTIONS[number]['id'] |   type sectionTypes = typeof HOME_SECTIONS[number]['id'] | ||||||
| 
 | 
 | ||||||
|  | @ -226,7 +233,7 @@ function renderSections( | ||||||
| 
 | 
 | ||||||
|         if (id === 'featured') { |         if (id === 'featured') { | ||||||
|           // For now, only admins can see the featured section, until we all agree its ship-ready
 |           // For now, only admins can see the featured section, until we all agree its ship-ready
 | ||||||
|           if (!isAdmin()) return <></> |           if (!isAdmin) return <></> | ||||||
|           return <FeaturedSection /> |           return <FeaturedSection /> | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user