Make categories work when signed out
This commit is contained in:
parent
b236ebdbd9
commit
9cb24c9f3c
|
@ -115,7 +115,6 @@ export function ContractSearch(props: {
|
||||||
{showCategorySelector && (
|
{showCategorySelector && (
|
||||||
<CategorySelector
|
<CategorySelector
|
||||||
className="mb-2"
|
className="mb-2"
|
||||||
user={user}
|
|
||||||
category={category}
|
category={category}
|
||||||
setCategory={setCategory}
|
setCategory={setCategory}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import { User } from '../../../common/user'
|
|
||||||
import { Row } from '../layout/row'
|
import { Row } from '../layout/row'
|
||||||
import { CATEGORIES, CATEGORY_LIST } from '../../../common/categories'
|
import { CATEGORIES, CATEGORY_LIST } from '../../../common/categories'
|
||||||
|
|
||||||
export function CategorySelector(props: {
|
export function CategorySelector(props: {
|
||||||
user: User | null | undefined
|
|
||||||
category: string
|
category: string
|
||||||
setCategory: (category: string) => void
|
setCategory: (category: string) => void
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { className, user, category, setCategory } = props
|
const { className, category, setCategory } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row
|
<Row
|
||||||
|
@ -24,8 +22,7 @@ export function CategorySelector(props: {
|
||||||
key="all"
|
key="all"
|
||||||
category="All"
|
category="All"
|
||||||
isFollowed={category === 'all'}
|
isFollowed={category === 'all'}
|
||||||
toggle={async () => {
|
toggle={() => {
|
||||||
if (!user?.id) return
|
|
||||||
setCategory('all')
|
setCategory('all')
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -35,8 +32,7 @@ export function CategorySelector(props: {
|
||||||
key={cat}
|
key={cat}
|
||||||
category={CATEGORIES[cat].split(' ')[0]}
|
category={CATEGORIES[cat].split(' ')[0]}
|
||||||
isFollowed={cat === category}
|
isFollowed={cat === category}
|
||||||
toggle={async () => {
|
toggle={() => {
|
||||||
if (!user?.id) return
|
|
||||||
setCategory(cat)
|
setCategory(cat)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -39,11 +39,7 @@ export default function Activity() {
|
||||||
<>
|
<>
|
||||||
<Page assertUser="signed-in" suspend={!!contract}>
|
<Page assertUser="signed-in" suspend={!!contract}>
|
||||||
<Col className="mx-auto w-full max-w-[700px]">
|
<Col className="mx-auto w-full max-w-[700px]">
|
||||||
<CategorySelector
|
<CategorySelector category={category} setCategory={setCategory} />
|
||||||
user={user}
|
|
||||||
category={category}
|
|
||||||
setCategory={setCategory}
|
|
||||||
/>
|
|
||||||
<Spacer h={1} />
|
<Spacer h={1} />
|
||||||
{feed ? (
|
{feed ? (
|
||||||
<ActivityFeed
|
<ActivityFeed
|
||||||
|
|
Loading…
Reference in New Issue
Block a user