Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard api #81

Merged
merged 18 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/people/person-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useTheme } from "@emotion/react";

export const PersonCard = ({ person, showTitle = false, anchorName }) => {
const theme = useTheme();

console.log(person)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

return (
<Card
elevation={0}
Expand Down Expand Up @@ -35,7 +35,7 @@ export const PersonCard = ({ person, showTitle = false, anchorName }) => {
width: 100,
},
}}
image={person.photoURL ? person.photoURL : avatar.src}
image={person.photoData ? `https://dashboard.sandy-web.ad.renci.org/api/webinfo/people/${person.personId}/photo` : avatar.src}
alt={`${person.firstName} ${person.lastName} photo`}
/>

Expand Down
9 changes: 5 additions & 4 deletions components/projectSpotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTheme } from '@mui/material/styles'
import { MarkdownLess } from './markdown'

export const ProjectCard = ({project}) => {
console.log(project)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

const styles = {
project: {
textAlign: 'center',
Expand Down Expand Up @@ -64,13 +65,13 @@ export const ProjectCard = ({project}) => {
return (
<Card sx={styles.project} key={project.slug}>
<CardActionArea component={Link} to={ `/projects/${ project.slug }` }>
<CardMedia component={'img'} src={ project.featuredImage } sx={styles.cardMedia} />
<CardMedia component={'img'} src={ project.featuredImage.length > 0 ? project.featuredImage[0].url : "https://radx-images.s3.amazonaws.com/hero_aerpaw_b67ec9b4f6.jpeg" } sx={styles.cardMedia} />
<Box sx={styles.textOverlay}>
<Typography variant='h6'>{project.shortTitle ? project.shortTitle : project.name}</Typography>
<Typography variant='h6'>{project.shortTitle ? project.shortTitle : project.webName}</Typography>
</Box>
</CardActionArea>
<CardContent sx={project.description ? styles.description : styles.noSnippet}>
<MarkdownLess paragraph >{ project.snippet }</MarkdownLess>
<CardContent sx={project.webDescription ? styles.description : styles.noSnippet}>
<MarkdownLess paragraph >{ project.webDescription }</MarkdownLess>
</CardContent>
<CardContent>
<Link to={ `/projects/${ project.slug }` } style={{textAlign: 'right'}}>Read More</Link>
Expand Down
53 changes: 53 additions & 0 deletions components/projects/search-bar.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this in a different branch? Is this supposed to be here again?

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,
};
7 changes: 7 additions & 0 deletions lib/dashboard/collaborations.js
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;
};
7 changes: 7 additions & 0 deletions lib/dashboard/organizations.js
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;
};
65 changes: 65 additions & 0 deletions lib/dashboard/people.js
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
:
"ashok@renci.org",
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
:
"asia@renci.org",
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};
};
7 changes: 7 additions & 0 deletions lib/dashboard/projects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { fetchFromDashboard } from "@/utils/dashboard";

export const fetchDashboardProjects = async () => {
const payload = await fetchFromDashboard("projects");

return payload;
};
7 changes: 7 additions & 0 deletions lib/dashboard/research-groups.js
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;
};
7 changes: 7 additions & 0 deletions lib/dashboard/teams.js
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;
};
Loading