feat: persist tags expanded state
This commit is contained in:
@@ -41,7 +41,7 @@ export const TagsListItem: FunctionComponent<Props> = observer(
|
|||||||
|
|
||||||
const premiumModal = usePremiumModal();
|
const premiumModal = usePremiumModal();
|
||||||
|
|
||||||
const [showChildren, setShowChildren] = useState(hasChildren);
|
const [showChildren, setShowChildren] = useState(tag.expanded);
|
||||||
const [hadChildren, setHadChildren] = useState(hasChildren);
|
const [hadChildren, setHadChildren] = useState(hasChildren);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -58,9 +58,12 @@ export const TagsListItem: FunctionComponent<Props> = observer(
|
|||||||
const toggleChildren = useCallback(
|
const toggleChildren = useCallback(
|
||||||
(e: MouseEvent) => {
|
(e: MouseEvent) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setShowChildren((x) => !x);
|
setShowChildren((x) => {
|
||||||
|
tagsState.setExpanded(tag, !x);
|
||||||
|
return !x;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[setShowChildren]
|
[setShowChildren, tag, tagsState]
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectCurrentTag = useCallback(() => {
|
const selectCurrentTag = useCallback(() => {
|
||||||
|
|||||||
@@ -267,6 +267,12 @@ export class TagsState {
|
|||||||
this.selected_ = tag;
|
this.selected_ = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setExpanded(tag: SNTag, exapnded: boolean) {
|
||||||
|
this.application.changeAndSaveItem<TagMutator>(tag.uuid, (mutator) => {
|
||||||
|
mutator.expanded = exapnded;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public get selectedUuid(): UuidString | undefined {
|
public get selectedUuid(): UuidString | undefined {
|
||||||
return this.selected_?.uuid;
|
return this.selected_?.uuid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.10.0-beta.2",
|
"version": "3.10.0-beta.3",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"@reach/tooltip": "^0.16.2",
|
"@reach/tooltip": "^0.16.2",
|
||||||
"@standardnotes/components": "1.7.0",
|
"@standardnotes/components": "1.7.0",
|
||||||
"@standardnotes/features": "1.29.0",
|
"@standardnotes/features": "1.29.0",
|
||||||
"@standardnotes/snjs": "2.52.2",
|
"@standardnotes/snjs": "2.53.0",
|
||||||
"@standardnotes/settings": "^1.11.3",
|
"@standardnotes/settings": "^1.11.3",
|
||||||
"@standardnotes/sncrypto-web": "1.6.2",
|
"@standardnotes/sncrypto-web": "1.6.2",
|
||||||
"mobx": "^6.3.5",
|
"mobx": "^6.3.5",
|
||||||
|
|||||||
@@ -2650,10 +2650,10 @@
|
|||||||
buffer "^6.0.3"
|
buffer "^6.0.3"
|
||||||
libsodium-wrappers "^0.7.9"
|
libsodium-wrappers "^0.7.9"
|
||||||
|
|
||||||
"@standardnotes/snjs@2.52.2":
|
"@standardnotes/snjs@2.53.0":
|
||||||
version "2.52.2"
|
version "2.53.0"
|
||||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.52.2.tgz#34d1edd3028aa860648548292291d6ecf8666a5f"
|
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.53.0.tgz#151ff71dbc05d1d650fb8d6907d92af9122f5c91"
|
||||||
integrity sha512-5w2RXSquTmyYNSyKgEYqmLLqbHyYCsyrqfWlL0nuQ//hBFcf8OUbsY+Ys132TodpGZn637Al+kygoZxGBVcSyA==
|
integrity sha512-xJLB1W4OP2ApbLZTuO/kVnuq4IS0LHR3aM5WsSmk3g84PiAjvOTYAf/hsUp2/YWq5msxx9wOUi3fB8YFieDqxg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@standardnotes/auth" "^3.15.4"
|
"@standardnotes/auth" "^3.15.4"
|
||||||
"@standardnotes/common" "^1.9.0"
|
"@standardnotes/common" "^1.9.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user