-
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(public): SJIP-1104 Add page content
- Loading branch information
1 parent
b93360d
commit c5cd46e
Showing
10 changed files
with
367 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
18 changes: 18 additions & 0 deletions
18
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,18 @@ | ||
.pageContent { | ||
width: 100%; | ||
} | ||
.pageContent .tableWrapper { | ||
width: 100%; | ||
gap: 0 !important; | ||
} | ||
.pageContent .title { | ||
margin: 0; | ||
} | ||
.pageContent .label { | ||
margin-bottom: 8px; | ||
} | ||
.pageContent .inputContainer { | ||
display: flex; | ||
gap: 8px; | ||
margin-bottom: 8px; | ||
} |
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,86 @@ | ||
import { useEffect, 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 GridCard from '@ferlab/ui/core/view/v2/GridCard'; | ||
import { Input, Space, Typography } from 'antd'; | ||
import { getColumns, 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; | ||
|
||
const PageContent = () => { | ||
const [searchValue, setSearchValue] = useState(''); | ||
|
||
const { stats, isFetchingStats } = useGlobals(); | ||
const { studiesParticipants = [] } = stats || {}; | ||
|
||
const [filteredStudies, setFilteredStudies] = useState(studiesParticipants); | ||
|
||
useEffect(() => { | ||
setFilteredStudies(studiesParticipants); | ||
}, [studiesParticipants]); | ||
|
||
const searchPrescription = (value: any) => { | ||
if (value?.target?.value) { | ||
const searchValue = value.target.value; | ||
setSearchValue(searchValue); | ||
|
||
const filteredValues = studiesParticipants.filter((study) => | ||
study.study_name.toLowerCase().includes(searchValue.toLowerCase()), | ||
); | ||
setFilteredStudies(filteredValues); | ||
} else { | ||
setSearchValue(''); | ||
setFilteredStudies(studiesParticipants); | ||
} | ||
}; | ||
|
||
const defaultColumns = getColumns(); | ||
|
||
return ( | ||
<Space direction="vertical" size={16} className={styles.pageContent}> | ||
<Title className={styles.title} level={4}> | ||
{intl.get('screen.publicStudies.title')} | ||
</Title> | ||
|
||
<div> | ||
<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={{ | ||
hideItemsCount: true, | ||
}} | ||
size="small" | ||
dataSource={filteredStudies.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 { 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 /> | ||
</ScrollContent> | ||
</div> | ||
</PublicLayout> | ||
); | ||
}; | ||
|
||
export default PublicStudies; |
Oops, something went wrong.