From db9356350ca530e7e4d03e75e13433a3208fa46f Mon Sep 17 00:00:00 2001 From: Andre-Diamond <32074058+Andre-Diamond@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:16:29 +0200 Subject: [PATCH 1/3] Turn links added to meetingInfo into clickable links in GitBook and Discord - [Date: 2024-02-13] Fixes #63 --- components/ArchiveSummaries.tsx | 1 + pages/submit-meeting-summary/index.tsx | 3 ++- utils/generateMarkdown.js | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/ArchiveSummaries.tsx b/components/ArchiveSummaries.tsx index a53c0c3..f9b97b9 100644 --- a/components/ArchiveSummaries.tsx +++ b/components/ArchiveSummaries.tsx @@ -22,6 +22,7 @@ const ArchiveSummaries = () => { useEffect(() => { setRenderedMarkdown(formData.meetingSummary); + console.log(formData.meetingSummary) }, [formData.meetingSummary]); useEffect(() => { diff --git a/pages/submit-meeting-summary/index.tsx b/pages/submit-meeting-summary/index.tsx index af9b8da..9549b31 100644 --- a/pages/submit-meeting-summary/index.tsx +++ b/pages/submit-meeting-summary/index.tsx @@ -268,9 +268,10 @@ useEffect(() => { title="Defaults to latest meeting, only change this when you want to use a previous meeting as template"> {meetings.map((meeting: any) => ( ))} diff --git a/utils/generateMarkdown.js b/utils/generateMarkdown.js index 1c1742e..1f7335d 100644 --- a/utils/generateMarkdown.js +++ b/utils/generateMarkdown.js @@ -42,11 +42,11 @@ export function generateMarkdown(summary, order) { } if (purpose) markdown += `- Purpose: ${purpose}\n`; if (townHallNumber) markdown += `- Town Hall Number: ${townHallNumber}\n`; //townHallNumber - if (meetingVideoLink) markdown += `- Meeting video: ${meetingVideoLink}\n`; - if (mediaLink) markdown += `- Media link: ${mediaLink}\n`; - if (miroBoardLink) markdown += `- Miro board: ${miroBoardLink}\n`; - if (transcriptLink) markdown += `- Transcript: ${transcriptLink}\n`; - if (otherMediaLink) markdown += `- Other media: ${otherMediaLink}\n`; + if (meetingVideoLink) markdown += `- Meeting video: [Link](${meetingVideoLink})\n`; + if (mediaLink) markdown += `- Media link: [Link](${mediaLink})\n`; + if (miroBoardLink) markdown += `- Miro board: [Link](${miroBoardLink})\n`; + if (transcriptLink) markdown += `- Transcript: [Link](${transcriptLink})\n`; + if (otherMediaLink) markdown += `- Other media: [Link](${otherMediaLink})\n`; //markdown += '\n'; // Process workingDocs From 45740045f06f8940982b54439d55df35192bf972 Mon Sep 17 00:00:00 2001 From: Andre-Diamond <32074058+Andre-Diamond@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:42:30 +0200 Subject: [PATCH 2/3] Discord Date Formats - [Date: 2024-02-13] Fixes #62 --- utils/sendDiscordMessage.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/sendDiscordMessage.js b/utils/sendDiscordMessage.js index 9804eb4..ae929d5 100644 --- a/utils/sendDiscordMessage.js +++ b/utils/sendDiscordMessage.js @@ -154,10 +154,13 @@ export async function sendDiscordMessage(myVariable, markdown) { const workgroup = myVariable.summary.workgroup; const username = myVariable.summary.meetingInfo.documenter; const archivist = myVariable.currentUser; - const date = myVariable.summary.meetingInfo.date; - + const dateObj = new Date(myVariable.summary.meetingInfo.date); + // Format the date to "24 January 2024" format + const formattedDate = dateObj.toLocaleDateString('en-GB', { + day: 'numeric', month: 'long', year: 'numeric' + }); // Use the new function to create embeds - const title = `${workgroup} -> ${date} meeting summary`; + const title = `${workgroup} -> ${formattedDate} meeting summary`; const footerText = `Summary created by ${username} and archived by ${archivist}`; const embeds = createDiscordEmbeds(markdown, title, footerText); From 43152ccd8cca5a84ee24ef998a7b0b0ef55ed9db Mon Sep 17 00:00:00 2001 From: Andre-Diamond <32074058+Andre-Diamond@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:51:07 +0200 Subject: [PATCH 3/3] Town Hall Template updates --- components/SummaryAgendaItems.tsx | 2 +- components/SummaryMeetingInfo.tsx | 4 +- components/SummaryTemplate.tsx | 12 ++++ components/TimestampedVideo.tsx | 93 +++++++++---------------------- utils/generateMarkdown.js | 56 ++++++++++--------- 5 files changed, 71 insertions(+), 96 deletions(-) diff --git a/components/SummaryAgendaItems.tsx b/components/SummaryAgendaItems.tsx index 8cdafd0..15cc76f 100644 --- a/components/SummaryAgendaItems.tsx +++ b/components/SummaryAgendaItems.tsx @@ -250,7 +250,7 @@ const getHeading = (itemType: any, workgroup: any) => { isEnabled: (template: any) => template?.townHallSummary === 1, render: (item: any, agendaIndex: any) => ( <> -

