Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Unipisa/dm-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
paolini committed Nov 12, 2024
2 parents 14aa701 + 7544f3b commit f4dba3f
Show file tree
Hide file tree
Showing 13 changed files with 507 additions and 16 deletions.
483 changes: 481 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"react-router-dom": "^6.3.0",
"react-to-print": "^2.14.7",
"rehype-katex": "^7.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"resolve": "^1.20.0",
"resolve-url-loader": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/processes/visits.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ async function notifyVisit(visit_id, message) {
let text = message || ''

text +=`
Entrata su DM Manager: ${config.BASE_URL}/process/visits/${visit_id}
Link visita su DM Manager: ${config.BASE_URL}/process/visits/${visit_id}
${visit.referencePeople.map(p => `Referente: ${p.firstName} ${p.lastName} <${p.email}>`).join('\n')}
Visitatore/trice: ${person.firstName} ${person.lastName}
Affiliazione/i: ${affiliations}
Expand Down
8 changes: 5 additions & 3 deletions server/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ async function notificaTBA() {

if (visits.length > 0) {
const visitsList = visits.map(visit => {
const daysUntilVisit = Math.round((visit.startDate - today) / (1000 * 60 * 60 * 24))
const daysUntilVisit = Math.floor((visit.startDate - today) / (1000 * 60 * 60 * 24))

let text = daysUntilVisit === 1
? `Visita tra ${daysUntilVisit} giorno:\n`
Expand All @@ -408,6 +408,7 @@ async function notificaTBA() {
`${ref.firstName} ${ref.lastName} (${ref.email || 'no email'})`
).join(", ")
text += `Referenti: ${references}\n`
text += `Link visita su DM Manager: ${config.BASE_URL}/process/visits/${visit._id}\n`

return text
}).join("\n\n")
Expand All @@ -423,8 +424,8 @@ ${visitsList}\n\n`
const daysUntilSeminar = Math.round((seminar.startDatetime - today) / (1000 * 60 * 60 * 24))

let text = daysUntilSeminar === 1
? `Seminario tra ${daysUntilSeminar} giorno:\n`
: `Seminario tra ${daysUntilSeminar} giorni:\n`;
? `Seminario tra ${daysUntilSeminar} giorno\n`
: `Seminario tra ${daysUntilSeminar} giorni\n`;

const speakers = seminar.speakers.map(speaker => {
const affiliation = speaker.affiliations.map(a => a.name).join(", ")
Expand All @@ -438,6 +439,7 @@ ${visitsList}\n\n`
`${org.firstName} ${org.lastName} (${org.email || 'no email'})`
).join(", ")
text += `Organizzatori: ${organizers}\n`
text += `Link seminario su DM Manager: ${config.BASE_URL}/process/seminars/add/${seminar._id}\n`

return text
}).join("\n\n")
Expand Down
3 changes: 2 additions & 1 deletion src/processes/Conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useQuery, useQueryClient } from 'react-query'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import 'katex/dist/katex.min.css'

import { ConferenceRoomInput, GrantInput, InputRow, DateInput, MultipleSelectInput, InstitutionInput, BooleanInput, StringInput, TextInput } from '../components/Input'
Expand Down Expand Up @@ -243,7 +244,7 @@ export function ConferenceDetailsBlock({ onCompleted, data, setData, change, act
<Card className="shadow" style={{maxWidth:"60em"}}>
<Card.Header>Anteprima descrizione</Card.Header>
<Card.Body>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{data.description}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{data.description}</Markdown>
</Card.Body>
</Card>
}
Expand Down
3 changes: 2 additions & 1 deletion src/processes/Seminar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useQuery, useQueryClient } from 'react-query'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import 'katex/dist/katex.min.css'

import {SelectPeopleBlock} from './SelectPeopleBlock'
Expand Down Expand Up @@ -246,7 +247,7 @@ export function SeminarDetailsBlock({ onCompleted, data, setData, change, active
<Card className="shadow" style={{maxWidth:"60em"}}>
<Card.Header>Anteprima abstract</Card.Header>
<Card.Body>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{data.abstract}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{data.abstract}</Markdown>
</Card.Body>
</Card>
}
Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/Conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Loading } from './Loading'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'

import { formatDateInterval } from '../utils'
import { useQuery } from 'react-query'
Expand Down Expand Up @@ -38,7 +39,7 @@ export function Conference({ id }) {

return <div>
<ConferenceTitle conference={data}></ConferenceTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>
{data.description}
</Markdown>
</div>
Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/ConferenceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Loading } from './Loading'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import { useQuery } from 'react-query'

export function ConferenceList({ from, to, grants, ssd, is_outreach, _sort, _limit }) {
Expand All @@ -31,7 +32,7 @@ export function ConferenceList({ from, to, grants, ssd, is_outreach, _sort, _lim
events_block.push(
<div key={e._id}>
<ConferenceTitle conference={e} href={link}></ConferenceTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{truncateText(e.description, 200)}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{truncateText(e.description, 200)}</Markdown>
<hr className="my-4"></hr>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/CourseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useQuery } from 'react-query'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import axios from 'axios'
import Accordion from './Accordion';
import { Loading } from './Loading'
Expand Down Expand Up @@ -102,7 +103,7 @@ export function CourseList({ from, to }) {
<p>From {formatDate(course.startDate, 'en-US')} to {formatDate(course.endDate, 'en-US')}</p>
{lessons}
<h5 className="wp-block-heading"><strong>Description:</strong></h5>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{course.description}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{course.description}</Markdown>
</Accordion>
);
});
Expand Down
5 changes: 3 additions & 2 deletions widgets/src/components/EventList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Loading } from './Loading'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import { useQuery } from 'react-query'

export function EventList({ from, to, grants, _limit }) {
Expand Down Expand Up @@ -58,7 +59,7 @@ export function EventList({ from, to, grants, _limit }) {
events_block.push(
<div key={e._id}>
<SeminarTitle seminar={e} href={link}></SeminarTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{truncateText(e.abstract, 200)}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{truncateText(e.abstract, 200)}</Markdown>
<hr className="my-4"></hr>
</div>
)
Expand All @@ -68,7 +69,7 @@ export function EventList({ from, to, grants, _limit }) {
events_block.push(
<div key={e._id}>
<ConferenceTitle conference={e} href={link}></ConferenceTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{truncateText(e.notes, 200)}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{truncateText(e.notes, 200)}</Markdown>
<hr className="my-4"></hr>
</div>
)
Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/HomeEventList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import axios from 'axios';
import Markdown from 'react-markdown';
import rehypeKatex from 'rehype-katex';
import remarkMath from 'remark-math';
import remarkGfm from 'remark-gfm';
import { Loading } from './Loading';
import {
formatDateInterval,
Expand Down Expand Up @@ -192,7 +193,7 @@ function EventBox({ event }) {
<div className="subtitle_style fas fa-map-marker-alt"> {event.conferenceRoom?.name || event.institution?.name}</div>
<div className={`subtitle_style ${event.type === 'seminar' ? 'fa fa-tags' : event.type === 'conference' ? 'fa fa-link' : ''}`}> {tags}</div>
<div className="excerpt_style">
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>
{truncateTextByWords(event.abstract ? event.abstract : event.description, 30)}
</Markdown>
</div>
Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/Seminar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Loading } from './Loading'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'

import { formatDate, formatTime, formatPersonName, getDMURL, getManageURL } from '../utils'
import { useQuery } from 'react-query'
Expand All @@ -30,7 +31,7 @@ export function Seminar({ id }) {

return <div>
<SeminarTitle seminar={data}></SeminarTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{data.abstract}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{data.abstract}</Markdown>
</div>
}

Expand Down
3 changes: 2 additions & 1 deletion widgets/src/components/SeminarList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Loading } from './Loading'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import { useQuery } from 'react-query'

export function SeminarList({ from, to, category, grant, _sort, _limit }) {
Expand All @@ -29,7 +30,7 @@ export function SeminarList({ from, to, category, grant, _sort, _limit }) {
events_block.push(
<div key={e._id}>
<SeminarTitle seminar={e} href={link}></SeminarTitle>
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{truncateText(e.abstract, 200)}</Markdown>
<Markdown remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]}>{truncateText(e.abstract, 200)}</Markdown>
<hr className="my-4"></hr>
</div>
);
Expand Down

0 comments on commit f4dba3f

Please sign in to comment.