Skip to content

Commit

Permalink
Merge pull request #152 from NASA-PDS/develop
Browse files Browse the repository at this point in the history
Merge `develop` to `main` to prep for release.
  • Loading branch information
anilnatha authored Jan 23, 2025
2 parents f033ba4 + 56590ad commit 55152c6
Show file tree
Hide file tree
Showing 13 changed files with 640 additions and 188 deletions.
40 changes: 20 additions & 20 deletions apps/frontend/package-lock.json

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

4 changes: 2 additions & 2 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pds-portal-frontend",
"private": true,
"version": "0.0.2",
"version": "0.0.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -18,7 +18,7 @@
"@fontsource/public-sans": "^5.0.18",
"@mui/icons-material": "^5.15.11",
"@mui/material": "^5.15.11",
"@nasapds/wds-react": "^0.0.3",
"@nasapds/wds-react": "^0.0.4",
"@reduxjs/toolkit": "^2.2.1",
"axios": "^1.6.7",
"classnames": "^2.5.1",
Expand Down
226 changes: 139 additions & 87 deletions apps/frontend/src/components/Filters/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type FilterProps = {
title: string;
options: FilterOptionProps[];
onChecked: (event: ChangeEvent<HTMLInputElement>) => void;
onCheckedRadio: (event: ChangeEvent<HTMLInputElement>) => void;
onCheckedRadio: (name: string, checked: boolean, value: string) => void;
collapseAll?: boolean;
variant: FilterVariant;
};
Expand Down Expand Up @@ -72,102 +72,154 @@ const Filter = ({
return isIncluded;
};

const isASingleSelected = (
possibleOptions: FilterOptionProps[],
filterVariant: FilterVariant
) => {
let isSingleAndSelected = false;
if (filterVariant === "single") {
possibleOptions.forEach((option) => {
if (option.value !== "all" && option.isChecked === true) {
isSingleAndSelected = true;
}
});
}

return isSingleAndSelected;
};

useEffect(() => {
setIsCollapsed(collapseAll);
}, [collapseAll]);

return (
<div>
<Box>
<Grid
container
spacing={2}
alignItems="center"
sx={{ paddingBottom: 0 }}
>
<Grid item xs={10}>
<Typography variant="h8" weight="semibold">
{displayTitle.toUpperCase()}
</Typography>
</Grid>
<Grid item xs={2} className="pds-search-filter-dropdown-button-grid">
<IconButton aria-label="star" onClick={handleCollapseClick}>
{isCollapsed ? <IconArrowCircleDown /> : <IconArrowCircleUp />}
</IconButton>
</Grid>
</Grid>
</Box>

{!isCollapsed ? (
<Grid
container
spacing={2}
alignItems="center"
sx={{ paddingBottom: 0 }}
>
<Grid item xs={12}>
<TextField
className="pds-filter-textfield"
id="subfilter"
value={subFilter}
variant="standard"
onChange={onSubFilterChange}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<IconSearch />
</InputAdornment>
),
}}
/>
</Grid>
</Grid>
) : (
<></>
)}

