linguabot commited on
Commit
ea75698
·
verified ·
1 Parent(s): 5a11b0a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/components/Refinity.tsx +13 -15
client/src/components/Refinity.tsx CHANGED
@@ -224,18 +224,7 @@ const Refinity: React.FC = () => {
224
  return Math.min(Math.max(taskVersions.length - 1, 0), flowIndex);
225
  }, [taskVersions, currentVersionId, flowIndex]);
226
 
227
- // Keyboard navigation for cover flow
228
- React.useEffect(() => {
229
- const handler = (e: KeyboardEvent) => {
230
- if (e.key === 'ArrowLeft') {
231
- setFlowIndex(i => Math.max(i - 1, 0));
232
- } else if (e.key === 'ArrowRight') {
233
- setFlowIndex(i => Math.min(i + 1, Math.max(taskVersions.length - 1, 0)));
234
- }
235
- };
236
- window.addEventListener('keydown', handler);
237
- return () => window.removeEventListener('keydown', handler);
238
- }, [taskVersions.length]);
239
 
240
  const uploadDocx = async (file: File) => {
241
  setUploading(true);
@@ -804,7 +793,7 @@ const Refinity: React.FC = () => {
804
  }}
805
  observer
806
  observeParents
807
- grabCursor
808
  coverflowEffect={{ rotate: 0, stretch: 0, depth: 80, modifier: 1, slideShadows: false }}
809
  className="mySwiper !px-4 overflow-visible pb-2"
810
  style={{ height: isFullscreen ? 'calc(100vh - 96px)' : 'min(76vh, calc(100vh - 220px))', minHeight: '340px' }}
@@ -1314,8 +1303,17 @@ const EditorPane: React.FC<{ source: string; initialTranslation: string; onBack:
1314
  const rect = offsetsToClientRect(ov, s, e);
1315
  if (!rect) { setPopover(null); return; }
1316
  const wrect = wrap.getBoundingClientRect();
1317
- setPopover({ left: Math.max(8, rect.right - wrect.left + 8), top: Math.max(8, rect.top - wrect.top - 8), start: s, end: e });
1318
- }, [showAnnotations]);
 
 
 
 
 
 
 
 
 
1319
 
1320
  React.useEffect(() => {
1321
  if (sourceRef.current) {
 
224
  return Math.min(Math.max(taskVersions.length - 1, 0), flowIndex);
225
  }, [taskVersions, currentVersionId, flowIndex]);
226
 
227
+ // Keyboard navigation disabled per request (use arrow buttons only)
 
 
 
 
 
 
 
 
 
 
 
228
 
229
  const uploadDocx = async (file: File) => {
230
  setUploading(true);
 
793
  }}
794
  observer
795
  observeParents
796
+ allowTouchMove={false}
797
  coverflowEffect={{ rotate: 0, stretch: 0, depth: 80, modifier: 1, slideShadows: false }}
798
  className="mySwiper !px-4 overflow-visible pb-2"
799
  style={{ height: isFullscreen ? 'calc(100vh - 96px)' : 'min(76vh, calc(100vh - 220px))', minHeight: '340px' }}
 
1303
  const rect = offsetsToClientRect(ov, s, e);
1304
  if (!rect) { setPopover(null); return; }
1305
  const wrect = wrap.getBoundingClientRect();
1306
+ const btnW = 120, btnH = 30, padding = 6;
1307
+ // Center over the selection; clamp within container
1308
+ let left = rect.left - wrect.left + (rect.width - btnW) / 2;
1309
+ left = Math.max(padding, Math.min(left, wrect.width - btnW - padding));
1310
+ // Prefer above the selection; if not enough space, place below
1311
+ let top = rect.top - wrect.top - btnH - padding;
1312
+ if (top < padding) {
1313
+ top = rect.bottom - wrect.top + padding;
1314
+ }
1315
+ setPopover({ left, top, start: s, end: e });
1316
+ }, []);
1317
 
1318
  React.useEffect(() => {
1319
  if (sourceRef.current) {