linguabot commited on
Commit
8dca361
·
verified ·
1 Parent(s): df9dce1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/components/Refinity.tsx +26 -25
client/src/components/Refinity.tsx CHANGED
@@ -391,33 +391,34 @@ const Refinity: React.FC = () => {
391
  </div>
392
  </div>
393
 
394
- {/* Input Tabs */}
395
- <div className="mb-4">
396
- <div className="inline-flex rounded-2xl border border-gray-200 overflow-hidden">
397
- <button onClick={()=>setInputTab('paste')} className={`px-3 py-1.5 text-sm ${inputTab==='paste' ? 'bg-white text-gray-900' : 'bg-gray-100 text-gray-600'}`}>Paste Text</button>
398
- <button onClick={()=>setInputTab('upload')} className={`px-3 py-1.5 text-sm ${inputTab==='upload' ? 'bg-white text-gray-900' : 'bg-gray-100 text-gray-600'}`}>Upload Document</button>
 
 
399
  </div>
400
- </div>
401
-
402
- <div className="mb-6" style={{ minHeight: '210px' }}>
403
- {inputTab==='paste' ? (
404
- <div>
405
- <textarea value={pastedTranslation} onChange={(e)=>setPastedTranslation(e.target.value)} rows={4} className="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" placeholder="Paste translation text here…" />
406
- <div className="mt-2">
407
- <button onClick={submitPastedTranslation} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-3 py-1.5 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-slate-800 hover:bg-slate-900 active:translate-y-0.5 transition-all duration-200">Use pasted text</button>
408
  </div>
409
- </div>
410
- ) : (
411
- <div>
412
- <input ref={fileInputRef} type="file" accept=".doc,.docx" onChange={(e)=>{ const f=e.target.files?.[0]; if(f) uploadDocx(f); if(fileInputRef.current) fileInputRef.current.value=''; }} className="hidden" />
413
- <button type="button" onClick={()=>fileInputRef.current?.click()} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-3 py-1.5 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-slate-800 hover:bg-slate-900 active:translate-y-0.5 transition-all duration-200">
414
- <div className="pointer-events-none absolute inset-0 rounded-2xl opacity-60 [background:linear-gradient(to_bottom,rgba(255,255,255,0.35),rgba(255,255,255,0)_28%),linear-gradient(to_right,rgba(255,255,255,0.35),rgba(255,255,255,0)_28%)]" />
415
- <div className="pointer-events-none absolute inset-0 rounded-2xl bg-gradient-to-tr from-white/30 via-white/10 to-transparent opacity-50" />
416
- <span className="relative z-10">Choose file</span>
417
- </button>
418
- {uploading && <span className="ml-3 text-sm text-gray-600">Uploading…</span>}
419
- </div>
420
- )}
421
  </div>
422
 
423
  <div className="mt-8 flex gap-3 items-center flex-wrap">
 
391
  </div>
392
  </div>
393
 
394
+ {/* Unified input area: tabs + content in one container */}
395
+ <div className="mb-6 rounded-2xl border border-gray-200 bg-white/60 backdrop-blur">
396
+ <div className="px-3 py-2 border-b border-gray-200">
397
+ <div className="inline-flex rounded-xl overflow-hidden ring-1 ring-gray-200">
398
+ <button onClick={()=>setInputTab('paste')} className={`px-3 py-1.5 text-sm ${inputTab==='paste' ? 'bg-white text-gray-900' : 'bg-gray-100 text-gray-600'}`}>Paste Text</button>
399
+ <button onClick={()=>setInputTab('upload')} className={`px-3 py-1.5 text-sm ${inputTab==='upload' ? 'bg-white text-gray-900' : 'bg-gray-100 text-gray-600'}`}>Upload Document</button>
400
+ </div>
401
  </div>
402
+ <div className="p-4" style={{ minHeight: '210px' }}>
403
+ {inputTab==='paste' ? (
404
+ <div>
405
+ <textarea value={pastedTranslation} onChange={(e)=>setPastedTranslation(e.target.value)} rows={4} className="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" placeholder="Paste translation text here…" />
406
+ <div className="mt-2">
407
+ <button onClick={submitPastedTranslation} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-3 py-1.5 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-slate-800 hover:bg-slate-900 active:translate-y-0.5 transition-all duration-200">Use pasted text</button>
408
+ </div>
 
409
  </div>
410
+ ) : (
411
+ <div>
412
+ <input ref={fileInputRef} type="file" accept=".doc,.docx" onChange={(e)=>{ const f=e.target.files?.[0]; if(f) uploadDocx(f); if(fileInputRef.current) fileInputRef.current.value=''; }} className="hidden" />
413
+ <button type="button" onClick={()=>fileInputRef.current?.click()} className="relative overflow-hidden inline-flex items-center justify-center gap-2 px-3 py-1.5 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-slate-800 hover:bg-slate-900 active:translate-y-0.5 transition-all duration-200">
414
+ <div className="pointer-events-none absolute inset-0 rounded-2xl opacity-60 [background:linear-gradient(to_bottom,rgba(255,255,255,0.35),rgba(255,255,255,0)_28%),linear-gradient(to_right,rgba(255,255,255,0.35),rgba(255,255,255,0)_28%)]" />
415
+ <div className="pointer-events-none absolute inset-0 rounded-2xl bg-gradient-to-tr from-white/30 via-white/10 to-transparent opacity-50" />
416
+ <span className="relative z-10">Choose file</span>
417
+ </button>
418
+ {uploading && <span className="ml-3 text-sm text-gray-600">Uploading…</span>}
419
+ </div>
420
+ )}
421
+ </div>
422
  </div>
423
 
424
  <div className="mt-8 flex gap-3 items-center flex-wrap">