Skip to content

Commit 284591d

Browse files
dergigiBoltTouring
andauthored
Report Submission Form (#443)
* feat: implement grantee report submission system * feat: add grantee report submission feature with tests * refactor(report-bot): improve typing and error handling - Switch to GH_BOT_TOKEN, add proper types, validation, and better error handling * Delete .babelrc * Auto-fix lint errors * Use GH_ACCESS_TOKEN * Remove unused import * Auto-fix lint errors * npm i marked * refactor: remove unnecessary encryption from form data storage * refactor: remove unused email_hash prop from GrantReportForm * style: fix formatting in GrantReportForm setValue call * fix: resolve build errors - remove unused variables and fix email function call * refactor: remove CryptoJS dependency from validate-grant endpoint * refactor: remove email_hash from submit page and validation result * style: fix formatting in submit page * fix: resolve useLayoutEffect warning in GrantValidationForm * fix: make GrantValidationForm client-side only to resolve useLayoutEffect warning * fix: replace DynamicFormButton with standard button in GrantValidationForm * style: update GrantValidationForm to match application form layout * style: update GrantReportForm to match application form layout and styling * style: update submit page to use PageSection for consistent layout * fix: use localStorage to persist grant details between pages * fix: report preview functionality and storage handling - Fix storage key consistency between write and preview pages - Add proper validation and error handling for preview - Add preview page with proper data loading - Clean up unused code and improve error messages - Fix form validation before preview navigation * feat: improve validation form button styling - Update Next button to Next Step with arrow icon - Add proper SVG arrow icon from Heroicons - Improve button layout with flexbox for icon alignment * feat: improve grant validation form - Update grant ID help text to reference Grant Agreement - Update email placeholder with example - Improve error message for invalid grant ID * refactor: remove report number field - Remove report number field from form and preview - Simplify storage key handling - Update markdown template structure - Clean up form validation logic * fix: improve report submission flow and fix form rendering - Fix form rendering to always show form with pre-filled data when available\n- Add notification banner for recovered data\n- Update storage keys to use constants\n- Fix preview page data flow\n- Add getReportPreview function\n- Fix import paths to use relative paths * fix: correct field names in report preview - Update getReportPreview to use correct field names from form data\n- Fix data structure when storing report data in localStorage\n- Remove unused report number field * refactor: remove recovered data notice from grant report form * refactor: convert instructions notice to regular paragraph in grant report form * refactor: move records text to Use of Funds section and simplify help text * fix: auto-fix all lint problems * fix: auto-fix lint issues * refactor: replace custom markdown parser with marked library * refactor: remove convertMarkdownToHtml function and use marked directly * refactor: extract Reporting Guidelines into separate component and improve heading hierarchy * refactor: remove reportNumber from email confirmation and update write page * chore: update write page * refactor: remove ReportingGuidelines component * refactor: remove ReportingGuidelines references * refactor: update validation form and submit page * refactor: extract help needed formatting to utility function * fix: remove extra parameter in sendReportConfirmationEmail call * refactor: consolidate report content generation into a single function * refactor: remove reportNumber parameter from generateReportContent * refactor: remove format-helpers.ts and move function to api-helpers.ts * refactor: incorporate help needed section formatting directly into generateReportContent * style: fix formatting in generateReportContent function * fix: address linting issues in report-related files * fix: remove unused variables and imports * feat: add back button to write report page * refactor: remove convertMarkdownToHtml function and use marked directly * style: align next step button to the right and match preview report button styling * refactor: extract grant not found error message to constants * refactor: remove Grant ID field from GrantReportForm * feat: include grant_id in grant_details object * fix: auto-fix lint issues * Fix report submission by removing report_number requirement * Add success page for report submission * Fix success page and add link to Grantee FAQ * Fix DOM nesting error in write report page * refactor: improve project name extraction in validate-grant API * refactor: consolidate email functionality into sendgrid.ts * chore: update env example and remove old email.ts * chore: add log message for application copy sent to OpenSats * refactor: remove simulated email sending * refactor: rename report-bot.ts to report.ts for cleaner API endpoint naming * refactor: rename validate-grant.ts to grant.ts for cleaner API endpoint naming * refactor: remove email from grant validation response * refactor: remove email from grant validation response * fix: remove default sender address to ensure proper configuration * feat: add BCC support for email notifications * refactor: add BCC to EmailOptions interface and handle it consistently * refactor: remove email from grant validation response handling * fix: include email from form data in grant validation result * fix: remove 'by' part from project name in report emails * refactor: clean project name once and use consistently (DRY) * fix: update API endpoint URL from report-bot to report * refactor: clear all storage keys after successful report submission * Disable SendGrid tracking features (click, open, and subscription tracking) * Fix Prettier, TypeScript, and unused import errors in sendgrid API and report success page --------- Co-authored-by: BoltTouring <github@tricycle.cc>
1 parent 40b2098 commit 284591d

19 files changed

Lines changed: 14877 additions & 7712 deletions

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ GH_APP_REPO=applications
44
GH_REPORTS_REPO=reports
55
SENDGRID_API_KEY=
66
SENDGRID_RECIPIENT=
7-
SENDGRID_RECEPIENT=
87
SENDGRID_CC=
8+
SENDGRID_BCC=
99
SENDGRID_VERIFIED_SENDER=
1010
BTCPAY_URL=
1111
BTCPAY_INVOICE_KEY=
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom'
4+
5+
// Mock ReactMarkdown
6+
jest.mock('react-markdown', () => {
7+
return function MockReactMarkdown(props: { children: string }) {
8+
return <div data-testid="markdown-content">{props.children}</div>
9+
}
10+
})
11+
12+
import ReportPreview from '../../components/ReportPreview'
13+
14+
describe('ReportPreview', () => {
15+
it('renders with correct content', () => {
16+
const { getByTestId } = render(
17+
<ReportPreview
18+
project_name="Test Project"
19+
report_number="1"
20+
time_spent="test progress"
21+
next_quarter="test plans"
22+
money_usage="test usage"
23+
help_needed="test help"
24+
/>
25+
)
26+
27+
const content = getByTestId('markdown-content').textContent || ''
28+
29+
// Just verify the key elements we care about
30+
expect(content).toContain('Progress Report # 1')
31+
expect(content).toContain('Use of Funds')
32+
})
33+
})

0 commit comments

Comments
 (0)