From cf37500ef0da5000e979dd765a8554948a006915 Mon Sep 17 00:00:00 2001 From: Rustem Mussabekov Date: Mon, 6 May 2024 12:50:27 +0300 Subject: [PATCH] - Show suggested collection even for old - Improve collection name search --- package.json | 2 +- .../bookmarks/edit/form/collection/index.js | 8 +++---- .../edit/form/collection/suggested.js | 23 ++++++++++--------- .../form/collection/suggested.module.styl | 21 +++++++++++++---- src/co/bookmarks/edit/form/index.js | 2 +- .../edit/form/tags/suggested.module.styl | 3 ++- src/data/helpers/collections.js | 3 ++- src/data/selectors/bookmarks/single.js | 14 +++++------ src/data/selectors/search/collections.js | 5 ++-- src/data/selectors/search/suggestions.js | 2 +- 10 files changed, 48 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 918a95ae..67b8f87e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "5.6.25", + "version": "5.6.26", "description": "", "author": "", "license": "ISC", diff --git a/src/co/bookmarks/edit/form/collection/index.js b/src/co/bookmarks/edit/form/collection/index.js index 7b1e4e06..806ca6c3 100644 --- a/src/co/bookmarks/edit/form/collection/index.js +++ b/src/co/bookmarks/edit/form/collection/index.js @@ -60,11 +60,9 @@ export default function BookmarkEditFormCollection({ item, onChange, onSave }) { - {item?.collectionId <= 0 ? ( - - ) : null} + {pick && ( diff --git a/src/co/bookmarks/edit/form/collection/suggested.js b/src/co/bookmarks/edit/form/collection/suggested.js index f18ec01d..8acc68dd 100644 --- a/src/co/bookmarks/edit/form/collection/suggested.js +++ b/src/co/bookmarks/edit/form/collection/suggested.js @@ -1,23 +1,24 @@ import s from './suggested.module.styl' import React, { useMemo, useCallback } from 'react' -import t from '~t' import { useSelector } from 'react-redux' import { makeSuggestedFields } from '~data/selectors/bookmarks' -import { makeCollection } from '~data/selectors/collections' +import { makeCollectionPath } from '~data/selectors/collections' import { isPro } from '~data/selectors/user' import Button from '~co/common/button' -import CollectionIcon from '~co/collections/item/icon' function Suggestion({ id, onClick }) { - const getCollection = useMemo(()=>makeCollection(), []) - const collection = useSelector(state=>getCollection(state, id)) + const getCollectionPath = useMemo(()=>makeCollectionPath(), []) + const path = useSelector(state=>getCollectionPath(state, id, { self: true })) + const shortPath = useMemo(()=>path.map((p)=>p.title).slice(-2).join(' / '), [path]) + const fullPath = useMemo(()=>path.map((p)=>p.title).join(' / '), [path]) + const collection = useMemo(()=>path?.[path.length-1], [path]) - if (!collection.title) + if (!collection?.title) return null return ( - ) } @@ -51,8 +52,8 @@ export default function BookmarkEditFormCollectionSuggested({ item, events: { on return (
+ className={s.suggested} + data-is-new={item.collectionId <= 0}> {collections.map(id=>(