Álvaro Valenzuela Valdes commited on
Commit
1002636
·
1 Parent(s): 19e0332

Improve PDF embedding compatibility for HF Spaces

Browse files
Files changed (1) hide show
  1. frontend/components/AgentAnalysis.tsx +21 -11
frontend/components/AgentAnalysis.tsx CHANGED
@@ -515,22 +515,32 @@ export default function AgentAnalysis({ tender, companyProfile, analysis, onAnal
515
 
516
  {/* PDF Viewer for Active Selection */}
517
  {activeAnimalId && pdfUrls[activeAnimalId] && (
518
- <div className="mt-6 rounded-2xl overflow-hidden border border-white/10 bg-black/40 h-80 relative group">
519
- <iframe
520
- src={`${pdfUrls[activeAnimalId]}#toolbar=0&navpanes=0&scrollbar=0`}
521
- className="w-full h-full border-none opacity-80 group-hover:opacity-100 transition-opacity"
522
- />
523
- <div className="absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black to-transparent flex justify-between items-end">
524
- <p className="text-[9px] font-mono text-slate-400 truncate max-w-[150px]">
525
- {corral.find(a => a.id === activeAnimalId)?.file.name}
526
- </p>
 
 
 
 
 
 
 
 
 
 
527
  <a
528
  href={pdfUrls[activeAnimalId]}
529
  target="_blank"
530
  rel="noopener noreferrer"
531
- className="text-[9px] font-bold text-cyan hover:underline"
532
  >
533
- Full View
534
  </a>
535
  </div>
536
  </div>
 
515
 
516
  {/* PDF Viewer for Active Selection */}
517
  {activeAnimalId && pdfUrls[activeAnimalId] && (
518
+ <div className="mt-6 rounded-2xl overflow-hidden border border-white/10 bg-black/40 h-80 relative group flex flex-col">
519
+ <div className="flex-1 w-full bg-slate-900/50 flex items-center justify-center relative">
520
+ <embed
521
+ src={pdfUrls[activeAnimalId]}
522
+ type="application/pdf"
523
+ className="w-full h-full"
524
+ />
525
+ {/* Fallback Overlay for blocked frames */}
526
+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity bg-black/40">
527
+ <p className="text-[10px] text-white font-bold bg-purple-600 px-3 py-1 rounded-full shadow-lg">Document Preview Mode</p>
528
+ </div>
529
+ </div>
530
+ <div className="p-3 bg-slate-950 flex justify-between items-center border-t border-white/5">
531
+ <div className="flex items-center gap-2">
532
+ <span className="text-xl">📄</span>
533
+ <p className="text-[10px] font-mono text-slate-300 truncate max-w-[120px]">
534
+ {corral.find(a => a.id === activeAnimalId)?.file.name}
535
+ </p>
536
+ </div>
537
  <a
538
  href={pdfUrls[activeAnimalId]}
539
  target="_blank"
540
  rel="noopener noreferrer"
541
+ className="px-3 py-1 rounded-lg bg-cyan/10 border border-cyan/20 text-[10px] font-black text-cyan hover:bg-cyan hover:text-black transition-all"
542
  >
543
+ OPEN FULL PDF
544
  </a>
545
  </div>
546
  </div>