Commit ·
452be5a
1
Parent(s): e735501
Fix UX: Remove JSON editor and update fallback alert text
Browse files
frontend/src/components/workflow/VerifyStep.jsx
CHANGED
|
@@ -19,23 +19,6 @@ export default function VerifyStep({
|
|
| 19 |
isArabic
|
| 20 |
}) {
|
| 21 |
const [markupImage, setMarkupImage] = React.useState(null);
|
| 22 |
-
const [showJsonEditor, setShowJsonEditor] = React.useState(false);
|
| 23 |
-
const [jsonInput, setJsonInput] = React.useState('');
|
| 24 |
-
|
| 25 |
-
const handleOpenJsonEditor = () => {
|
| 26 |
-
setJsonInput(JSON.stringify(confirmedData.schedules || {}, null, 2));
|
| 27 |
-
setShowJsonEditor(true);
|
| 28 |
-
};
|
| 29 |
-
|
| 30 |
-
const handleSaveJsonEditor = () => {
|
| 31 |
-
try {
|
| 32 |
-
const parsed = JSON.parse(jsonInput);
|
| 33 |
-
updateConfirmedField('schedules', parsed);
|
| 34 |
-
setShowJsonEditor(false);
|
| 35 |
-
} catch (err) {
|
| 36 |
-
alert(isArabic ? 'صيغة JSON غير صحيحة.' : 'Invalid JSON format.');
|
| 37 |
-
}
|
| 38 |
-
};
|
| 39 |
|
| 40 |
if (currentStep === 4) {
|
| 41 |
return (
|
|
@@ -89,12 +72,12 @@ export default function VerifyStep({
|
|
| 89 |
{extractionResults && Object.values(extractionResults).filter(res => res._ok === false).length > 0 && (
|
| 90 |
<div style={{ backgroundColor: '#fff1f2', borderLeft: '4px solid #e11d48', padding: '15px', marginBottom: '20px', borderRadius: '4px', boxShadow: 'var(--shadow-sm)' }}>
|
| 91 |
<h4 style={{ color: '#be123c', fontSize: '1rem', fontWeight: 700, marginBottom: '10px', display: 'flex', alignItems: 'center', gap: '8px' }}>
|
| 92 |
-
🚨 {isArabic ? 'تنبيه: ف
|
| 93 |
</h4>
|
| 94 |
<p style={{ margin: '0 0 10px 0', color: '#9f1239', fontSize: '0.9rem' }}>
|
| 95 |
{isArabic
|
| 96 |
-
? 'لم يتمكن الذكاء الاصطناعي من قراءة المستندات التالية بوضوح. ي
|
| 97 |
-
: 'The AI could not clearly read the following documents.
|
| 98 |
</p>
|
| 99 |
<ul style={{ margin: 0, paddingLeft: '20px', color: '#881337', fontSize: '0.9rem', fontWeight: 500 }}>
|
| 100 |
{Object.values(extractionResults).filter(res => res._ok === false).map((res, i) => (
|
|
@@ -299,47 +282,6 @@ export default function VerifyStep({
|
|
| 299 |
</div>
|
| 300 |
</div>
|
| 301 |
|
| 302 |
-
{/* Advanced JSON Editor Button */}
|
| 303 |
-
<div style={{ marginTop: '10px' }}>
|
| 304 |
-
<button
|
| 305 |
-
type="button"
|
| 306 |
-
onClick={handleOpenJsonEditor}
|
| 307 |
-
style={{ background: 'transparent', color: '#3b82f6', border: '1px solid #3b82f6', padding: '8px 16px', borderRadius: '6px', fontSize: '0.9rem', cursor: 'pointer', fontWeight: 600 }}
|
| 308 |
-
>
|
| 309 |
-
⚙️ {isArabic ? 'متقدم: تعديل جداول القواعد والأعمدة يدوياً (JSON)' : 'Advanced: Edit Schedules Data (JSON)'}
|
| 310 |
-
</button>
|
| 311 |
-
</div>
|
| 312 |
-
|
| 313 |
-
{/* JSON Editor Modal */}
|
| 314 |
-
{showJsonEditor && (
|
| 315 |
-
<div style={{ position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, backgroundColor: 'rgba(0,0,0,0.6)', zIndex: 9999, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '20px' }}>
|
| 316 |
-
<div style={{ background: 'var(--bg-primary)', padding: '25px', borderRadius: '12px', width: '100%', maxWidth: '700px', boxShadow: '0 10px 25px rgba(0,0,0,0.3)' }}>
|
| 317 |
-
<h3 style={{ marginTop: 0, marginBottom: '15px', display: 'flex', justifyContent: 'space-between' }}>
|
| 318 |
-
<span>{isArabic ? 'محرر بيانات الجداول' : 'Schedules Data Editor'}</span>
|
| 319 |
-
<button type="button" onClick={() => setShowJsonEditor(false)} style={{ background: 'none', border: 'none', fontSize: '1.2rem', cursor: 'pointer', color: 'var(--text-secondary)' }}>×</button>
|
| 320 |
-
</h3>
|
| 321 |
-
<p style={{ fontSize: '0.85rem', color: 'var(--text-secondary)', marginBottom: '15px' }}>
|
| 322 |
-
{isArabic
|
| 323 |
-
? 'قم بتعديل المصفوفات المستخرجة للقواعد، والأعمدة، والميد مباشرة هنا. تأكد من صحة صيغة JSON.'
|
| 324 |
-
: 'Modify the extracted arrays for footings, columns, and beams directly here. Ensure valid JSON.'}
|
| 325 |
-
</p>
|
| 326 |
-
<textarea
|
| 327 |
-
value={jsonInput}
|
| 328 |
-
onChange={(e) => setJsonInput(e.target.value)}
|
| 329 |
-
style={{ width: '100%', height: '300px', fontFamily: 'monospace', fontSize: '0.9rem', padding: '10px', borderRadius: '6px', border: '1px solid var(--border-color)', backgroundColor: '#1e293b', color: '#e2e8f0' }}
|
| 330 |
-
/>
|
| 331 |
-
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: '10px', marginTop: '20px' }}>
|
| 332 |
-
<button type="button" onClick={() => setShowJsonEditor(false)} className="btn" style={{ padding: '8px 16px', background: 'transparent', border: '1px solid var(--border-color)' }}>
|
| 333 |
-
{isArabic ? 'إلغاء' : 'Cancel'}
|
| 334 |
-
</button>
|
| 335 |
-
<button type="button" onClick={handleSaveJsonEditor} className="btn btn-primary" style={{ padding: '8px 16px' }}>
|
| 336 |
-
{isArabic ? 'حفظ التعديلات' : 'Save Changes'}
|
| 337 |
-
</button>
|
| 338 |
-
</div>
|
| 339 |
-
</div>
|
| 340 |
-
</div>
|
| 341 |
-
)}
|
| 342 |
-
|
| 343 |
{/* Engineering Assumptions Section */}
|
| 344 |
<div style={{ marginTop: '20px', borderTop: '1px solid #e5e7eb', paddingTop: '20px' }}>
|
| 345 |
<h4 style={{ fontSize: '1rem', fontWeight: 600, marginBottom: '12px', display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
|
|
| 19 |
isArabic
|
| 20 |
}) {
|
| 21 |
const [markupImage, setMarkupImage] = React.useState(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
if (currentStep === 4) {
|
| 24 |
return (
|
|
|
|
| 72 |
{extractionResults && Object.values(extractionResults).filter(res => res._ok === false).length > 0 && (
|
| 73 |
<div style={{ backgroundColor: '#fff1f2', borderLeft: '4px solid #e11d48', padding: '15px', marginBottom: '20px', borderRadius: '4px', boxShadow: 'var(--shadow-sm)' }}>
|
| 74 |
<h4 style={{ color: '#be123c', fontSize: '1rem', fontWeight: 700, marginBottom: '10px', display: 'flex', alignItems: 'center', gap: '8px' }}>
|
| 75 |
+
🚨 {isArabic ? 'تنبيه: انخفاض جودة بعض المخططات' : 'Alert: Low Clarity on Some Pages'}
|
| 76 |
</h4>
|
| 77 |
<p style={{ margin: '0 0 10px 0', color: '#9f1239', fontSize: '0.9rem' }}>
|
| 78 |
{isArabic
|
| 79 |
+
? 'لم يتمكن الذكاء الاصطناعي من قراءة الجداول من المستندات التالية بوضوح. لا تقلق، سيقوم النظام تلقائياً باستخدام التقديرات الهندسية الافتراضية (Engineering Assumptions) أدناه لتعويض النقص وإتمام الحسابات:'
|
| 80 |
+
: 'The AI could not clearly read the schedules from the following documents. Don\'t worry, the system will automatically fall back to the safe Engineering Assumptions & Defaults below to complete the calculations:'}
|
| 81 |
</p>
|
| 82 |
<ul style={{ margin: 0, paddingLeft: '20px', color: '#881337', fontSize: '0.9rem', fontWeight: 500 }}>
|
| 83 |
{Object.values(extractionResults).filter(res => res._ok === false).map((res, i) => (
|
|
|
|
| 282 |
</div>
|
| 283 |
</div>
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
{/* Engineering Assumptions Section */}
|
| 286 |
<div style={{ marginTop: '20px', borderTop: '1px solid #e5e7eb', paddingTop: '20px' }}>
|
| 287 |
<h4 style={{ fontSize: '1rem', fontWeight: 600, marginBottom: '12px', display: 'flex', alignItems: 'center', gap: '8px' }}>
|