Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions components/ArchiveSummaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { generateMarkdown } from '../utils/generateMarkdown';
import { updateGitbook } from '../utils/updateGitbook';
import { sendDiscordMessage } from '../utils/sendDiscordMessage';
import { useMyVariable } from '../context/MyVariableContext';
import { confirmedStatusUpdate } from '../utils/confirmedStatusUpdate'
import { confirmedStatusUpdate } from '../utils/confirmedStatusUpdate';
import { saveCustomAgenda } from '../utils/saveCustomAgenda';

const ArchiveSummaries = () => {
const textareaRef = useRef<HTMLTextAreaElement>(null);
Expand All @@ -25,7 +26,7 @@ const ArchiveSummaries = () => {

useEffect(() => {
setRenderedMarkdown(formData.meetingSummary);
//console.log(formData.meetingSummary)
console.log(formData.meetingSummary, myVariable.summary)
}, [formData.meetingSummary]);

useEffect(() => {
Expand Down Expand Up @@ -72,7 +73,10 @@ const ArchiveSummaries = () => {
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);

if (myVariable.summary?.noSummaryGiven == true || myVariable.summary?.canceledSummary == true) {
const data: any = await saveCustomAgenda(myVariable.summary);
console.log(data);
}
// Check if there are any confirmed summaries with the same date
const isDuplicateConfirmedSummary = myVariable.summaries.some((summary: any) => {
// Convert both dates to Date objects to strip off the time part
Expand Down
14 changes: 10 additions & 4 deletions components/SummaryTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
otherMediaLink: "",
transcriptLink: "",
mediaLink: "",
workingDocs: [{ title: '', link: '' }],
timestampedVideo: { url: '', intro: '', timestamps: [{ title: '', timestamp: '' }] }
workingDocs: [{ title: "", link: "" }],
timestampedVideo: { url: "", intro: "", timestamps: [{ title: "", timestamp: "" }] }
},
agendaItems: [
{
Expand All @@ -108,7 +108,8 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
],
tags: { topicsCovered: "", emotions: "", other: "", gamesPlayed: "" },
type: "Custom",
noSummaryGiven: false
noSummaryGiven: false,
canceledSummary: false
};

const [formData, setFormData] = useState(filterFormData(filterKeys(myVariable.summary || {}, defaultFormData)));
Expand Down Expand Up @@ -247,7 +248,12 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {

summary.confirmed = false;

const cleanedFormData = removeEmptyValues({ ...formData, meetingInfo: { ...formData.meetingInfo, workingDocs: filteredWorkingDocs } });
const cleanedFormData = removeEmptyValues({
...formData,
meetingInfo: { ...formData.meetingInfo, workingDocs: filteredWorkingDocs },
noSummaryGiven: false,
canceledSummary: false
});
setLoading(true);

try {
Expand Down
10 changes: 10 additions & 0 deletions config/config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// config.js
const isTestMode = process.env.NEXT_PUBLIC_NODE_ENV === 'test';

const tableSuffix = isTestMode ? '_test' : '';

export const tableNames = {
meetingsummaries: `meetingsummaries${tableSuffix}`,
documents: `documents${tableSuffix}`,
// Add more table names as needed
};
10 changes: 8 additions & 2 deletions pages/submit-meeting-summary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ const SubmitMeetingSummary: NextPage = () => {
...prevMyVariable,
summary: {
...prevMyVariable.summary,
meetingInfo: {},
meetingInfo: {
name:"Weekly",
date: prevMyVariable.summary.meetingInfo.date
},
agendaItems: [],
tags: {},
noSummaryGiven: true,
Expand All @@ -264,7 +267,10 @@ const SubmitMeetingSummary: NextPage = () => {
...prevMyVariable,
summary: {
...prevMyVariable.summary,
meetingInfo: {},
meetingInfo: {
name:"Weekly",
date: prevMyVariable.summary.meetingInfo.date
},
agendaItems: [],
tags: {},
noSummaryGiven: false,
Expand Down
3 changes: 2 additions & 1 deletion utils/confirmedStatusUpdate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { supabase } from "../lib/supabaseClient";
import { tableNames } from '../config/config';

export async function confirmedStatusUpdate(formData) {
let updates = {
Expand All @@ -7,7 +8,7 @@ export async function confirmedStatusUpdate(formData) {
}

const { data, error } = await supabase
.from('meetingsummaries')
.from(tableNames.meetingsummaries)
.upsert(updates);

if (error) {
Expand Down
2 changes: 1 addition & 1 deletion utils/generateMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function generateMarkdown(summary, order) {
const { date, name, host, documenter, peoplePresent, purpose, googleSlides, townHallNumber, otherMediaLink, meetingVideoLink, mediaLink, miroBoardLink, transcriptLink, workingDocs, timestampedVideo } = summary.meetingInfo;

// Add meeting information to markdown
if (name) markdown += `- Type of meeting: ${name}\n`;
if ( name && !summary.canceledSummary && !summary.noSummaryGiven ) markdown += `- Type of meeting: ${name}\n`;
if (host || documenter || peoplePresent) {
markdown += `- Present: `;
if (host) markdown += `${host} [facilitator], `;
Expand Down
3 changes: 2 additions & 1 deletion utils/saveAgenda.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { supabase } from "../lib/supabaseClient";
import { tableNames } from '../config/config';

export async function saveAgenda(agendaData) {
let updates = {
Expand All @@ -10,7 +11,7 @@ export async function saveAgenda(agendaData) {
}

const { data, error } = await supabase
.from('meetingsummaries')
.from(tableNames.meetingsummaries)
.upsert(updates, { onConflict: ['name', 'date', 'workgroup_id', 'user_id'] });

if (error) {
Expand Down
3 changes: 2 additions & 1 deletion utils/saveCustomAgenda.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { supabase } from "../lib/supabaseClient";
import { tableNames } from '../config/config';

export async function saveCustomAgenda(agendaData) {
let updates = {
Expand All @@ -11,7 +12,7 @@ export async function saveCustomAgenda(agendaData) {
}

const { data, error } = await supabase
.from('meetingsummaries')
.from(tableNames.meetingsummaries)
.upsert(updates, { onConflict: ['name', 'date', 'workgroup_id', 'user_id'] })
.select('date, meeting_id, updated_at');

Expand Down