forked from Sage-Bionetworks/synapse-web-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more progress, new SynapsePlot wrapper that is supposed to handle cha…
…nges to the query filters
- Loading branch information
1 parent
b6c32a7
commit 0c6e12e
Showing
5 changed files
with
80 additions
and
21 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
10 changes: 1 addition & 9 deletions
10
packages/synapse-react-client/src/components/Markdown/widget/MarkdownSynapsePlot.tsx
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,16 +1,8 @@ | ||
import React from 'react' | ||
import SynapsePlot, { SynapsePlotProps } from '../../Plot/SynapsePlot' | ||
import { useWikiContext } from '../SynapseWikiContext' | ||
|
||
export type PlotWidgetParams = SynapsePlotProps['widgetparamsMapped'] | ||
|
||
export default function MarkdownSynapsePlot(props: PlotWidgetParams) { | ||
const { ownerId, wikiId, wikiPage } = useWikiContext() | ||
return ( | ||
<SynapsePlot | ||
ownerId={ownerId} | ||
wikiId={wikiId || wikiPage?.id} | ||
widgetparamsMapped={props} | ||
/> | ||
) | ||
return <SynapsePlot widgetparamsMapped={props} /> | ||
} |
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
26 changes: 26 additions & 0 deletions
26
packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.tsx
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { useMemo } from 'react' | ||
import { SynapsePlot } from '../Plot' | ||
import { useQueryContext } from '../QueryContext' | ||
import { SynapsePlotWidgetParams } from '../Plot/SynapsePlot' | ||
import { QueryFilter } from '@sage-bionetworks/synapse-types' | ||
|
||
export type QueryWrapperSynapsePlotProps = Omit< | ||
SynapsePlotWidgetParams, | ||
'additionalFilters' | ||
> | ||
|
||
export default function QueryWrapperSynapsePlot( | ||
props: QueryWrapperSynapsePlotProps, | ||
) { | ||
const { currentQueryRequest } = useQueryContext() | ||
|
||
const widgetParamsMapped: SynapsePlotWidgetParams = useMemo(() => { | ||
const { additionalFilters } = currentQueryRequest.query | ||
return { | ||
...props, | ||
additionalFilters: additionalFilters as QueryFilter[], | ||
} | ||
}, [currentQueryRequest, props]) | ||
|
||
return <SynapsePlot widgetparamsMapped={widgetParamsMapped} /> | ||
} |