Upload folder using huggingface_hub
Browse files
client/src/components/Refinity.tsx
CHANGED
|
@@ -487,6 +487,23 @@ const Refinity: React.FC = () => {
|
|
| 487 |
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 488 |
} catch {}
|
| 489 |
}} disabled={!compareA || !compareB || compareA===compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Export .docx</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
<button onClick={()=>{ setCompareUIOpen(false); setCompareA(''); setCompareB(''); }} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Close</button>
|
| 491 |
</div>
|
| 492 |
</div>
|
|
@@ -522,6 +539,23 @@ const Refinity: React.FC = () => {
|
|
| 522 |
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 523 |
} catch {}
|
| 524 |
}} className="px-3 py-1.5 text-sm rounded-md border border-gray-300 bg-white">Export .docx</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
<button onClick={()=>setCompareModalOpen(false)} className="px-3 py-1.5 text-sm rounded-md border border-gray-300 bg-white">Close</button>
|
| 526 |
</div>
|
| 527 |
</div>
|
|
|
|
| 487 |
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 488 |
} catch {}
|
| 489 |
}} disabled={!compareA || !compareB || compareA===compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Export .docx</button>
|
| 490 |
+
<button onClick={async()=>{
|
| 491 |
+
const a = taskVersions.find(v=>v.id===compareA);
|
| 492 |
+
const b = taskVersions.find(v=>v.id===compareB);
|
| 493 |
+
if (!a || !b || a.id===b.id) return;
|
| 494 |
+
try {
|
| 495 |
+
const base = ((api.defaults as any)?.baseURL as string || '').replace(/\/$/, '');
|
| 496 |
+
const latestReviser = (b.revisedBy || b.originalAuthor || username || 'User');
|
| 497 |
+
const filename = `${(task?.title||'Task').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_${(latestReviser||'User').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_ooxml.docx`;
|
| 498 |
+
const body = { prev: a.content||'', current: b.content||'', filename, authorName: latestReviser };
|
| 499 |
+
const resp = await fetch(`${base}/api/refinity/track-changes-ooxml`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
| 500 |
+
if (!resp.ok) throw new Error('Export failed');
|
| 501 |
+
const blob = await resp.blob();
|
| 502 |
+
const url = window.URL.createObjectURL(blob);
|
| 503 |
+
const link = document.createElement('a');
|
| 504 |
+
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 505 |
+
} catch {}
|
| 506 |
+
}} disabled={!compareA || !compareB || compareA===compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Export (True Track)</button>
|
| 507 |
<button onClick={()=>{ setCompareUIOpen(false); setCompareA(''); setCompareB(''); }} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Close</button>
|
| 508 |
</div>
|
| 509 |
</div>
|
|
|
|
| 539 |
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 540 |
} catch {}
|
| 541 |
}} className="px-3 py-1.5 text-sm rounded-md border border-gray-300 bg-white">Export .docx</button>
|
| 542 |
+
<button onClick={async()=>{
|
| 543 |
+
const center = taskVersions[flowIndex];
|
| 544 |
+
const prevV = taskVersions[flowIndex-1] || taskVersions[flowIndex];
|
| 545 |
+
if (!center) { setCompareModalOpen(false); return; }
|
| 546 |
+
try {
|
| 547 |
+
const base = ((api.defaults as any)?.baseURL as string || '').replace(/\/$/, '');
|
| 548 |
+
const latestReviser = (center?.revisedBy || center?.originalAuthor || username || 'User');
|
| 549 |
+
const filename = `${(task?.title||'Task').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_${(latestReviser||'User').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_ooxml.docx`;
|
| 550 |
+
const body = { prev: (prevV?.content||''), current: (center?.content||''), filename, authorName: latestReviser };
|
| 551 |
+
const resp = await fetch(`${base}/api/refinity/track-changes-ooxml`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
| 552 |
+
if (!resp.ok) throw new Error('Export failed');
|
| 553 |
+
const blob = await resp.blob();
|
| 554 |
+
const url = window.URL.createObjectURL(blob);
|
| 555 |
+
const link = document.createElement('a');
|
| 556 |
+
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 557 |
+
} catch {}
|
| 558 |
+
}} className="px-3 py-1.5 text-sm rounded-md border border-gray-300 bg-white">Export (True Track)</button>
|
| 559 |
<button onClick={()=>setCompareModalOpen(false)} className="px-3 py-1.5 text-sm rounded-md border border-gray-300 bg-white">Close</button>
|
| 560 |
</div>
|
| 561 |
</div>
|