diff --git a/packages_rs/nextclade-web/src/state/results.state.ts b/packages_rs/nextclade-web/src/state/results.state.ts index 1c0760272..5a807e378 100644 --- a/packages_rs/nextclade-web/src/state/results.state.ts +++ b/packages_rs/nextclade-web/src/state/results.state.ts @@ -215,11 +215,25 @@ export const hasTreeAtom = selector({ }, }) -export const cladeNodeAttrDescsAtom = atom({ - key: 'cladeNodeAttrDescs', +const cladeNodeAttrDescsStorageAtom = atom({ + key: 'cladeNodeAttrDescsStorage', default: [], }) +export const cladeNodeAttrDescsAtom = selector({ + key: 'cladeNodeAttrDescs', + get({ get }): CladeNodeAttrDesc[] { + return get(cladeNodeAttrDescsStorageAtom).filter(({ hideInWeb }) => !hideInWeb) + }, + + set({ set, reset }, descs: CladeNodeAttrDesc[] | DefaultValue) { + set(cladeNodeAttrDescsStorageAtom, descs) + if (isDefaultValue(descs)) { + reset(cladeNodeAttrDescsStorageAtom) + } + }, +}) + export const cladeNodeAttrKeysAtom = selector({ key: 'cladeNodeAttrKeys', get: ({ get }) => get(cladeNodeAttrDescsAtom).map((desc) => desc.name), diff --git a/packages_rs/nextclade-web/src/types/auspice/index.d.ts b/packages_rs/nextclade-web/src/types/auspice/index.d.ts index 5caad5c8f..52d79e2ee 100644 --- a/packages_rs/nextclade-web/src/types/auspice/index.d.ts +++ b/packages_rs/nextclade-web/src/types/auspice/index.d.ts @@ -203,6 +203,7 @@ declare module 'auspice' { name: string displayName: string description: string + hideInWeb: boolean } export declare interface AuspiceMetadata { diff --git a/packages_rs/nextclade/src/tree/tree.rs b/packages_rs/nextclade/src/tree/tree.rs index de0b9c45e..1a4ad872f 100644 --- a/packages_rs/nextclade/src/tree/tree.rs +++ b/packages_rs/nextclade/src/tree/tree.rs @@ -167,6 +167,8 @@ pub struct CladeNodeAttrKeyDesc { pub name: String, pub display_name: String, pub description: String, + #[serde(default)] + pub hide_in_web: bool, } #[derive(Clone, Serialize, Deserialize, Validate, Debug)]