Town Hall Summary

+

Town Hall Summary (Optional)

= ({ workgroup, onUp transcriptLink = '', mediaLink = '', workingDocs = [{ title: '', link: '' }], - timestampedVideo = { url: '', intro: '', timestamps: [{ title: '', timestamp: '' }] } + timestampedVideo = { url: '', intro: '', timestamps: '' } } = myVariable?.summary?.meetingInfo || {}; // Set the local meetingInfo state with the values from myVariable.summary.meetingInfo @@ -354,7 +354,7 @@ const SummaryMeetingInfo: React.FC = ({ workgroup, onUp )} {myVariable.workgroup?.preferred_template?.meetingInfo?.googleSlides == 1 && (<> { const currentOrder = myVariable.agendaItemOrder ? myVariable.agendaItemOrder[myVariable.workgroup?.workgroup] : undefined; async function generatePdf(markdown: any) { + const embedRegex = /\{% embed url="([^"]+)" %\}/g; + const updatedMarkdown = markdown.replace(embedRegex, (match, url) => { + // Check if the URL is a YouTube video + if (url.includes("youtube.com") || url.includes("youtu.be")) { + return `[Watch Video](${url})`; // Replace with a descriptive text for videos + } else if (url.includes("google.slides.com") || url.includes("docs.google.com/presentation")) { + return `[View Slides](${url})`; // Replace with a descriptive text for slides + } else { + return `[Link](${url})`; // A generic replacement for other URLs + } + }); + markdown = updatedMarkdown; try { //console.log(formData.meetingInfo?.date, myVariable.summary?.date) const additionalLines = `# Meeting Summary for ${myVariable.workgroup?.workgroup}\n` + diff --git a/components/TimestampedVideo.tsx b/components/TimestampedVideo.tsx index e81c6f0..4464f8e 100644 --- a/components/TimestampedVideo.tsx +++ b/components/TimestampedVideo.tsx @@ -2,48 +2,26 @@ import { useState, useEffect } from 'react'; import styles from '../styles/timestampedVideo.module.css'; type TimestampedVideoProps = { - onUpdate: (videoData: any) => void; - initialData?: { - url: string; - intro: string; - timestamps: { title: string; timestamp: string }[]; - }; + onUpdate: (videoData: any) => void; + initialData?: { + url: string; + intro: string; + timestamps: string; }; - +}; const TimestampedVideo: React.FC = ({ onUpdate, initialData }) => { const [videoData, setVideoData] = useState({ url: initialData?.url || '', intro: initialData?.intro || '', - timestamps: initialData?.timestamps || [{ title: '', timestamp: '' }], + timestamps: initialData?.timestamps || '', }); - const handleChange = (e: React.ChangeEvent, index: number | null) => { + const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; - if (index !== null) { - // Handle change for timestamps - const updatedTimestamps = [...videoData.timestamps]; - updatedTimestamps[index] = { ...updatedTimestamps[index], [name]: value }; - setVideoData({ ...videoData, timestamps: updatedTimestamps }); - } else { - // Handle change for URL and Intro - setVideoData({ ...videoData, [name]: value }); - } - }; - - const addTimestamp = () => { - setVideoData({ - ...videoData, - timestamps: [...videoData.timestamps, { title: '', timestamp: '' }], - }); + setVideoData({ ...videoData, [name]: value }); }; - const removeTimestamp = (index: number) => { - const filteredTimestamps = videoData.timestamps.filter((_, i) => i !== index); - setVideoData({ ...videoData, timestamps: filteredTimestamps }); - }; - - // useEffect hook to call onUpdate whenever videoData changes useEffect(() => { onUpdate(videoData); // Call onUpdate with the current state of videoData }, [videoData, onUpdate]); // Add videoData and onUpdate to the dependency array @@ -57,45 +35,28 @@ const TimestampedVideo: React.FC = ({ onUpdate, initialDa type="text" name="url" value={videoData.url} - onChange={(e) => handleChange(e, null)} + onChange={handleChange} + /> +
+
+ +