fix: hide add tag options if no tags available
This commit is contained in:
@@ -68,6 +68,7 @@ export const NotesOptions = observer(
|
|||||||
</span>
|
</span>
|
||||||
</Switch>
|
</Switch>
|
||||||
<div className="h-1px my-2 bg-secondary-contrast"></div>
|
<div className="h-1px my-2 bg-secondary-contrast"></div>
|
||||||
|
{appState.tags.tagsCount > 0 && (
|
||||||
<Disclosure
|
<Disclosure
|
||||||
open={tagsMenuOpen}
|
open={tagsMenuOpen}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
@@ -128,6 +129,7 @@ export const NotesOptions = observer(
|
|||||||
))}
|
))}
|
||||||
</DisclosurePanel>
|
</DisclosurePanel>
|
||||||
</Disclosure>
|
</Disclosure>
|
||||||
|
)}
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={buttonClass}
|
className={buttonClass}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ContentType, SNSmartTag, SNTag } from '@standardnotes/snjs';
|
import { ContentType, SNSmartTag, SNTag } from '@standardnotes/snjs';
|
||||||
import { action, makeObservable, observable } from 'mobx';
|
import { action, computed, makeObservable, observable } from 'mobx';
|
||||||
import { WebApplication } from '../application';
|
import { WebApplication } from '../application';
|
||||||
|
|
||||||
export class TagsState {
|
export class TagsState {
|
||||||
@@ -13,6 +13,9 @@ export class TagsState {
|
|||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
tags: observable,
|
tags: observable,
|
||||||
smartTags: observable,
|
smartTags: observable,
|
||||||
|
|
||||||
|
tagsCount: computed,
|
||||||
|
|
||||||
addTagToSelectedNotes: action,
|
addTagToSelectedNotes: action,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -43,4 +46,8 @@ export class TagsState {
|
|||||||
);
|
);
|
||||||
this.application.sync();
|
this.application.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get tagsCount(): number {
|
||||||
|
return this.tags.length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user