Upload folder using huggingface_hub
Browse files
client/src/components/Refinity.tsx
CHANGED
|
@@ -434,39 +434,20 @@ const Refinity: React.FC = () => {
|
|
| 434 |
<div className="text-gray-800 text-sm mb-2">Original: {v.originalAuthor}</div>
|
| 435 |
<div className="text-gray-600 text-xs mb-3">Revised by: {v.revisedBy ? `${v.revisedBy} (v${v.versionNumber})` : `— (v${v.versionNumber})`}</div>
|
| 436 |
<div className={`text-gray-900 whitespace-pre-wrap break-words leading-relaxed flex-1 overflow-hidden pr-1`}>{snippet}</div>
|
| 437 |
-
{isCenter && (
|
| 438 |
<div className="mt-4 flex gap-3">
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
position: 'relative'
|
| 452 |
-
}}
|
| 453 |
-
>
|
| 454 |
-
Revise
|
| 455 |
-
</div>
|
| 456 |
-
) : (
|
| 457 |
-
<button
|
| 458 |
-
type="button"
|
| 459 |
-
onClick={(e) => {
|
| 460 |
-
e.preventDefault();
|
| 461 |
-
e.stopPropagation();
|
| 462 |
-
console.log('Revise clicked for version:', v.versionNumber, 'id:', v.id);
|
| 463 |
-
selectManual(v.id);
|
| 464 |
-
}}
|
| 465 |
-
className="inline-flex items-center justify-center gap-2 px-3 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 active:translate-y-0.5 transition-all duration-200"
|
| 466 |
-
>
|
| 467 |
-
Revise
|
| 468 |
-
</button>
|
| 469 |
-
)}
|
| 470 |
<button
|
| 471 |
type="button"
|
| 472 |
onClick={() => { setCompareUIOpen(true); if (!compareA) setCompareA(v.id); }}
|
|
@@ -481,6 +462,23 @@ const Refinity: React.FC = () => {
|
|
| 481 |
);
|
| 482 |
})}
|
| 483 |
</SwiperRoot>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
{compareUIOpen && (
|
| 485 |
<div className="mt-4 p-3 rounded-2xl border border-gray-200 bg-white/60 backdrop-blur">
|
| 486 |
<div className="flex flex-col md:flex-row gap-3 md:items-end">
|
|
@@ -671,6 +669,15 @@ const EditorPane: React.FC<{ source: string; initialTranslation: string; onBack:
|
|
| 671 |
const [saving, setSaving] = React.useState(false);
|
| 672 |
const [diffHtml, setDiffHtml] = React.useState<string>('');
|
| 673 |
const [showDiff, setShowDiff] = React.useState<boolean>(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 674 |
|
| 675 |
const save = async ()=>{
|
| 676 |
setSaving(true);
|
|
@@ -722,7 +729,7 @@ const EditorPane: React.FC<{ source: string; initialTranslation: string; onBack:
|
|
| 722 |
<div className="mb-2 text-gray-700 text-sm">Source</div>
|
| 723 |
<div className="relative rounded-lg">
|
| 724 |
<div className="absolute inset-0 rounded-lg bg-gradient-to-r from-indigo-200/45 via-indigo-100/40 to-indigo-300/45" />
|
| 725 |
-
<div className="relative rounded-lg bg-white/10 backdrop-blur-md ring-1 ring-inset ring-white/30 shadow-[inset_0_0.5px_0_rgba(255,255,255,0.5),inset_0_-1px_1.5px_rgba(0,0,0,0.12)] p-4 min-h-[420px] whitespace-pre-wrap text-gray-900">
|
| 726 |
{source}
|
| 727 |
</div>
|
| 728 |
</div>
|
|
@@ -734,8 +741,8 @@ const EditorPane: React.FC<{ source: string; initialTranslation: string; onBack:
|
|
| 734 |
onChange={(e)=>setText(e.target.value)}
|
| 735 |
className="relative z-10 w-full px-4 py-3 border border-ui-border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white resize-y"
|
| 736 |
style={{
|
| 737 |
-
minHeight:
|
| 738 |
-
height:
|
| 739 |
resize: 'vertical'
|
| 740 |
}}
|
| 741 |
/>
|
|
|
|
| 434 |
<div className="text-gray-800 text-sm mb-2">Original: {v.originalAuthor}</div>
|
| 435 |
<div className="text-gray-600 text-xs mb-3">Revised by: {v.revisedBy ? `${v.revisedBy} (v${v.versionNumber})` : `— (v${v.versionNumber})`}</div>
|
| 436 |
<div className={`text-gray-900 whitespace-pre-wrap break-words leading-relaxed flex-1 overflow-hidden pr-1`}>{snippet}</div>
|
| 437 |
+
{isCenter && v.versionNumber !== 2 && (
|
| 438 |
<div className="mt-4 flex gap-3">
|
| 439 |
+
<button
|
| 440 |
+
type="button"
|
| 441 |
+
onClick={(e) => {
|
| 442 |
+
e.preventDefault();
|
| 443 |
+
e.stopPropagation();
|
| 444 |
+
console.log('Revise clicked for version:', v.versionNumber, 'id:', v.id);
|
| 445 |
+
selectManual(v.id);
|
| 446 |
+
}}
|
| 447 |
+
className="inline-flex items-center justify-center gap-2 px-3 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 active:translate-y-0.5 transition-all duration-200"
|
| 448 |
+
>
|
| 449 |
+
Revise
|
| 450 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
<button
|
| 452 |
type="button"
|
| 453 |
onClick={() => { setCompareUIOpen(true); if (!compareA) setCompareA(v.id); }}
|
|
|
|
| 462 |
);
|
| 463 |
})}
|
| 464 |
</SwiperRoot>
|
| 465 |
+
|
| 466 |
+
{/* External V2 Revise Button - Only shows when v2 is centered */}
|
| 467 |
+
{taskVersions[flowIndex]?.versionNumber === 2 && (
|
| 468 |
+
<div
|
| 469 |
+
onClick={() => {
|
| 470 |
+
console.log('External V2 Revise clicked, id:', taskVersions[flowIndex].id);
|
| 471 |
+
selectManual(taskVersions[flowIndex].id);
|
| 472 |
+
}}
|
| 473 |
+
className="absolute bottom-6 left-1/2 transform -translate-x-1/2 z-[100]"
|
| 474 |
+
style={{ pointerEvents: 'auto' }}
|
| 475 |
+
>
|
| 476 |
+
<div className="inline-flex items-center justify-center gap-2 px-3 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 active:translate-y-0.5 transition-all duration-200 cursor-pointer hover:bg-indigo-700/70">
|
| 477 |
+
Revise
|
| 478 |
+
</div>
|
| 479 |
+
</div>
|
| 480 |
+
)}
|
| 481 |
+
|
| 482 |
{compareUIOpen && (
|
| 483 |
<div className="mt-4 p-3 rounded-2xl border border-gray-200 bg-white/60 backdrop-blur">
|
| 484 |
<div className="flex flex-col md:flex-row gap-3 md:items-end">
|
|
|
|
| 669 |
const [saving, setSaving] = React.useState(false);
|
| 670 |
const [diffHtml, setDiffHtml] = React.useState<string>('');
|
| 671 |
const [showDiff, setShowDiff] = React.useState<boolean>(false);
|
| 672 |
+
const sourceRef = React.useRef<HTMLDivElement>(null);
|
| 673 |
+
const [textareaHeight, setTextareaHeight] = React.useState('420px');
|
| 674 |
+
|
| 675 |
+
React.useEffect(() => {
|
| 676 |
+
if (sourceRef.current) {
|
| 677 |
+
const height = sourceRef.current.offsetHeight;
|
| 678 |
+
setTextareaHeight(`${height}px`);
|
| 679 |
+
}
|
| 680 |
+
}, [source]);
|
| 681 |
|
| 682 |
const save = async ()=>{
|
| 683 |
setSaving(true);
|
|
|
|
| 729 |
<div className="mb-2 text-gray-700 text-sm">Source</div>
|
| 730 |
<div className="relative rounded-lg">
|
| 731 |
<div className="absolute inset-0 rounded-lg bg-gradient-to-r from-indigo-200/45 via-indigo-100/40 to-indigo-300/45" />
|
| 732 |
+
<div ref={sourceRef} className="relative rounded-lg bg-white/10 backdrop-blur-md ring-1 ring-inset ring-white/30 shadow-[inset_0_0.5px_0_rgba(255,255,255,0.5),inset_0_-1px_1.5px_rgba(0,0,0,0.12)] p-4 min-h-[420px] whitespace-pre-wrap text-gray-900">
|
| 733 |
{source}
|
| 734 |
</div>
|
| 735 |
</div>
|
|
|
|
| 741 |
onChange={(e)=>setText(e.target.value)}
|
| 742 |
className="relative z-10 w-full px-4 py-3 border border-ui-border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white resize-y"
|
| 743 |
style={{
|
| 744 |
+
minHeight: textareaHeight,
|
| 745 |
+
height: textareaHeight,
|
| 746 |
resize: 'vertical'
|
| 747 |
}}
|
| 748 |
/>
|