Skip to content

Commit 413e03d

Browse files
committed
Added Ambassador Town Hall Tempate and other minor updates
1 parent b8cb569 commit 413e03d

10 files changed

Lines changed: 100 additions & 25 deletions

File tree

components/Item.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const TextAreaInput = ({ value, onChange, placeholder, type }: any) => {
77
const titles: any = {
88
narrative: 'Meeting narrative: Try to make your narrative concise and information-dense, and avoid filler',
99
townHallUpdates: 'Write down Weekly Town Hall updates',
10-
gameRules: 'Write down Game Rules'
10+
gameRules: 'Write down Game Rules',
11+
townHallSummary: 'Write down Weekly Town Hall Summary'
1112
};
1213

1314
// Determine the title based on the type
@@ -123,6 +124,7 @@ const Item = ({ type, item, agendaIndex, itemIndex, onUpdate, onRemove }: any) =
123124
return createItem(type, agendaIndex, itemIndex, item, handleUpdate, onRemove);
124125
case 'townHallUpdates':
125126
case 'narrative':
127+
case 'townHallSummary':
126128
case 'gameRules':
127129
return <TextAreaInput
128130
type={type}

components/SummaryAgendaItems.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const SummaryAgendaItems = ({onUpdate}: any) => {
6161
const newAgendaItems = JSON.parse(JSON.stringify(prevAgendaItems));
6262

6363
// Check if the type is 'narrative'
64-
if (type === 'townHallUpdates' || type === 'narrative' || type === 'gameRules') {
64+
if (type === 'townHallUpdates' || type === 'narrative' || type === 'gameRules' || type === 'townHallSummary') {
6565
if (newAgendaItems[agendaIdx]) {
6666
newAgendaItems[agendaIdx][type] = updatedItem[type]; // Directly set the narrative or gameRules string
6767
}
@@ -245,6 +245,25 @@ const getHeading = (itemType: any, workgroup: any) => {
245245
</>
246246
)
247247
},
248+
{
249+
type: "townHallSummary",
250+
isEnabled: (template: any) => template?.townHallSummary === 1,
251+
render: (item: any, agendaIndex: any) => (
252+
<>
253+
<h3>Town Hall Summary</h3>
254+
<div className={styles['action-item']}>
255+
<Item
256+
type="townHallSummary"
257+
item={item.townHallSummary}
258+
agendaIndex={agendaIndex}
259+
itemIndex={0}
260+
onUpdate={(agendaIdx: any, itemIdx: any, updatedItem: any) => handleItemUpdate('townHallSummary', agendaIdx, itemIdx, updatedItem)}
261+
onRemove={removeItem}
262+
/>
263+
</div>
264+
</>
265+
)
266+
},
248267
{
249268
type: "leaderboard",
250269
isEnabled: (template: any) => template?.leaderboard === 1,

components/SummaryMeetingInfo.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
2020
documenter = '',
2121
peoplePresent = '',
2222
purpose = '',
23+
townHallNumber = '',
24+
googleSlides = '',
2325
meetingVideoLink = '',
2426
miroBoardLink = '',
2527
otherMediaLink = '',
@@ -36,6 +38,8 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
3638
documenter,
3739
peoplePresent,
3840
purpose,
41+
townHallNumber,
42+
googleSlides,
3943
meetingVideoLink,
4044
miroBoardLink,
4145
otherMediaLink,
@@ -115,6 +119,8 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
115119
documenter = '',
116120
peoplePresent = '',
117121
purpose = '',
122+
townHallNumber = '',
123+
googleSlides = '',
118124
meetingVideoLink = '',
119125
miroBoardLink = '',
120126
otherMediaLink = '',
@@ -132,6 +138,8 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
132138
documenter,
133139
peoplePresent,
134140
purpose,
141+
townHallNumber,
142+
googleSlides,
135143
meetingVideoLink,
136144
miroBoardLink,
137145
otherMediaLink,
@@ -246,6 +254,20 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
246254
autoComplete="off"
247255
title="A sentence on what this group is about. Can be repeated for every summary"
248256
/>
257+
</>)}
258+
{myVariable.workgroup?.preferred_template?.meetingInfo?.townHallNumber == 1 && (<>
259+
<label className={styles['form-label']}>
260+
Town Hall Number:
261+
</label>
262+
<input
263+
type="text"
264+
name="townHallNumber"
265+
value={meetingInfo.townHallNumber || ""}
266+
onChange={handleChange}
267+
className={styles['form-input']}
268+
autoComplete="off"
269+
title="The number of the town hall meeting"
270+
/>
249271
</>)}
250272
{myVariable.workgroup?.preferred_template?.meetingInfo?.meetingVideoLink == 1 && (<>
251273
<label className={styles['form-label']}>
@@ -330,6 +352,19 @@ const SummaryMeetingInfo: React.FC<SummaryMeetingInfoProps> = ({ workgroup, onUp
330352
initialData={meetingInfo.timestampedVideo}
331353
/>
332354
)}
355+
{myVariable.workgroup?.preferred_template?.meetingInfo?.googleSlides == 1 && (<>
356+
<label className={styles['form-label']}>
357+
Google Slides (Will be embedded in GitBook):
358+
</label>
359+
<input
360+
type="text"
361+
name="googleSlides"
362+
value={meetingInfo.googleSlides || ""}
363+
onChange={handleChange}
364+
className={styles['form-input']}
365+
autoComplete="off"
366+
/>
367+
</>)}
333368
</div>
334369
</>
335370
);

components/SummaryTemplate.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
7979
documenter:"",
8080
peoplePresent: "",
8181
purpose: "",
82+
townHallNumber: "",
8283
meetingVideoLink: "",
8384
miroBoardLink: "",
8485
otherMediaLink: "",

components/TimestampedVideo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const TimestampedVideo: React.FC<TimestampedVideoProps> = ({ onUpdate, initialDa
6161
/>
6262
</div>
6363
<div className={styles.field}>
64-
<label className={styles.label}>Introduction:</label>
64+
<label className={styles.label}>Video description:</label>
6565
<textarea
6666
className={styles.textarea}
6767
name="intro"

pages/submit-meeting-summary/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const SubmitMeetingSummary: NextPage = () => {
8383
"Governance Workgroup": ["narrative", "discussionPoints", "decisionItems", "actionItems"],
8484
"Education Workgroup": ["meetingTopics", "discussionPoints", "decisionItems", "actionItems"],
8585
"Marketing Guild": ["discussionPoints", "decisionItems", "actionItems"],
86-
"Ambassador Town Hall": ["narrative", "discussionPoints", "decisionItems", "actionItems"]
86+
"Ambassador Town Hall": ["townHallSummary", "discussionPoints", "decisionItems", "actionItems"]
8787
};
8888

8989
useEffect(() => {

styles/timestampedVideo.module.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/* workingDocsTable.module.css */
2-
2+
.container {
3+
border: 1px solid #ccc;
4+
border-radius: 4px;
5+
padding: 10px;
6+
margin-bottom: 10px;
7+
}
38
.table {
49
width: 100%;
510
border-collapse: collapse;

utils/generateMarkdown.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function generateMarkdown(summary, order) {
2929
}
3030
// Process meetingInfo
3131
if (summary.meetingInfo) {
32-
const { date, name, host, documenter, peoplePresent, purpose, otherMediaLink, meetingVideoLink, mediaLink, miroBoardLink, transcriptLink, workingDocs, timestampedVideo } = summary.meetingInfo;
32+
const { date, name, host, documenter, peoplePresent, purpose, googleSlides, townHallNumber, otherMediaLink, meetingVideoLink, mediaLink, miroBoardLink, transcriptLink, workingDocs, timestampedVideo } = summary.meetingInfo;
3333

3434
// Add meeting information to markdown
3535
if (name) markdown += `- Type of meeting: ${name}\n`;
@@ -41,6 +41,7 @@ export function generateMarkdown(summary, order) {
4141
markdown += '\n';
4242
}
4343
if (purpose) markdown += `- Purpose: ${purpose}\n`;
44+
if (townHallNumber) markdown += `- Town Hall Number: ${townHallNumber}\n`; //townHallNumber
4445
if (meetingVideoLink) markdown += `- Meeting video: ${meetingVideoLink}\n`;
4546
if (mediaLink) markdown += `- Media link: ${mediaLink}\n`;
4647
if (miroBoardLink) markdown += `- Miro board: ${miroBoardLink}\n`;
@@ -49,7 +50,7 @@ export function generateMarkdown(summary, order) {
4950
//markdown += '\n';
5051

5152
// Process workingDocs
52-
if (workingDocs) {
53+
if (workingDocs && Array.isArray(workingDocs) && workingDocs.length > 0) {
5354
markdown += `- Working Docs:\n`;
5455
workingDocs.forEach(doc => {
5556
if (doc.link) {
@@ -89,7 +90,12 @@ export function generateMarkdown(summary, order) {
8990
});
9091

9192
markdown += `\n`;
92-
}
93+
}
94+
95+
if (googleSlides) {
96+
markdown += `\n#### Slides:\n`;
97+
markdown += `{% embed url="${googleSlides}" %}\n\n`;
98+
}
9399
}
94100

95101
function getOrdinal(n) {
@@ -101,7 +107,7 @@ export function generateMarkdown(summary, order) {
101107
// Generic function to format items
102108
const formatItems = (title, items, itemType) => {
103109
let sectionContent = '';
104-
if (itemType === 'townHallUpdates' || itemType === 'narrative' || itemType === 'gameRules') {
110+
if (itemType === 'townHallUpdates' || itemType === 'narrative' || itemType === 'gameRules' || itemType === 'townHallSummary') {
105111
if (items.trim()) { // Check if narrative or gameRules are not empty
106112
sectionContent = `${items}\n\n`;
107113
}
@@ -146,6 +152,9 @@ export function generateMarkdown(summary, order) {
146152
case 'townHallUpdates':
147153
if (item.townHallUpdates) formatItems("Town Hall Updates", item.townHallUpdates, 'townHallUpdates');
148154
break;
155+
case 'townHallSummary':
156+
if (item.townHallSummary) formatItems("Town Hall Summary", item.townHallSummary, 'townHallSummary');
157+
break;
149158
case 'narrative':
150159
if (item.narrative) formatItems("Narrative", item.narrative, 'narrative');
151160
break;

utils/sendDiscordMessage.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import axios from 'axios';
22

3-
function markdownHeadingsToBold(rawmarkdown) {
4-
// This regex will match markdown headings, capturing the text after the hashes.
5-
const headingRegex = /(?:^|\n)(#+)([^\n]+)/g;
6-
7-
return rawmarkdown.replace(headingRegex, (match, hashes, text) => {
8-
// Replace the hashes with bold syntax.
9-
return `${hashes.replace(/#/g, '').length > 0 ? '\n' : ''}**${text.trim()}**`;
10-
});
11-
}
12-
133
function parseMarkdownToEmbedFields(rawmarkdown) {
144
const fieldsArray = [];
155
// Split the raw markdown by lines
@@ -149,7 +139,17 @@ function createDiscordEmbeds(rawmarkdown, title, footerText) {
149139

150140
export async function sendDiscordMessage(myVariable, markdown) {
151141
const embedRegex = /\{% embed url="([^"]+)" %\}/g;
152-
markdown = markdown.replace(embedRegex, (match, url) => `[Video Link](${url})`);
142+
const updatedMarkdown = markdown.replace(embedRegex, (match, url) => {
143+
// Check if the URL is a YouTube video
144+
if (url.includes("youtube.com") || url.includes("youtu.be")) {
145+
return `[Watch Video](${url})`; // Replace with a descriptive text for videos
146+
} else if (url.includes("google.slides.com") || url.includes("docs.google.com/presentation")) {
147+
return `[View Slides](${url})`; // Replace with a descriptive text for slides
148+
} else {
149+
return `[Link](${url})`; // A generic replacement for other URLs
150+
}
151+
});
152+
markdown = updatedMarkdown;
153153

154154
const workgroup = myVariable.summary.workgroup;
155155
const username = myVariable.summary.meetingInfo.documenter;

utils/updateWorkgroups.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ export async function updateWorkgroups(workgroupData) {
1212
"documenter":1,
1313
"peoplePresent":1,
1414
"purpose":1,
15+
"townHallNumber": 0,
16+
"googleSlides": 0,
1517
"meetingVideoLink":1,
16-
"miroBoardLink":1,
17-
"otherMediaLink":1,
18+
"miroBoardLink":0,
19+
"otherMediaLink":0,
1820
"transcriptLink":1,
19-
"mediaLink":0
21+
"mediaLink":0,
22+
"workingDocs": 1,
23+
"timestampedVideo": 0
2024
},
2125
"agendaItems":
2226
[
2327
{
24-
"agenda":1,
25-
"status":1,
28+
"agenda":0,
29+
"status":0,
2630
"narrative":0,
2731
"meetingTopics":0,
2832
"issues":0,

0 commit comments

Comments
 (0)