Classifieds tags (#18) #65

Merged
hodlbod merged 1 commits from feature/18-classified-topics into dev 2026-02-25 00:09:51 +00:00
Collaborator

Closes #18

Closes #18
hodlbod requested changes 2026-02-17 22:04:34 +00:00
hodlbod left a comment
Owner

Imitate ProfileMultiSelect/CurrencyInput for topic suggestions. The current selection ui is pretty ugly. This will take a search function (use createSearch from welshman), and will show selected topics as individual buttons, removing the need for a lot of the normalization stuff.

Imitate ProfileMultiSelect/CurrencyInput for topic suggestions. The current selection ui is pretty ugly. This will take a search function (use createSearch from welshman), and will show selected topics as individual buttons, removing the need for a lot of the normalization stuff.
@@ -42,2 +44,4 @@
const back = () => history.back()
const normalizeTopics = (value: string) =>
Array.from(new Set(value.split(",").map(normalizeTopic).filter(identity)))
Owner

nit: uniq(removeUndefined(value.split(",").map(normalizeTopic)))

nit: `uniq(removeUndefined(value.split(",").map(normalizeTopic)))`
hodlbod requested changes 2026-02-18 20:31:45 +00:00
@@ -42,2 +52,4 @@
const back = () => history.back()
const normalizeTopics = (value: string) =>
uniq(removeUndefined(value.split(",").map(normalizeTopic)).filter(identity))
Owner

removeUndefined and filter(identity) are redundant. removeUndefined is nice because it excludes undefined from the type, while filter(identity) doesn't

removeUndefined and filter(identity) are redundant. removeUndefined is nice because it excludes undefined from the type, while filter(identity) doesn't
Owner

Also, no need to split anymore, since we're not doing comma separated values now

Also, no need to split anymore, since we're not doing comma separated values now
hodlbod marked this conversation as resolved
@@ -44,0 +57,4 @@
const getTopicSearch = () =>
createSearch(
uniq(
removeUndefined($allTopics.map(topic => normalizeTopic(topic.name))).filter(identity),
Owner

this could probably be just $allTopics since they should already be normalized and deduplicated

this could probably be just `$allTopics` since they should already be normalized and deduplicated
hodlbod marked this conversation as resolved
@@ -44,0 +71,4 @@
)
const searchTopics = (value: string) => {
const topicSearch = getTopicSearch()
Owner

Topic search should be derived, it's expensive to create a new Fuse instance on every keystroke

Topic search should be derived, it's expensive to create a new Fuse instance on every keystroke
hodlbod marked this conversation as resolved
@@ -44,0 +76,4 @@
const found = normalized
? topicSearch.searchValues(normalized)
: topicSearch.options.map(topic => topic.name)
Owner

No need to normalize or use a ternary, just do topicSearch.searchValues(value)

No need to normalize or use a ternary, just do `topicSearch.searchValues(value)`
hodlbod marked this conversation as resolved
@@ -44,0 +105,4 @@
const onTopicInput = (e: Event) => {
const {value} = e.target as HTMLInputElement
if (value.includes(",")) {
Owner

Drop support for comma separated topics everywhere, it will make this much simpler

Drop support for comma separated topics everywhere, it will make this much simpler
hodlbod marked this conversation as resolved
hodlbod force-pushed feature/18-classified-topics from 198018a728 to cb6d6da5d5 2026-02-18 23:03:45 +00:00 Compare
hodlbod requested changes 2026-02-18 23:09:09 +00:00
@@ -74,0 +141,4 @@
const topics =
pendingTopic && !selectedTopics.includes(pendingTopic)
? [...selectedTopics, pendingTopic]
: selectedTopics
Owner

Don't add the pending topic, instead on blur clear the term

Don't add the pending topic, instead on blur clear the term
@@ -153,0 +275,4 @@
maxWidth: "none",
getReferenceClientRect: () => topicWrapper!.getBoundingClientRect(),
}} />
</div>
Owner

Go ahead and move this stuff (and the handlers) to its own component, TopicMultiSelect.

Go ahead and move this stuff (and the handlers) to its own component, `TopicMultiSelect`.
hodlbod force-pushed feature/18-classified-topics from 5e773d96e0 to 006e8ca7dc 2026-02-25 00:09:27 +00:00 Compare
hodlbod merged commit 985fd46243 into dev 2026-02-25 00:09:51 +00:00
hodlbod deleted branch feature/18-classified-topics 2026-02-25 00:09:51 +00:00
Sign in to join this conversation.