-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tweak: pass toggle function as prop (#6221)
* tweak: pass toggle function as prop * cleanup
- Loading branch information
1 parent
cc49072
commit b268f39
Showing
7 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 11 additions & 4 deletions
15
web-common/src/features/dashboards/state-managers/actions/comparison.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import type { DashboardMutables } from "./types"; | ||
|
||
export const setComparisonDimension = ( | ||
export const toggleComparisonDimension = ( | ||
{ dashboard }: DashboardMutables, | ||
dimensionName: string | undefined, | ||
dimensionName: string, | ||
) => { | ||
// Temporary until we make these not mutually exclusive | ||
dashboard.showTimeComparison = false; | ||
dashboard.selectedComparisonDimension = dimensionName; | ||
const isCurrentDimension = | ||
dashboard.selectedComparisonDimension === dimensionName; | ||
|
||
if (!isCurrentDimension) { | ||
dashboard.selectedComparisonDimension = dimensionName; | ||
} else { | ||
dashboard.selectedComparisonDimension = undefined; | ||
} | ||
}; | ||
|
||
export const comparisonActions = { | ||
/** | ||
* Sets the comparison dimension for the dashboard. | ||
*/ | ||
setComparisonDimension, | ||
toggleComparisonDimension, | ||
}; |
b268f39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://ui.rilldata.in as production
🚀 Deployed on https://6758ded927463ab9537a8c16--rill-ui-dev.netlify.app