-
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.
fix: Searching by bib citation fixed. Model repository updated. Model…
…sPage refactoring.
- Loading branch information
Matěj Zábojník
committed
Nov 7, 2023
1 parent
69875bd
commit 2cbd045
Showing
31 changed files
with
540 additions
and
310 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
File renamed without changes.
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,20 +1,5 @@ | ||
import client from "./repositories/client"; | ||
import {seed} from "./seed"; | ||
|
||
const getAll = async () => { | ||
try { | ||
return await client.model.findMany() | ||
} catch (e) { | ||
console.error('Error fetching validationModels!'); | ||
throw e; | ||
} finally { | ||
await client.$disconnect(); | ||
} | ||
} | ||
|
||
getAll() | ||
.then((models) => { | ||
console.log("All validationModels:", models) | ||
}) | ||
.catch((_) => { | ||
console.error("Error!") | ||
}); | ||
seed() | ||
.then((_) => console.log('success')) | ||
.catch((_) => console.error('error')) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
import React from "react"; | ||
import {FilterBarProps} from "../types/data"; | ||
import {Button, IconButton, MenuItem, Select, TextField} from "@mui/material"; | ||
import SearchOutlinedIcon from "@mui/icons-material/SearchOutlined"; | ||
import SouthOutlinedIcon from "@mui/icons-material/SouthOutlined"; | ||
import ClearIcon from "@mui/icons-material/Clear"; | ||
import ExpandMoreOutlinedIcon from "@mui/icons-material/ExpandMoreOutlined"; | ||
|
||
const FilterBar: React.FC<FilterBarProps> = ({ | ||
searchNameQuery, | ||
setSearchNameQuery, | ||
searchBibJournalQuery, | ||
setSearchBibJournalQuery, | ||
searchBibYearQuery, | ||
setSearchBibYearQuery, | ||
sortBy, | ||
setSortBy, | ||
filterChanged, | ||
setFilterChanged, | ||
sortOrder, | ||
uniqueKeywords, | ||
countModelsForKeyword, | ||
selectedKeywords, | ||
handleKeywordChange, | ||
toggleSortOrder, | ||
showAdvancedFilters, | ||
toggleAdvancedFilters, | ||
handleResetFilters}) => { | ||
return ( | ||
<div className="filter_bar_container"> | ||
<div className="filter_bar"> | ||
<div className="basic_filter"> | ||
<div className="basicFilter_items"> | ||
<TextField | ||
label="Search" | ||
variant="outlined" | ||
value={searchNameQuery} | ||
onChange={(e) => { | ||
setSearchNameQuery(e.target.value); | ||
setFilterChanged(true) | ||
}} | ||
InputProps={{ | ||
endAdornment: ( | ||
<IconButton> | ||
<SearchOutlinedIcon /> | ||
</IconButton> | ||
), | ||
}} | ||
sx={{ | ||
'@media only screen and (max-width: 767px)': { | ||
marginBottom: '1rem', | ||
} | ||
}} | ||
/> | ||
<div className="sortBy_container"> | ||
<span className="sortBy_label"><b>Sort by</b></span> | ||
<div className="sortBy_items"> | ||
<Select | ||
className="sortBy_select" | ||
style={{ marginLeft: '.8rem'}} | ||
value={sortBy} | ||
onChange={(e) => { | ||
setSortBy(e.target.value); | ||
setFilterChanged(true) | ||
}} | ||
> | ||
<MenuItem value="name">Name</MenuItem> | ||
<MenuItem value="inputs">Inputs count</MenuItem> | ||
<MenuItem value="variables">Variables count</MenuItem> | ||
<MenuItem value="regulations">Regulations count</MenuItem> | ||
</Select> | ||
<IconButton | ||
onClick={toggleSortOrder} | ||
style={{ | ||
transition: 'transform 0.3s ease', // Add a transition for smooth rotation | ||
transform: `rotate(${sortOrder === 'desc' ? '0deg' : '180deg'})`, // Rotate the icon | ||
marginLeft: '.7rem', | ||
outline: 'none' | ||
}}> | ||
<SouthOutlinedIcon /> | ||
</IconButton> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="buttons"> | ||
<Button | ||
style={{ | ||
outline: 'none', | ||
padding: '.2rem 1rem', | ||
margin: '.2rem', | ||
backgroundColor: '#3a568c' | ||
}} | ||
variant="contained" | ||
endIcon={<ClearIcon />} | ||
onClick={handleResetFilters} | ||
disabled={!filterChanged}> | ||
Reset Filters | ||
</Button> | ||
<Button | ||
style={{ | ||
outline: 'none', | ||
padding: '.2rem 1rem', | ||
margin: '.2rem', | ||
backgroundColor: '#3a568c' | ||
}} | ||
variant="contained" | ||
endIcon={<ExpandMoreOutlinedIcon | ||
style={{ | ||
transition: 'transform 0.3s ease', | ||
transform: `rotate(${!showAdvancedFilters ? '0deg' : '180deg'})` }} | ||
/>} | ||
onClick={toggleAdvancedFilters}> | ||
Advanced Filter | ||
</Button> | ||
</div> | ||
</div> | ||
{showAdvancedFilters && ( | ||
<div className="advanced_filter"> | ||
<div className="advancedFilter_keywords" style={{width: '-webkit-fill-available'}}> | ||
<p className="keywords_label"><b>Keywords:</b></p> | ||
<div className="keywords"><br/> | ||
{uniqueKeywords.map((keyword) => ( | ||
<label key={keyword}> | ||
{countModelsForKeyword(keyword) === 0 ? ( | ||
<input | ||
type="checkbox" | ||
value={keyword} | ||
checked={false} | ||
disabled | ||
className="disabled_checkbox" | ||
/> | ||
) : ( | ||
<input | ||
type="checkbox" | ||
value={keyword} | ||
checked={selectedKeywords.includes(keyword)} | ||
onChange={() => handleKeywordChange(keyword)} | ||
/> | ||
)} | ||
{keyword} [{countModelsForKeyword(keyword)}] | ||
</label> | ||
))} | ||
</div> | ||
</div> | ||
<div className="advancedFilter_searchBars"> | ||
<TextField | ||
sx={{ | ||
marginTop: '2rem', | ||
marginLeft: '2rem', | ||
'@media only screen and (max-width: 767px)': { | ||
margin: '1rem 0 0 0' | ||
} | ||
}} | ||
label="Search Publication" | ||
variant="outlined" | ||
value={searchBibJournalQuery} | ||
onChange={(e) => { | ||
setSearchBibJournalQuery(e.target.value); | ||
setFilterChanged(true); | ||
}} | ||
InputProps={{ | ||
endAdornment: ( | ||
<IconButton> | ||
<SearchOutlinedIcon /> | ||
</IconButton> | ||
), | ||
}} | ||
/> | ||
<TextField | ||
sx={{ | ||
marginTop: '2rem', | ||
marginLeft: '2rem', | ||
'@media only screen and (max-width: 767px)': { | ||
margin: '1rem 0 0 0' | ||
} | ||
}} | ||
label="Search Year" | ||
variant="outlined" | ||
value={searchBibYearQuery} | ||
onChange={(e) => { | ||
setSearchBibYearQuery(e.target.value); | ||
setFilterChanged(true); | ||
}} | ||
InputProps={{ | ||
endAdornment: ( | ||
<IconButton> | ||
<SearchOutlinedIcon /> | ||
</IconButton> | ||
), | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FilterBar; |
Oops, something went wrong.