Skip to content

Commit f04d7a6

Browse files
Merge pull request #141 from SingularityNET-Archive:development
refactor: Update SummaryTemplate component to disable google doc buttons when exporting
2 parents 6cc4563 + 7bab4cc commit f04d7a6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

components/SummaryTemplate.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
7373
const [creatingDoc, setCreatingDoc] = useState<boolean>(false);
7474
const today = new Date().toISOString().split('T')[0];
7575
const [selectedQuarter, setSelectedQuarter] = useState('');
76-
const [creatingQuarterlyDoc, setCreatingQuarterlyDoc] = useState(false);
7776
const quarterOptions = getQuarterOptions();
7877

7978
const defaultFormData = {
@@ -125,7 +124,7 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
125124
const currentOrder = myVariable.agendaItemOrder ? myVariable.agendaItemOrder[myVariable.workgroup?.workgroup] : undefined;
126125

127126
async function handleCreateQuarterlyDoc() {
128-
setCreatingQuarterlyDoc(true);
127+
setCreatingDoc(true);
129128

130129
try {
131130
const [quarter, year] = selectedQuarter.split(' ');
@@ -143,7 +142,7 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
143142
console.error('Error creating Quarterly Google Doc:', error);
144143
alert('There was an error creating the Quarterly Google Doc.');
145144
} finally {
146-
setCreatingQuarterlyDoc(false);
145+
setCreatingDoc(false);
147146
}
148147
}
149148

@@ -349,10 +348,10 @@ const SummaryTemplate = ({ updateMeetings }: SummaryTemplateProps) => {
349348
type="button"
350349
onClick={handleCreateQuarterlyDoc}
351350
className={styles.exportButton}
352-
disabled={creatingQuarterlyDoc || !selectedQuarter}
351+
disabled={creatingDoc || !selectedQuarter}
353352
>
354-
{creatingQuarterlyDoc ? (
355-
<span className={styles.flashingText}>Creating Quarterly Doc...</span>
353+
{creatingDoc ? (
354+
<span className={styles.flashingText}>Creating Google Doc...</span>
356355
) : (
357356
"Create Quarterly Google Doc"
358357
)}

styles/summarytemplate.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
margin-top: 0;
9696
}
9797

98-
.quarterly-report-section .exportButton:disabled {
98+
.exportButton:disabled {
9999
background-color: #e0e0e0;
100100
color: #a0a0a0;
101101
cursor: not-allowed;

0 commit comments

Comments
 (0)