mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-19 22:46:20 -05:00
Always fetching frequent tags. Not showing the most recent tags if there are no results. Handling quoted URL for tag names.
This commit is contained in:
parent
1913755db5
commit
3d74b4bcfc
2 changed files with 22 additions and 3 deletions
|
|
@ -425,8 +425,23 @@ export function AddTagsButton({
|
|||
if (open) {
|
||||
setFilterText('');
|
||||
setHasSelectedTag(false);
|
||||
setFrequentTagsLabel('Recent Tags');
|
||||
getRecentTags().then(names => setFrequentTags(names));
|
||||
if (selectedTagNames && selectedTagNames.length === 1) {
|
||||
setHasSelectedTag(true);
|
||||
getCooccurringTags(selectedTagNames[0]).then(coTags => {
|
||||
if (coTags && coTags.length > 0) {
|
||||
setFrequentTags(coTags);
|
||||
setFrequentTagsLabel('Frequent Tags');
|
||||
} else {
|
||||
setFrequentTags([]);
|
||||
setFrequentTagsLabel('Recent Tags');
|
||||
}
|
||||
});
|
||||
} else if (!selectedTagNames || selectedTagNames.length === 0) {
|
||||
setFrequentTagsLabel('Recent Tags');
|
||||
getRecentTags().then(names => setFrequentTags(names));
|
||||
} else {
|
||||
setFrequentTags([]);
|
||||
}
|
||||
const timeout = setTimeout(() => {
|
||||
if (filterInputRef.current && window.innerWidth >= 700) {
|
||||
filterInputRef.current.focus();
|
||||
|
|
@ -456,12 +471,14 @@ export function AddTagsButton({
|
|||
setFilterText('');
|
||||
onAdd(name);
|
||||
onChange(newTags, null);
|
||||
if (!hasSelectedTag && newTags.length === 1) {
|
||||
if (!hasSelectedTag) {
|
||||
setHasSelectedTag(true);
|
||||
getCooccurringTags(name).then(coTags => {
|
||||
if (coTags && coTags.length > 0) {
|
||||
setFrequentTags(coTags);
|
||||
setFrequentTagsLabel('Frequent Tags');
|
||||
} else {
|
||||
setFrequentTags([]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue