diff --git a/package.json b/package.json
index 58642c1..7dd667a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "dm-manager",
- "version": "1.10.1",
+ "version": "1.10.2",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
diff --git a/widgets/src/components/CourseList.js b/widgets/src/components/CourseList.js
index 934c7bd..e16d1b6 100644
--- a/widgets/src/components/CourseList.js
+++ b/widgets/src/components/CourseList.js
@@ -113,10 +113,10 @@ export function CourseList({ from, to }) {
<>
The list of Ph.D. courses that will be taught during the academic year {fromYear}-{toYear} is below:
- Fall/Winter Term
+ Fall/Winter Term
{renderCourses(fallCourses)}
- Winter/Spring Term
+ Winter/Spring Term
{renderCourses(springCourses)}
>
);
diff --git a/widgets/src/components/Grant.js b/widgets/src/components/Grant.js
index 41356d2..7cc7d2f 100644
--- a/widgets/src/components/Grant.js
+++ b/widgets/src/components/Grant.js
@@ -47,7 +47,7 @@ export function Grant({ grant_id }) {
{data.budgetAmount && <>Budget: {data.budgetAmount}
>}
{data.webSite && <>Website: {data.webSite}>}
-
+
{data.pi && data.pi.firstName && <>
>}
{data.localCoordinator && data.localCoordinator.firstName && (data.localCoordinator._id !== data.pi._id) && }
diff --git a/widgets/src/components/HomeEventList.js b/widgets/src/components/HomeEventList.js
index bda601f..a974f67 100644
--- a/widgets/src/components/HomeEventList.js
+++ b/widgets/src/components/HomeEventList.js
@@ -29,7 +29,6 @@ export function HomeEventList({}) {
const conf = await axios.get(getManageURL("public/conferences"), { params: { _limit: numberOfEntries, _sort: "startDate", from: now} })
if (conf.data) {
for (const e of conf.data.data) {
- console.log(`Conference: ${e._id}`,e)
events[e._id] = {...e, type: 'conference'}
}
}
diff --git a/widgets/src/components/HomeGrantList.js b/widgets/src/components/HomeGrantList.js
new file mode 100644
index 0000000..70a6af5
--- /dev/null
+++ b/widgets/src/components/HomeGrantList.js
@@ -0,0 +1,79 @@
+import React, { useState } from 'react';
+import { Button } from 'react-bootstrap';
+import { useQuery } from 'react-query';
+import axios from 'axios';
+import { Loading } from './Loading';
+import {
+ formatDateInterval,
+ getManageURL,
+ getDMURL,
+ formatDate,
+ formatTime,
+ truncateTextByWords
+} from '../utils';
+import './styles.css';
+
+export function HomeGrantList({}) {
+ const [numberOfEntries, setNumberOfEntries] = useState(6);
+
+ const { isLoading, error, data } = useQuery([ 'homegrants', numberOfEntries ], async () => {
+ const now = new Date()
+ now.setHours(0, 0, 0, 0)
+
+ const grants = await axios.get(getManageURL("public/grants"), { params: { _limit: numberOfEntries, _sort: "-budgetAmount", from: now} })
+ if (grants.data) {
+ return grants.data.data
+ }
+ })
+
+ if (isLoading || error) {
+ return
+ }
+
+ const all_grant_list = data.slice(0, numberOfEntries).map((x) => (
+
+ ));
+
+ const showButton = numberOfEntries <= all_grant_list.length;
+
+ return (
+
+
{all_grant_list}
+ {showButton && (
+
+
+
+ )}
+
+ );
+}
+
+function GrantBox({ grant }) {
+ console.log(grant)
+ const date = grant.endDate
+ ? formatDateInterval(grant.startDate, grant.endDate, 'en-US')
+ : `${formatDate(grant.startDatetime)} - ${formatTime(grant.startDatetime)}`;
+
+ const link = getDMURL(`en/research/grant-details/?grant_id=${grant._id}`);
+
+ var title = grant.name
+
+ return
+
+ { grant.pi && grant.pi.firstName &&
+
Principal Investigator: {grant.pi.firstName} {grant.pi.lastName}
+ }
+ { grant.localCoordinator && grant.localCoordinator.firstName && (grant.localCoordinator._id !== grant.pi._id) &&
+
Local Coordinator: {grant.localCoordinator.firstName} {grant.localCoordinator.lastName}
+ }
+
{date}
+
{grant.budgetAmount}
+
+}
\ No newline at end of file
diff --git a/widgets/src/index.html b/widgets/src/index.html
index 7d73834..afb8496 100644
--- a/widgets/src/index.html
+++ b/widgets/src/index.html
@@ -71,6 +71,11 @@
data-target="#homeeventlist-tab" type="button" role="tab" aria-controls="homeeventlist"
aria-selected="false">HomeEventList
+
+ HomeGrantList
+
+
@@ -146,6 +152,9 @@
dmwidgets.loadComponent(document.getElementById('homeeventlist'), "HomeEventList", {
_limit: 10,
})
+ dmwidgets.loadComponent(document.getElementById('homegrantlist'), "HomeGrantList", {
+ _limit: 10,
+ })
dmwidgets.loadComponent(document.getElementById('persondetails'), "PersonDetails", {
person_id: '66471d4ef38d44852c3310e9',
})
diff --git a/widgets/src/index.js b/widgets/src/index.js
index e42b9d8..8c682b1 100644
--- a/widgets/src/index.js
+++ b/widgets/src/index.js
@@ -7,6 +7,7 @@ import { Conference } from './components/Conference'
import { ConferenceList } from './components/ConferenceList';
import { QueryClient, QueryClientProvider } from 'react-query'
import { HomeEventList } from './components/HomeEventList';
+import { HomeGrantList } from './components/HomeGrantList';
import { PersonDetails } from './components/PersonDetails';
import { CourseList } from './components/CourseList';
import { Grant } from './components/Grant';
@@ -47,6 +48,9 @@ dmwidgets.loadComponent = (target, name, props = {}) => {
case 'HomeEventList':
element =
break;
+ case 'HomeGrantList':
+ element =
+ break;
case 'PersonDetails':
element =
break;