{!isCollapsed ? (
<Box className="pds-search-filter-checkbox-container">
{options.map((option) =>
titleIncludesSubFilter(option.title, subFilter) ? (
<Box
className="pds-search-filter-checkbox-box"
sx={{
cursor: "pointer",
display: "flex",
alignItems: "start",
}}
<>
{!isASingleSelected(options, variant) ? (
<div>
<Box>
<Grid
container
spacing={2}
alignItems="center"
sx={{ paddingBottom: 0 }}
>
<Grid item xs={10}>
<Typography variant="h8" weight="semibold">
{displayTitle.toUpperCase()}
</Typography>
</Grid>
<Grid
item
xs={2}
className="pds-search-filter-dropdown-button-grid"
>
<Checkbox
sx={{ padding: 0 }}
onChange={variant === "single" ? onCheckedRadio : onChecked}
name={option.value}
value={value}
checked={option.isChecked}
disabled={
option.isChecked && option.title === "all" ? true : false
}
<IconButton aria-label="star" onClick={handleCollapseClick}>
{isCollapsed ? (
<IconArrowCircleDown />
) : (
<IconArrowCircleUp />
)}
</IconButton>
</Grid>
</Grid>
</Box>
{!isCollapsed ? (
<Grid
container
spacing={2}
alignItems="center"
sx={{ paddingBottom: 0 }}
>
<Grid item xs={12}>
<TextField
className="pds-filter-textfield"
id="subfilter"
value={subFilter}
variant="standard"
onChange={onSubFilterChange}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<IconSearch />
</InputAdornment>
),
}}
/>
<Typography variant="h6" weight="regular">
{option.title.toUpperCase()}

<span className="pds-search-filter-count-span">
{option.title === "all"
? ""
: " (" + option.resultsFound + ")"}
</span>
</Typography>
</Box>
) : (
<></>
)
</Grid>
</Grid>
) : (
<></>
)}
</Box>
{!isCollapsed ? (
<Box className="pds-search-filter-checkbox-container">
{options.map((option) =>
titleIncludesSubFilter(option.title, subFilter) ? (
<Box
className="pds-search-filter-checkbox-box"
sx={{
cursor: "pointer",
display: "flex",
alignItems: "start",
}}
>
{variant !== "single" ? (
<>
<Checkbox
sx={{ padding: 0 }}
onChange={onChecked}
name={option.value}
value={value}
checked={option.isChecked}
disabled={option.isChecked && option.title === "all"}
/>
<Typography variant="h6" weight="regular">
{option.title.toUpperCase()}

<span className="pds-search-filter-count-span">
{option.title === "all"
? ""
: " (" + option.resultsFound + ")"}
</span>
</Typography>
</>
) : (
<div>
<Typography
variant="h6"
weight="regular"
onClick={() =>
onCheckedRadio(
option.value,
!option.isChecked,
value
)
}
>
{option.title.toUpperCase()}

<span className="pds-search-filter-count-span">
{option.title === "all"
? ""
: " (" + option.resultsFound + ")"}
</span>
</Typography>
</div>
)}
</Box>
) : (
<></>
)
)}
</Box>
) : (
""
)}
<Divider />
</div>
) : (
""
<></>
)}
<Divider />
</div>
</>
);
};

Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/components/Filters/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Chip, Typography } from "@nasapds/wds-react";
export type FiltersProps = {
filters: FilterProps[];
onChecked: (event: ChangeEvent<HTMLInputElement>) => void;
onCheckedRadio: (event: ChangeEvent<HTMLInputElement>) => void;
onCheckedRadio: (name: string, checked: boolean, value: string) => void;
onFilterChipDelete: (value: string, parentValue: string) => void;
onFilterClear: () => void;
collapseAll?: boolean;
Expand Down Expand Up @@ -41,7 +41,7 @@ const Filters = ({
filter.options.forEach((option) => {
if (option.value !== "all" && option.isChecked) {
const optionProps = {
title: option.title,
title: filter.displayTitle + " : " + option.title,
value: option.value,
resultsFound: option.resultsFound,
isChecked: option.isChecked,
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FooterLink, Footer } from "@nasapds/wds-react";

function PortalFooter() {

const pageLastUpdated="Nov. 14, 2024"
const pageLastUpdated="Jan. 23, 2025"

const primaryLinks:FooterLink[] = [
{
Expand Down
9 changes: 6 additions & 3 deletions apps/frontend/src/components/HomeSearch/HomeSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import {
mapFilterIdsToName,
mapPageType,
formatIdentifierNameResults,
} from "../../pages/search/searchUtils";
import MenuItem from "@mui/material/MenuItem";
import FormControl from "@mui/material/FormControl";
Expand Down Expand Up @@ -588,11 +589,13 @@ export const HomeSearch = () => {
}

const investigationNames: IdentifierNameDoc[] =
investigationsData.response.docs;
formatIdentifierNameResults(investigationsData).response
.docs;
const instrumentNames: IdentifierNameDoc[] =
instrumentsData.response.docs;
formatIdentifierNameResults(instrumentsData).response
.docs;
const targetNames: IdentifierNameDoc[] =
targetsData.response.docs;
formatIdentifierNameResults(targetsData).response.docs;

const investigationFilterOptions = mapFilterIdsToName(
investigationFilterIds,
Expand Down
Loading

0 comments on commit 55152c6

Please sign in to comment.