-
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.
Merge pull request #81 from mbwatson/dashboard-api
Dashboard api
- Loading branch information
Showing
19 changed files
with
305 additions
and
5,578 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { styled } from "@mui/material"; | ||
import TextField from "@mui/material/TextField"; | ||
import FormControl from "@mui/material/FormControl"; | ||
import FormLabel from "@mui/material/FormLabel"; | ||
|
||
const StyledAutocompleteSearch = styled("div")( | ||
({ theme, bottomBorderRadius = true }) => ` | ||
display: flex; | ||
border-radius: inherit; | ||
border-bottom-left-radius: ${bottomBorderRadius ? "inherit" : 0}; | ||
border-bottom-right-radius: ${bottomBorderRadius ? "inherit" : 0}; | ||
&.focused { | ||
border-color: ${theme.palette.primary.main}90; | ||
box-shadow: 0 0 0 3px ${theme.palette.primary.main}a0; | ||
} | ||
&:focus-visible { | ||
outline: 0; | ||
} | ||
` | ||
); | ||
|
||
export const SearchBar = ({ setSearchQuery, options }) => { | ||
return ( | ||
<FormControl | ||
style={{ | ||
width: "100%", | ||
}} | ||
> | ||
<FormLabel>Project Search</FormLabel> | ||
<StyledAutocompleteSearch> | ||
<TextField | ||
style={{ | ||
width: "100%", | ||
}} | ||
id="search-bar" | ||
onInput={(e) => { | ||
setSearchQuery(e.target.value.toLowerCase()); | ||
}} | ||
placeholder="Search..." | ||
/> | ||
</StyledAutocompleteSearch> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
SearchBar.propTypes = { | ||
setSearchQuery: PropTypes.func.isRequired, | ||
options: PropTypes.array.isRequired, | ||
}; |
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,7 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchDashboardCollaborations = async () => { | ||
const payload = await fetchFromDashboard("collaborations"); | ||
|
||
return payload; | ||
}; |
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,7 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchOrganizations = async () => { | ||
const payload = await fetchFromDashboard("organizations"); | ||
|
||
return payload; | ||
}; |
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,65 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchDashboardPeople = async () => { | ||
const payload = await fetchFromDashboard("people"); | ||
|
||
let ood = [{ | ||
active: true, | ||
: | ||
"[email protected]", | ||
firstName | ||
: | ||
"Ashok", | ||
fullName | ||
: | ||
"Ashok Krishnamurthy", | ||
lastName | ||
: | ||
"Krishnamurthy", | ||
photoData | ||
: | ||
"https://radx-images.s3.amazonaws.com/ashok_krishnamurthy_83f4cde9ac.jpeg", | ||
pid | ||
: | ||
"720441075", | ||
personId: "_5SMp4qd1tUKnpfA_niwgnQ", | ||
slug | ||
: | ||
"ashok-krishnamurthy", | ||
title | ||
: | ||
"Interim Director of RENCI" | ||
}, { | ||
active | ||
: | ||
true, | ||
: | ||
"[email protected]", | ||
firstName | ||
: | ||
"Asia", | ||
fullName | ||
: | ||
"Asia Mieczkowska", | ||
lastName | ||
: | ||
"Mieczkowska", | ||
photoData | ||
: | ||
"https://radx-images.s3.amazonaws.com/mieczkowska_asia_c5aaf7ad4f.png", | ||
pid | ||
: | ||
"708744185", | ||
personId: "_0KDiHdVaskGZmHbyoVs4Yg", | ||
slug | ||
: | ||
"asia-mieczkowska", | ||
title | ||
: | ||
"Interim Chief Operations Officer" | ||
}] | ||
|
||
return {ood: ood, people: payload}; | ||
}; |
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,30 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchDashboardProjects = async () => { | ||
const allProjects = await fetchFromDashboard("projects"); | ||
|
||
const getPayload = (array) => { | ||
const trimText = (description, wordCount = 25) => { | ||
//split the description into an array of words | ||
const snippetArray = (description).split(' ') | ||
|
||
//grab the first X number of words as defined by the wordCount above | ||
const trimmedSnippetArray = snippetArray.slice(0, wordCount) | ||
|
||
//if the number of words in the description is longer than the wordcount, return a string that has an ellipsis at the end. if not, return a string that just joins the words from the trimmed array | ||
return snippetArray.length >= wordCount ? `${trimmedSnippetArray.join(' ')} ...` : trimmedSnippetArray.join(' ') | ||
} | ||
|
||
return array.map((project) => ( | ||
{ | ||
snippet: project.webDescription ? trimText(project.webDescription) : "Click to read more", | ||
... project | ||
} | ||
)) | ||
} | ||
|
||
const payload = getPayload(allProjects) | ||
|
||
|
||
return payload; | ||
}; |
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,7 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchResearchGroups = async () => { | ||
const payload = await fetchFromDashboard("research-groups"); | ||
|
||
return payload; | ||
}; |
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,7 @@ | ||
import { fetchFromDashboard } from "@/utils/dashboard"; | ||
|
||
export const fetchDashboardTeams = async () => { | ||
const payload = await fetchFromDashboard("teams"); | ||
|
||
return payload; | ||
}; |
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
Oops, something went wrong.