The preview functionality was added to the /temp page of the application, specifically within the DraftOrcaDashboard component. A new "Preview" button was introduced before the "Download Output" button to allow users to view a preview of the output data before downloading. A modal window was also implemented to display the preview content when the user clicks "Preview."
Why was it changed?
This change addresses a need for users to preview data before downloading it, ensuring they can verify the output format and content. The addition of this preview functionality improves user experience by reducing the need to repeatedly download files to check their contents.
How was it changed?
The following modifications were made:
- In DraftOrcaDashboard.js, added a new state variable showPreviewModal to manage the display of the modal window.- Implemented the fetchDocumentPreview function, which sends a POST request to the /preview endpoint with appropriate parameters (e.g., file_path, search_terms, sections, and specify_lines).- Added a "Preview" button in the JSX return statement, right before the "Download Output" button.- Created a modal layout that appears when showPreviewModal is set to true. This modal displays the preview content in a formatted manner, using the previewContent state to hold the data returned by the /preview endpoint.
This change required modifying DraftOrcaDashboard.js to integrate the new button and modal display, along with adjustments to the data formatting to align with backend expectations, ensuring compatibility with the /preview endpoint.
Fixes #76
What was changed?
The preview functionality was added to the /temp page of the application, specifically within the DraftOrcaDashboard component. A new "Preview" button was introduced before the "Download Output" button to allow users to view a preview of the output data before downloading. A modal window was also implemented to display the preview content when the user clicks "Preview."
Why was it changed?
This change addresses a need for users to preview data before downloading it, ensuring they can verify the output format and content. The addition of this preview functionality improves user experience by reducing the need to repeatedly download files to check their contents.
How was it changed?
The following modifications were made:
- In DraftOrcaDashboard.js, added a new state variable showPreviewModal to manage the display of the modal window. - Implemented the fetchDocumentPreview function, which sends a POST request to the /preview endpoint with appropriate parameters (e.g., file_path, search_terms, sections, and specify_lines). - Added a "Preview" button in the JSX return statement, right before the "Download Output" button. - Created a modal layout that appears when showPreviewModal is set to true. This modal displays the preview content in a formatted manner, using the previewContent state to hold the data returned by the /preview endpoint.
This change required modifying DraftOrcaDashboard.js to integrate the new button and modal display, along with adjustments to the data formatting to align with backend expectations, ensuring compatibility with the /preview endpoint.