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/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} + /> +
+
+ +