Upload folder using huggingface_hub
Browse files
client/src/components/Refinity.tsx
CHANGED
|
@@ -478,6 +478,30 @@ const Refinity: React.FC = () => {
|
|
| 478 |
>
|
| 479 |
Revise
|
| 480 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
<button
|
| 482 |
type="button"
|
| 483 |
onClick={(e) => { e.preventDefault(); e.stopPropagation(); setCompareUIOpen(true); if (!compareA) setCompareA(v.id); }}
|
|
@@ -528,7 +552,7 @@ const Refinity: React.FC = () => {
|
|
| 528 |
))}
|
| 529 |
</select>
|
| 530 |
</div>
|
| 531 |
-
<div className="flex gap-2 overflow-visible">
|
| 532 |
<button onClick={()=>{ const tmp = compareA; setCompareA(compareB); setCompareB(tmp); }} disabled={!compareA && !compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Swap</button>
|
| 533 |
<button onClick={async()=>{
|
| 534 |
const a = taskVersions.find(v=>v.id===compareA);
|
|
@@ -548,7 +572,7 @@ const Refinity: React.FC = () => {
|
|
| 548 |
<div className="relative">
|
| 549 |
<button onClick={()=>setCompareDownloadOpen(v=>!v)} disabled={!compareA || !compareB || compareA===compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Download ▾</button>
|
| 550 |
{compareDownloadOpen && (
|
| 551 |
-
<div className="absolute right-0 mt-1 w-
|
| 552 |
<button onClick={async()=>{
|
| 553 |
setCompareDownloadOpen(false);
|
| 554 |
const a = taskVersions.find(v=>v.id===compareA);
|
|
@@ -785,11 +809,11 @@ const EditorPane: React.FC<{ source: string; initialTranslation: string; onBack:
|
|
| 785 |
resize: 'vertical'
|
| 786 |
}}
|
| 787 |
/>
|
| 788 |
-
<div className="mt-4 flex gap-3">
|
| 789 |
<button onClick={save} disabled={saving} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-2xl text-white ring-1 ring-inset ring-white/50 backdrop-blur-md backdrop-brightness-110 backdrop-saturate-150 bg-indigo-600/70 disabled:bg-gray-400 active:translate-y-0.5 transition-all duration-200">{saving? 'Saving…':'Save'}</button>
|
| 790 |
<div className="relative">
|
| 791 |
<button onClick={(e)=>{ e.preventDefault(); const m = document.getElementById('rev-download-menu'); if (m) m.classList.toggle('hidden'); }} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-2xl text-black ring-1 ring-inset ring-white/50 backdrop-blur-md bg-white/30 active:translate-y-0.5 transition-all duration-200">Download ▾</button>
|
| 792 |
-
<div id="rev-download-menu" className="hidden absolute z-20 mt-1 w-
|
| 793 |
<button onClick={(e)=>{ e.preventDefault(); const m=document.getElementById('rev-download-menu'); if(m) m.classList.add('hidden'); downloadWithTrackChanges(); }} className="block w-full text-left px-3 py-2 text-sm hover:bg-gray-50">Track Changes</button>
|
| 794 |
<button onClick={(e)=>{ e.preventDefault(); const m=document.getElementById('rev-download-menu'); if(m) m.classList.add('hidden'); compareNow(); }} className="block w-full text-left px-3 py-2 text-sm hover:bg-gray-50">Inline Diff (Preview)</button>
|
| 795 |
</div>
|
|
|
|
| 478 |
>
|
| 479 |
Revise
|
| 480 |
</button>
|
| 481 |
+
<button
|
| 482 |
+
type="button"
|
| 483 |
+
onClick={(e)=>{
|
| 484 |
+
e.preventDefault(); e.stopPropagation();
|
| 485 |
+
// Export single version content as simple .docx (inline changes off)
|
| 486 |
+
(async()=>{
|
| 487 |
+
try {
|
| 488 |
+
const base = ((api.defaults as any)?.baseURL as string || '').replace(/\/$/, '');
|
| 489 |
+
const latestReviser = (v.revisedBy || v.originalAuthor || username || 'User');
|
| 490 |
+
const filename = `${(task?.title||'Task').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_${(latestReviser||'User').replace(/[^\w\-\s]/g,'').replace(/\s+/g,'_')}_v${v.versionNumber}.docx`;
|
| 491 |
+
const resp = await fetch(`${base}/api/refinity/track-changes`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prev: '', current: v.content || '', filename }) });
|
| 492 |
+
if (!resp.ok) throw new Error('Export failed');
|
| 493 |
+
const blob = await resp.blob();
|
| 494 |
+
const url = window.URL.createObjectURL(blob);
|
| 495 |
+
const link = document.createElement('a');
|
| 496 |
+
link.href = url; link.download = filename; document.body.appendChild(link); link.click(); link.remove(); window.URL.revokeObjectURL(url);
|
| 497 |
+
} catch {}
|
| 498 |
+
})();
|
| 499 |
+
}}
|
| 500 |
+
className="inline-flex items-center justify-center gap-2 text-black text-sm font-medium rounded-2xl ring-1 ring-inset ring-white/50 active:translate-y-0.5 transition-all duration-200"
|
| 501 |
+
style={{ position: 'relative', zIndex: 3100, pointerEvents: 'auto', padding: '0.5rem 0.75rem', background: 'rgba(255,255,255,0.3)', borderRadius: '1rem', border: '1px solid rgba(255,255,255,0.5)' }}
|
| 502 |
+
>
|
| 503 |
+
Download
|
| 504 |
+
</button>
|
| 505 |
<button
|
| 506 |
type="button"
|
| 507 |
onClick={(e) => { e.preventDefault(); e.stopPropagation(); setCompareUIOpen(true); if (!compareA) setCompareA(v.id); }}
|
|
|
|
| 552 |
))}
|
| 553 |
</select>
|
| 554 |
</div>
|
| 555 |
+
<div className="flex gap-2 overflow-visible items-start">
|
| 556 |
<button onClick={()=>{ const tmp = compareA; setCompareA(compareB); setCompareB(tmp); }} disabled={!compareA && !compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Swap</button>
|
| 557 |
<button onClick={async()=>{
|
| 558 |
const a = taskVersions.find(v=>v.id===compareA);
|
|
|
|
| 572 |
<div className="relative">
|
| 573 |
<button onClick={()=>setCompareDownloadOpen(v=>!v)} disabled={!compareA || !compareB || compareA===compareB} className="px-3 py-2 text-sm rounded-md border border-gray-300 bg-white">Download ▾</button>
|
| 574 |
{compareDownloadOpen && (
|
| 575 |
+
<div className="absolute right-0 mt-1 w-56 rounded-md border border-gray-200 bg-white shadow-lg z-20">
|
| 576 |
<button onClick={async()=>{
|
| 577 |
setCompareDownloadOpen(false);
|
| 578 |
const a = taskVersions.find(v=>v.id===compareA);
|
|
|
|
| 809 |
resize: 'vertical'
|
| 810 |
}}
|
| 811 |
/>
|
| 812 |
+
<div className="mt-4 flex gap-3 relative">
|
| 813 |
<button onClick={save} disabled={saving} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-2xl text-white ring-1 ring-inset ring-white/50 backdrop-blur-md backdrop-brightness-110 backdrop-saturate-150 bg-indigo-600/70 disabled:bg-gray-400 active:translate-y-0.5 transition-all duration-200">{saving? 'Saving…':'Save'}</button>
|
| 814 |
<div className="relative">
|
| 815 |
<button onClick={(e)=>{ e.preventDefault(); const m = document.getElementById('rev-download-menu'); if (m) m.classList.toggle('hidden'); }} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-2xl text-black ring-1 ring-inset ring-white/50 backdrop-blur-md bg-white/30 active:translate-y-0.5 transition-all duration-200">Download ▾</button>
|
| 816 |
+
<div id="rev-download-menu" className="hidden absolute z-20 mt-1 w-56 rounded-md border border-gray-200 bg-white shadow-lg">
|
| 817 |
<button onClick={(e)=>{ e.preventDefault(); const m=document.getElementById('rev-download-menu'); if(m) m.classList.add('hidden'); downloadWithTrackChanges(); }} className="block w-full text-left px-3 py-2 text-sm hover:bg-gray-50">Track Changes</button>
|
| 818 |
<button onClick={(e)=>{ e.preventDefault(); const m=document.getElementById('rev-download-menu'); if(m) m.classList.add('hidden'); compareNow(); }} className="block w-full text-left px-3 py-2 text-sm hover:bg-gray-50">Inline Diff (Preview)</button>
|
| 819 |
</div>
|
client/src/pages/Toolkit.tsx
CHANGED
|
@@ -630,7 +630,7 @@ const Toolkit: React.FC = () => {
|
|
| 630 |
</div>
|
| 631 |
</div>
|
| 632 |
<div className="border rounded-lg overflow-hidden">
|
| 633 |
-
<div className="mx-auto w-full max-w-
|
| 634 |
<Refinity />
|
| 635 |
</div>
|
| 636 |
</div>
|
|
|
|
| 630 |
</div>
|
| 631 |
</div>
|
| 632 |
<div className="border rounded-lg overflow-hidden">
|
| 633 |
+
<div className="mx-auto w-full max-w-5xl">
|
| 634 |
<Refinity />
|
| 635 |
</div>
|
| 636 |
</div>
|