Skip to content

Commit

Permalink
Merge pull request #1006 from nextstrain/feat/allow-hiding-custom-cla…
Browse files Browse the repository at this point in the history
…de-columns

feat: allow hiding custom clade columns
  • Loading branch information
corneliusroemer authored Oct 3, 2022
2 parents c8fe93e + d30d608 commit ade06e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages_rs/nextclade-web/src/state/results.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,25 @@ export const hasTreeAtom = selector<boolean>({
},
})

export const cladeNodeAttrDescsAtom = atom<CladeNodeAttrDesc[]>({
key: 'cladeNodeAttrDescs',
const cladeNodeAttrDescsStorageAtom = atom<CladeNodeAttrDesc[]>({
key: 'cladeNodeAttrDescsStorage',
default: [],
})

export const cladeNodeAttrDescsAtom = selector<CladeNodeAttrDesc[]>({
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<string[]>({
key: 'cladeNodeAttrKeys',
get: ({ get }) => get(cladeNodeAttrDescsAtom).map((desc) => desc.name),
Expand Down
1 change: 1 addition & 0 deletions packages_rs/nextclade-web/src/types/auspice/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ declare module 'auspice' {
name: string
displayName: string
description: string
hideInWeb: boolean
}

export declare interface AuspiceMetadata {
Expand Down
2 changes: 2 additions & 0 deletions packages_rs/nextclade/src/tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

1 comment on commit ade06e2

@vercel
Copy link

@vercel vercel bot commented on ade06e2 Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextclade – ./

nextclade.vercel.app
nextclade-git-master-nextstrain.vercel.app
nextclade-nextstrain.vercel.app

Please sign in to comment.