Skip to content

Commit

Permalink
🚧 add URL query
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Oct 7, 2024
1 parent cba6427 commit 353b1e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const modifyStateViaURLQuery = (state, query) => {
if (query.m && state.branchLengthsToDisplay === "divAndDate") {
state["distanceMeasure"] = query.m;
}
if (query.focus === undefined) {
state["treeFocus"] = false;
} else {
state["treeFocus"] = true;
}
if (query.c) {
state["colorBy"] = query.c;
}
Expand Down
10 changes: 10 additions & 0 deletions src/middleware/changeURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ export const changeURLMiddleware = (store) => (next) => (action) => {
query.p = action.notInURLState === true ? undefined : action.data;
break;
}
case types.TOGGLE_TREE_FOCUS: {
// "null" is truthy - see query.ci implementation
if ("focus" in action) {
query.focus = action.focus ? null : undefined
}
else {
query.focus = ("focus" in query) ? undefined : null;
}
break;
}
case types.TOGGLE_SIDEBAR: {
// we never add this to the URL on purpose -- it should be manually set as it specifies a world
// where resizes can not open / close the sidebar. The exception is if it's toggled, we
Expand Down

0 comments on commit 353b1e6

Please sign in to comment.