From 6602fd7cd26fe2f3479d2cc5a601a7848b8afa4f Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Fri, 3 Apr 2026 12:33:27 -0500 Subject: [PATCH] fix: improve download button visibility and add DOCX export 1. Download Button Visibility: - Changed from variant=outline to default variant (solid background) - Provides better contrast and icon visibility in both themes - Removed unnecessary text-foreground class 2. DOCX Export Support: - Added DOCX export via pandoc conversion - Writes temp markdown file, converts with pandoc, cleans up - Returns clear error if pandoc not installed - Supports same workflow as MD/PDF exports 3. Triaging Status Investigation: - triaging status is defined in schema and used in dashboard counts - Currently not automatically set when entering triage - Kept in filter dropdown as part of the data model Tested: Rust compilation, TypeScript types, Rust formatting Note: DOCX export requires pandoc to be installed on the system. Co-Authored-By: Claude Sonnet 4.5 --- src-tauri/src/commands/docs.rs | 33 +++++++++++++++++++++++++++++++++ src/components/DocEditor.tsx | 10 +++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/commands/docs.rs b/src-tauri/src/commands/docs.rs index fe382320..ef5b845c 100644 --- a/src-tauri/src/commands/docs.rs +++ b/src-tauri/src/commands/docs.rs @@ -201,6 +201,39 @@ pub async fn export_document( .map_err(|e| e.to_string())?; path.to_string_lossy().to_string() } + "docx" => { + // DOCX export via pandoc + let md_path = base_dir.join(format!("{safe_title}_temp.md")); + let docx_path = base_dir.join(format!("{safe_title}.docx")); + + // Write markdown to temp file + std::fs::write(&md_path, &content_md) + .map_err(|e| format!("Failed to write temp markdown: {}", e))?; + + // Use pandoc to convert + let output = std::process::Command::new("pandoc") + .arg(md_path.to_str().unwrap()) + .arg("-o") + .arg(docx_path.to_str().unwrap()) + .arg("-f") + .arg("markdown") + .arg("-t") + .arg("docx") + .output() + .map_err(|e| format!("Failed to run pandoc (is it installed?): {}", e))?; + + // Clean up temp file + let _ = std::fs::remove_file(&md_path); + + if !output.status.success() { + return Err(format!( + "Pandoc conversion failed: {}", + String::from_utf8_lossy(&output.stderr) + )); + } + + docx_path.to_string_lossy().to_string() + } _ => return Err(format!("Unsupported export format: {format}")), }; diff --git a/src/components/DocEditor.tsx b/src/components/DocEditor.tsx index b53840cb..2b304637 100644 --- a/src/components/DocEditor.tsx +++ b/src/components/DocEditor.tsx @@ -53,16 +53,16 @@ export function DocEditor({ content, onChange, version, updatedAt, onExport }: D )} {onExport && (
- - -