Skip to content

Commit

Permalink
update StandaloneQueryWrapper to support a card or table configuratio…
Browse files Browse the repository at this point in the history
…n output. feeding it a QueryWrapperPlotNav config should show the appropriate rendering
  • Loading branch information
jay-hodgson committed Jan 10, 2025
1 parent 34975a7 commit cffeec2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
11 changes: 6 additions & 5 deletions apps/portals/cancercomplexity/src/pages/CCKPSearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import {
PortalSearchTabs,
} from '@sage-bionetworks/synapse-portal-framework/components/PortalSearch/PortalSearchTabs'
import { PortalFullTextSearchField } from '@sage-bionetworks/synapse-portal-framework/components/PortalSearch/PortalFullTextSearchField'

import { SearchParamAwareStandaloneQueryWrapper } from '@sage-bionetworks/synapse-portal-framework/components/PortalSearch/SearchParamAwareStandaloneQueryWrapper'
import { Box } from '@mui/material'
import RedirectWithQuery from '@sage-bionetworks/synapse-portal-framework/components/RedirectWithQuery'
import { useGetPortalComponentSearchParams } from '@sage-bionetworks/synapse-portal-framework/utils/UseGetPortalComponentSearchParams'
import { Outlet, RouteObject } from 'react-router-dom'
import { grantQueryWrapperPlotNavProps } from 'src/config/synapseConfigs/grants'
import { QueryWrapperPlotNav } from 'synapse-react-client'
export const searchPageTabs: PortalSearchTabConfig[] = [
{
title: 'Grants',
Expand All @@ -25,13 +23,16 @@ export const searchPageChildRoutes: RouteObject[] = [
},
{
path: searchPageTabs[0].path,
element: <QueryWrapperPlotNav {...grantQueryWrapperPlotNavProps} />,
element: (
<SearchParamAwareStandaloneQueryWrapper
{...grantQueryWrapperPlotNavProps}
/>
),
},
]

export function CCKPSearchPage(props: React.PropsWithChildren) {
const { children } = props
const searchParams = useGetPortalComponentSearchParams()
// on search field value update, update the special search parameter FTS_SEARCH_TERM, which the QueryWrapperPlotNav will load as the search term
return (
<Box sx={{ p: { xs: '10px', lg: '50px' } }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { QueryWrapper, QueryWrapperProps } from '../QueryWrapper/QueryWrapper'
import {
Operator,
QueryWrapperPlotNavProps,
SearchParams,
} from '../QueryWrapperPlotNav/QueryWrapperPlotNav'
import { RowSetView } from '../QueryWrapperPlotNav/RowSetView'
Expand Down Expand Up @@ -51,7 +52,8 @@ type StandaloneQueryWrapperOwnProps = {
Pick<
QueryWrapperProps,
'fileIdColumnName' | 'fileNameColumnName' | 'fileVersionColumnName'
>
> &
Pick<QueryWrapperPlotNavProps, 'cardConfiguration' | 'tableConfiguration'>

export type StandaloneQueryWrapperProps = SynapseTableConfiguration &
SearchParams &
Expand Down Expand Up @@ -100,6 +102,8 @@ function StandaloneQueryWrapper(props: StandaloneQueryWrapperProps) {
noContentPlaceholderType = showTopLevelControls
? NoContentPlaceholderType.INTERACTIVE
: NoContentPlaceholderType.STATIC,
cardConfiguration,
tableConfiguration,
...rest
} = props

Expand Down Expand Up @@ -184,12 +188,19 @@ function StandaloneQueryWrapper(props: StandaloneQueryWrapperProps) {
{showTopLevelControls && (
<TotalQueryResults frontText={''} />
)}

<RowSetView
tableConfiguration={{
showAccessColumn: showAccessColumn,
hideAddToDownloadListColumn,
...rest,
}}
tableConfiguration={
cardConfiguration
? undefined
: {
...tableConfiguration, // if exist, use tableConfiguration property
showAccessColumn: showAccessColumn,
hideAddToDownloadListColumn,
...rest,
}
}
cardConfiguration={cardConfiguration} // if exist, use the cardConfiguration property
/>
</>
)
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cffeec2

Please sign in to comment.