Classifieds tags (#18) #65
Reference in New Issue
Block a user
Delete Branch "feature/18-classified-topics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #18
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)))nit:
uniq(removeUndefined(value.split(",").map(normalizeTopic)))@@ -42,2 +52,4 @@const back = () => history.back()const normalizeTopics = (value: string) =>uniq(removeUndefined(value.split(",").map(normalizeTopic)).filter(identity))removeUndefined and filter(identity) are redundant. removeUndefined is nice because it excludes undefined from the type, while filter(identity) doesn't
Also, no need to split anymore, since we're not doing comma separated values now
@@ -44,0 +57,4 @@const getTopicSearch = () =>createSearch(uniq(removeUndefined($allTopics.map(topic => normalizeTopic(topic.name))).filter(identity),this could probably be just
$allTopicssince they should already be normalized and deduplicated@@ -44,0 +71,4 @@)const searchTopics = (value: string) => {const topicSearch = getTopicSearch()Topic search should be derived, it's expensive to create a new Fuse instance on every keystroke
@@ -44,0 +76,4 @@const found = normalized? topicSearch.searchValues(normalized): topicSearch.options.map(topic => topic.name)No need to normalize or use a ternary, just do
topicSearch.searchValues(value)@@ -44,0 +105,4 @@const onTopicInput = (e: Event) => {const {value} = e.target as HTMLInputElementif (value.includes(",")) {Drop support for comma separated topics everywhere, it will make this much simpler
198018a728tocb6d6da5d5@@ -74,0 +141,4 @@const topics =pendingTopic && !selectedTopics.includes(pendingTopic)? [...selectedTopics, pendingTopic]: selectedTopicsDon't add the pending topic, instead on blur clear the term
@@ -153,0 +275,4 @@maxWidth: "none",getReferenceClientRect: () => topicWrapper!.getBoundingClientRect(),}} /></div>Go ahead and move this stuff (and the handlers) to its own component,
TopicMultiSelect.5e773d96e0to006e8ca7dc