diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index 32ccc26d..8ea2d1bd 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -22,10 +22,9 @@ import { Spacer } from './layout/spacer' import { ENV } from 'common/envs/constants' import { useUser } from 'web/hooks/use-user' import { useFollows } from 'web/hooks/use-follows' -import { ChoicesToggleGroup } from './choices-toggle-group' import { EditCategoriesButton } from './feed/category-selector' -import { Col } from './layout/col' import { CATEGORIES } from 'common/categories' +import { Tabs } from './layout/tabs' const searchClient = algoliasearch( 'GJQPAYENIF', @@ -271,28 +270,33 @@ function CategoryFollowSelector(props: { const followingLabel = `Following ${follows.length}` return ( - - setMode(c as 'categories' | 'following')} - /> + +
{categoriesDescription}
+ + + ), + }, + ...(user + ? [ + { + title: followingLabel, - {mode === 'categories' && user && ( - -
{categoriesDescription}
- -
- )} - - {mode === 'following' && user && ( - -
Showing markets created by users you are following.
-
- )} - + content: ( + +
Showing markets by users you are following.
+
+ ), + }, + ] + : []), + ]} + onClick={(_, index) => setMode(index === 0 ? 'categories' : 'following')} + /> ) } diff --git a/web/components/layout/tabs.tsx b/web/components/layout/tabs.tsx index eeab17f9..37e38f64 100644 --- a/web/components/layout/tabs.tsx +++ b/web/components/layout/tabs.tsx @@ -15,7 +15,7 @@ export function Tabs(props: { tabs: Tab[] defaultIndex?: number className?: string - onClick?: (tabName: string) => void + onClick?: (tabTitle: string, index: number) => void }) { const { tabs, defaultIndex, className, onClick } = props const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0) @@ -34,7 +34,7 @@ export function Tabs(props: { e.preventDefault() } setActiveIndex(i) - onClick?.(tab.title) + onClick?.(tab.title, i) }} className={clsx( activeIndex === i