Skip to content

Commit cf1a51e

Browse files
authored
Merge pull request #1588 from ASU/app-webdir-short-bio-fix
fix(app-webdir-ui): fix short bio not appearing in web directory
2 parents fe9cba8 + 78bd800 commit cf1a51e

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

packages/app-webdir-ui/src/ProfileCard/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ import { profileCardType } from "./models";
3030
*/
3131

3232
const ProfileCard = ({ ...props }) => {
33-
const hasSocialsOrWebsite =
33+
const hasSocialsOrWebsiteOrShortBio =
3434
props.facebookLink ||
3535
props.linkedinLink ||
3636
props.twitterLink ||
37-
props.website;
37+
props.website ||
38+
props.shortBio;
3839
const title = props.matchedAffiliationTitle
3940
? `${props.matchedAffiliationTitle}`
4041
: "";
@@ -136,7 +137,7 @@ const ProfileCard = ({ ...props }) => {
136137
)}
137138
</ul>
138139
)}
139-
{["default", "large"].includes(props.size) && hasSocialsOrWebsite && (
140+
{["default", "large"].includes(props.size) && hasSocialsOrWebsiteOrShortBio && (
140141
<div className="description-and-social">
141142
<p className="person-description">
142143
{props.shortBio?.slice(0, 250)}

packages/app-webdir-ui/src/WebDirectoryComponent/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @ts-check
2-
/* eslint no-use-before-define: 0 */
32
import PropTypes from "prop-types";
43
import React, { useState, useEffect } from "react";
54

@@ -24,7 +23,7 @@ import { WebDirLayout, FacultyRankLayout } from "./index.styles";
2423
* @param {string} props.searchApiVersion - The version of the search API to use.
2524
* @param {string} props.profileURLBase - The base URL for profile links.
2625
* @param {string} props.appPathFolder - The base path for the application folder.
27-
* @param {object} props.display - Display options for the search results.
26+
* @param {Record<string, any>} props.display - Display options for the search results.
2827
* @param {Object} props.filters - Filters for the search.
2928
* @param {string} props.alphaFilter - Indicates whether to enable alpha filtering.
3029
* @returns {JSX.Element} The WebDirectory component.
@@ -45,7 +44,7 @@ function WebDirectory({
4544
const [sort, setSort] = useState(defaultSortSetter);
4645
const [requestFilters, setRequestFilters] = useState(doSearch);
4746
const [gridView, setGridView] = useState(
48-
display.grid === "true" || display.grid === true
47+
display?.grid === "true" || display?.grid === true
4948
);
5049
const RES_PER_PAGE = 6;
5150

@@ -65,6 +64,7 @@ function WebDirectory({
6564

6665
// Initializer functions for requestFilters and sort. Only runs on first render.
6766
function doSearch() {
67+
/** @type {Record<string, any>} */
6868
const tempFilters = filters ? { ...filters } : {};
6969
if (searchType === "departments" || searchType === "faculty_rank") {
7070
tempFilters["deptIds"] = deptIds.split(",");
@@ -96,7 +96,11 @@ function WebDirectory({
9696
return "last_name_asc"; // defaults to last_name_asc if no default sort is set in CMS
9797
}
9898

99-
// Function returns an array of custom sort options based on the webDirSearchType and departmentIds parameters.
99+
/**
100+
* Function returns an array of custom sort options based on the webDirSearchType and departmentIds parameters.
101+
* @param {string} webDirSearchType
102+
* @param {string} departmentIds
103+
*/
100104
function sortOptionsFunc(webDirSearchType, departmentIds) {
101105
if (
102106
webDirSearchType === "departments" &&
@@ -139,7 +143,7 @@ function WebDirectory({
139143
...engineParams,
140144
},
141145
[engineNames.WEB_DIRECTORY_FACULTY_RANK]: {
142-
...engines[engineNames.WEB_DIRECTORY_FACULTY__RANK],
146+
...engines[engineNames.WEB_DIRECTORY_FACULTY_RANK],
143147
...engineParams,
144148
deptIds,
145149
display,

0 commit comments

Comments
 (0)