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
16 changes: 13 additions & 3 deletions components/SummaryTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function formatTimestamp(timestamp: any) {
const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
const [loading, setLoading] = useState<boolean>(false);
const { myVariable, setMyVariable } = useMyVariable();
const [creatingDoc, setCreatingDoc] = useState<boolean>(false);
const today = new Date().toISOString().split('T')[0];

const defaultFormData = {
Expand Down Expand Up @@ -120,9 +121,11 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
const currentOrder = myVariable.agendaItemOrder ? myVariable.agendaItemOrder[myVariable.workgroup?.workgroup] : undefined;

async function handleCreateGoogleDoc() {
setCreatingDoc(true); // Set creatingDoc to true when the button is clicked

try {
const markdown = generateMarkdown(myVariable.summary, currentOrder);
console.log("markdown", markdown)
//console.log("markdown", markdown);
const response = await axios.post('/api/createGoogleDoc', {
markdown,
workgroup: myVariable.workgroup?.workgroup,
Expand All @@ -132,8 +135,10 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
} catch (error) {
console.error('Error creating Google Doc:', error);
alert('There was an error creating the Google Doc.');
} finally {
setCreatingDoc(false); // Set creatingDoc to false after completion
}
}
}

useEffect(() => {
// Set the local state whenever myVariable.summary changes
Expand Down Expand Up @@ -286,8 +291,13 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
type="button"
onClick={handleCreateGoogleDoc}
className={styles['export-button']}
disabled={creatingDoc}
>
Create Google Doc
{creatingDoc ? (
<span className={styles['flashing-text']}>Creating Google Doc...</span>
) : (
"Create Google Doc"
)}
</button>
</form>
</div>)}
Expand Down
8 changes: 8 additions & 0 deletions styles/typea.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,12 @@
font-weight: bold;
}

@keyframes flash {
0% { opacity: 1; }
50% { opacity: 0; }
100% { opacity: 1; }
}

.flashing-text {
animation: flash 1s infinite;
}