-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(studies): SJIP-1104 add page content
- Loading branch information
GaelleA
committed
Dec 2, 2024
1 parent
b93360d
commit 55a2bb5
Showing
10 changed files
with
363 additions
and
20 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
20 changes: 20 additions & 0 deletions
20
src/views/PublicStudies/components/PageContent/index.module.css
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,20 @@ | ||
.pageContent { | ||
width: 100%; | ||
} | ||
.pageContent .tableWrapper { | ||
width: 100%; | ||
} | ||
.pageContent .title { | ||
margin: 0; | ||
} | ||
.pageContent .label { | ||
margin-bottom: 8px; | ||
} | ||
.pageContent .inputContainer { | ||
display: flex; | ||
gap: 8px; | ||
margin-bottom: 8px; | ||
} | ||
.pageContent .guidButton { | ||
height: auto; | ||
} |
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,80 @@ | ||
import { useState } from 'react'; | ||
import intl from 'react-intl-universal'; | ||
import ProLabel from '@ferlab/ui/core/components/ProLabel'; | ||
import ProTable from '@ferlab/ui/core/components/ProTable'; | ||
import { ProColumnType } from '@ferlab/ui/core/components/ProTable/types'; | ||
import GridCard from '@ferlab/ui/core/view/v2/GridCard'; | ||
import { Input, Space, Typography } from 'antd'; | ||
import { TABLE_ID } from 'views/PublicStudies/utils'; | ||
|
||
import { useGlobals } from 'store/global'; | ||
import { getProTableDictionary } from 'utils/translation'; | ||
|
||
import styles from './index.module.css'; | ||
|
||
const { Title } = Typography; | ||
|
||
type OwnProps = { | ||
defaultColumns: ProColumnType<any>[]; | ||
}; | ||
|
||
const PageContent = ({ defaultColumns = [] }: OwnProps) => { | ||
const [searchValue, setSearchValue] = useState(''); | ||
|
||
const { stats, isFetchingStats } = useGlobals(); | ||
const { studiesParticipants = [] } = stats || {}; | ||
|
||
const searchPrescription = (value: any) => { | ||
if (value?.target?.value) { | ||
setSearchValue(value.target.value); | ||
} else { | ||
setSearchValue(''); | ||
} | ||
}; | ||
|
||
return ( | ||
<Space direction="vertical" size={16} className={styles.pageContent}> | ||
<Title className={styles.title} level={4}> | ||
{intl.get('screen.publicStudies.title')} | ||
</Title> | ||
|
||
<div className={styles.patientContentHeader}> | ||
<ProLabel className={styles.label} title={intl.get('screen.publicStudies.search.title')} /> | ||
<div className={styles.inputContainer}> | ||
<Input | ||
allowClear | ||
onChange={searchPrescription} | ||
placeholder={intl.get('screen.publicStudies.search.placeholder')} | ||
size="large" | ||
value={searchValue} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<GridCard | ||
content={ | ||
<ProTable | ||
tableId={TABLE_ID} | ||
columns={defaultColumns} | ||
wrapperClassName={styles.tableWrapper} | ||
loading={isFetchingStats} | ||
showSorterTooltip={false} | ||
bordered | ||
headerConfig={{ | ||
itemCount: { | ||
pageIndex: 0, | ||
pageSize: 20, | ||
total: studiesParticipants.length, | ||
}, | ||
}} | ||
size="small" | ||
dataSource={studiesParticipants.map((i) => ({ ...i, key: i.study_code }))} | ||
dictionary={getProTableDictionary()} | ||
/> | ||
} | ||
/> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default PageContent; |
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,20 @@ | ||
.studiesPage { | ||
display: flex; | ||
} | ||
|
||
.scrollContent { | ||
width: 100%; | ||
padding: var(--default-page-content-padding); | ||
} | ||
|
||
.descriptionCell::after { | ||
content: ''; | ||
display: block; | ||
} | ||
|
||
.dbgapLink { | ||
margin-right: 8px; | ||
} | ||
.dbgapLink:last-child { | ||
margin-right: 0; | ||
} |
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,9 +1,31 @@ | ||
import { useEffect } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import ScrollContent from '@ferlab/ui/core/layout/ScrollContent'; | ||
import PageContent from 'views/PublicStudies/components/PageContent'; | ||
|
||
import PublicLayout from 'components/PublicLayout'; | ||
import { fetchStats } from 'store/global/thunks'; | ||
|
||
import { getColumns, SCROLL_WRAPPER_ID } from './utils'; | ||
|
||
import style from './index.module.css'; | ||
|
||
const PublicStudies = () => { | ||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
dispatch(fetchStats()); | ||
}, [dispatch]); | ||
|
||
const PublicStudies = () => ( | ||
<PublicLayout> | ||
<span></span> | ||
</PublicLayout> | ||
); | ||
return ( | ||
<PublicLayout> | ||
<div className={style.studiesPage}> | ||
<ScrollContent id={SCROLL_WRAPPER_ID} className={style.scrollContent}> | ||
<PageContent defaultColumns={getColumns()} /> | ||
</ScrollContent> | ||
</div> | ||
</PublicLayout> | ||
); | ||
}; | ||
|
||
export default PublicStudies; |
Oops, something went wrong.