Make folds page more understandable. Add additional tags on fold creation
This commit is contained in:
parent
705d5cada7
commit
ed9285dbc1
|
@ -69,10 +69,14 @@ export default function Folds(props: {
|
||||||
<Col className="items-center">
|
<Col className="items-center">
|
||||||
<Col className="max-w-2xl w-full px-2 sm:px-0">
|
<Col className="max-w-2xl w-full px-2 sm:px-0">
|
||||||
<Row className="justify-between items-center">
|
<Row className="justify-between items-center">
|
||||||
<Title text="Folds" />
|
<Title text="Manifold communities: Folds" />
|
||||||
{user && <CreateFoldButton />}
|
{user && <CreateFoldButton />}
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
<div className="text-gray-500 mb-6">
|
||||||
|
Browse folds on topics that interest you.
|
||||||
|
</div>
|
||||||
|
|
||||||
<Col className="gap-4">
|
<Col className="gap-4">
|
||||||
{folds.map((fold) => (
|
{folds.map((fold) => (
|
||||||
<Row key={fold.id} className="items-center gap-2">
|
<Row key={fold.id} className="items-center gap-2">
|
||||||
|
@ -99,14 +103,15 @@ export default function Folds(props: {
|
||||||
|
|
||||||
function CreateFoldButton() {
|
function CreateFoldButton() {
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
const [tags, setTags] = useState('')
|
const [otherTags, setOtherTags] = useState('')
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const tags = parseWordsAsTags(toCamelCase(name) + ' ' + otherTags)
|
||||||
|
|
||||||
const updateName = (newName: string) => {
|
const updateName = (newName: string) => {
|
||||||
setName(newName)
|
setName(newName)
|
||||||
setTags(toCamelCase(newName))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
@ -114,7 +119,7 @@ function CreateFoldButton() {
|
||||||
|
|
||||||
const result = await createFold({
|
const result = await createFold({
|
||||||
name,
|
name,
|
||||||
tags: parseWordsAsTags(tags),
|
tags,
|
||||||
}).then((r) => r.data || {})
|
}).then((r) => r.data || {})
|
||||||
|
|
||||||
if (result.fold) {
|
if (result.fold) {
|
||||||
|
@ -140,15 +145,15 @@ function CreateFoldButton() {
|
||||||
}}
|
}}
|
||||||
submitBtn={{
|
submitBtn={{
|
||||||
label: 'Create',
|
label: 'Create',
|
||||||
className: clsx(name && tags ? 'btn-primary' : 'btn-disabled'),
|
className: clsx(name ? 'btn-primary' : 'btn-disabled'),
|
||||||
}}
|
}}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
>
|
>
|
||||||
<Title className="!mt-0" text="Create a fold" />
|
<Title className="!mt-0" text="Create a fold" />
|
||||||
|
|
||||||
<Col className="text-gray-500 gap-1">
|
<Col className="text-gray-500 gap-1">
|
||||||
<div>A fold is a view of markets that match one or more tags.</div>
|
<div>A fold is a sub-community of markets organized on a topic.</div>
|
||||||
<div>You can further exclude individual markets.</div>
|
<div>Markets are included if they match one or more tags.</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Spacer h={4} />
|
<Spacer h={4} />
|
||||||
|
@ -170,27 +175,33 @@ function CreateFoldButton() {
|
||||||
|
|
||||||
<Spacer h={4} />
|
<Spacer h={4} />
|
||||||
|
|
||||||
{/* <div className="form-control w-full">
|
{name && (
|
||||||
|
<>
|
||||||
<label className="label">
|
<label className="label">
|
||||||
<span className="mb-1">Tags</span>
|
<span className="mb-1">Primary tag</span>
|
||||||
|
</label>
|
||||||
|
<TagsList noLink tags={[`#${toCamelCase(name)}`]} />
|
||||||
|
|
||||||
|
<Spacer h={4} />
|
||||||
|
|
||||||
|
<div className="form-control w-full">
|
||||||
|
<label className="label">
|
||||||
|
<span className="mb-1">Additional tags</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
placeholder="Politics, Economics, Rationality"
|
placeholder="Politics, Economics, Rationality"
|
||||||
className="input input-bordered resize-none"
|
className="input input-bordered resize-none"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={tags}
|
value={otherTags}
|
||||||
onChange={(e) => setTags(e.target.value || '')}
|
onChange={(e) => setOtherTags(e.target.value || '')}
|
||||||
/>
|
/>
|
||||||
</div> */}
|
</div>
|
||||||
|
|
||||||
|
<Spacer h={4} />
|
||||||
|
|
||||||
{tags && (
|
|
||||||
<>
|
|
||||||
<label className="label">
|
|
||||||
<span className="mb-1">Primary tag</span>
|
|
||||||
</label>
|
|
||||||
<TagsList
|
<TagsList
|
||||||
tags={parseWordsAsTags(tags).map((tag) => `#${tag}`)}
|
tags={parseWordsAsTags(otherTags).map((tag) => `#${tag}`)}
|
||||||
noLink
|
noLink
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user