youssefreda9 commited on
Commit
488c84b
·
1 Parent(s): afba67e

audit-v2: Major UI overhaul — 12 improvements - HERO: Fix broken stats HTML, real Arabic errors in mock editor - HERO: Floating card shows actual correction (الصحيحه→الصحيحة) - HERO: Status bar matches shown errors (2 spelling, 1 grammar, 2 punctuation) - CSS: Custom gradient range slider (replaces browser default) - CSS: Toast notification system with animations - CSS: Scroll-to-top button with fade-in on scroll - JS: Toast notifications for copy actions - JS: Scroll-to-top button logic - PRICING: 'إضافة المتصفح'→'تصدير PDF و Word' (real feature) - EDITOR: copyText uses toast instead of button text change

Browse files
Files changed (3) hide show
  1. src/css/components.css +119 -0
  2. src/index.html +51 -10
  3. src/js/editor.js +4 -8
src/css/components.css CHANGED
@@ -2476,3 +2476,122 @@ input[type="range"]::-webkit-slider-thumb {
2476
  }
2477
  }
2478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2476
  }
2477
  }
2478
 
2479
+ /* ── Custom Range Slider ── */
2480
+ input[type="range"] {
2481
+ -webkit-appearance: none;
2482
+ appearance: none;
2483
+ width: 100%;
2484
+ height: 6px;
2485
+ border-radius: 3px;
2486
+ background: var(--color-border);
2487
+ outline: none;
2488
+ cursor: pointer;
2489
+ }
2490
+
2491
+ input[type="range"]::-webkit-slider-thumb {
2492
+ -webkit-appearance: none;
2493
+ appearance: none;
2494
+ width: 20px;
2495
+ height: 20px;
2496
+ border-radius: 50%;
2497
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
2498
+ cursor: pointer;
2499
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
2500
+ transition: transform 0.15s ease;
2501
+ }
2502
+
2503
+ input[type="range"]::-webkit-slider-thumb:hover {
2504
+ transform: scale(1.2);
2505
+ }
2506
+
2507
+ input[type="range"]::-moz-range-thumb {
2508
+ width: 20px;
2509
+ height: 20px;
2510
+ border-radius: 50%;
2511
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
2512
+ cursor: pointer;
2513
+ border: none;
2514
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
2515
+ }
2516
+
2517
+ /* ── Toast Notifications ── */
2518
+ .toast-container {
2519
+ position: fixed;
2520
+ bottom: 24px;
2521
+ left: 50%;
2522
+ transform: translateX(-50%);
2523
+ z-index: 10000;
2524
+ display: flex;
2525
+ flex-direction: column;
2526
+ gap: 8px;
2527
+ align-items: center;
2528
+ pointer-events: none;
2529
+ }
2530
+
2531
+ .toast {
2532
+ padding: 12px 24px;
2533
+ border-radius: 12px;
2534
+ background: var(--color-surface);
2535
+ color: var(--color-text-primary);
2536
+ border: 1px solid var(--color-border);
2537
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
2538
+ font-size: var(--font-size-sm);
2539
+ font-weight: var(--font-weight-semibold);
2540
+ font-family: inherit;
2541
+ display: flex;
2542
+ align-items: center;
2543
+ gap: 8px;
2544
+ pointer-events: auto;
2545
+ animation: toast-in 0.3s ease forwards;
2546
+ }
2547
+
2548
+ .toast.toast-out {
2549
+ animation: toast-out 0.25s ease forwards;
2550
+ }
2551
+
2552
+ .toast--success { border-color: rgba(34, 197, 94, 0.4); }
2553
+ .toast--error { border-color: rgba(239, 68, 68, 0.4); }
2554
+
2555
+ @keyframes toast-in {
2556
+ from { opacity: 0; transform: translateY(16px); }
2557
+ to { opacity: 1; transform: translateY(0); }
2558
+ }
2559
+
2560
+ @keyframes toast-out {
2561
+ from { opacity: 1; transform: translateY(0); }
2562
+ to { opacity: 0; transform: translateY(16px); }
2563
+ }
2564
+
2565
+ /* ── Scroll to Top ── */
2566
+ .scroll-top-btn {
2567
+ position: fixed;
2568
+ bottom: 24px;
2569
+ left: 24px;
2570
+ width: 44px;
2571
+ height: 44px;
2572
+ border-radius: 50%;
2573
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
2574
+ color: white;
2575
+ border: none;
2576
+ cursor: pointer;
2577
+ display: flex;
2578
+ align-items: center;
2579
+ justify-content: center;
2580
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
2581
+ opacity: 0;
2582
+ transform: translateY(16px);
2583
+ transition: opacity 0.3s ease, transform 0.3s ease;
2584
+ z-index: 100;
2585
+ pointer-events: none;
2586
+ }
2587
+
2588
+ .scroll-top-btn.visible {
2589
+ opacity: 1;
2590
+ transform: translateY(0);
2591
+ pointer-events: auto;
2592
+ }
2593
+
2594
+ .scroll-top-btn:hover {
2595
+ transform: translateY(-2px);
2596
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
2597
+ }
src/index.html CHANGED
@@ -168,20 +168,28 @@
168
  <div class="flex items-center gap-8 justify-center lg:justify-start">
169
  <div class="text-center">
170
  <div class="text-3xl font-bold text-gradient">
 
 
 
 
 
 
 
 
171
  <div class="text-3xl font-bold text-gradient">
172
- ٩٩٪
173
  </div>
174
  <div class="text-sm mt-1" style="color: var(--text-secondary);">
175
- دقة التصحيح
176
  </div>
177
  </div>
178
  <div class="w-px h-12" style="background: rgba(255, 255, 255, 0.2);"></div>
179
  <div class="text-center">
180
  <div class="text-3xl font-bold text-gradient">
181
- +٥٠ ألف
182
  </div>
183
  <div class="text-sm mt-1" style="color: var(--text-secondary);">
184
- مستخدم نشط
185
  </div>
186
  </div>
187
  </div>
@@ -197,14 +205,14 @@
197
  <div class="w-20"></div>
198
  </div><!-- Mock Editor Content -->
199
  <div class="p-8 editor-content text-right text-lg" dir="rtl" style="background: var(--surface-color); color: var(--text-color); min-height: 300px;">
200
- <p class="mb-4">مرحباً بكم في <span class="spelling-error">محرر بيان</span> للكتابة العربية<span class="punctuation-suggestion">.</span></p>
201
- <p class="mb-4">نحن <span class="grammar-error">نساعدك</span> على كتابة نصوص عربية صحيحة وواضحة بفضل الذكاء الاصطناعي المتقدم<span class="punctuation-suggestion">.</span></p>
202
  <p>جرّب المحرر الآن وشاهد كيف يمكن أن تصبح كتابتك أفضل!</p>
203
  </div><!-- Mock Stats Bar -->
204
  <div class="flex items-center justify-between p-4 border-t" style="border-color: rgba(255, 255, 255, 0.1);">
205
  <div class="flex items-center gap-6">
206
  <div class="flex items-center gap-2">
207
- <div class="w-3 h-3 rounded-full" style="background: #ef4444;"></div><span class="text-sm" style="color: var(--text-secondary);">١ إملائي</span>
208
  </div>
209
  <div class="flex items-center gap-2">
210
  <div class="w-3 h-3 rounded-full" style="background: #fbbf24;"></div><span class="text-sm" style="color: var(--text-secondary);">١ نحوي</span>
@@ -213,10 +221,9 @@
213
  <div class="w-3 h-3 rounded-full" style="background: #22c55e;"></div><span class="text-sm" style="color: var(--text-secondary);">٢ ترقيم</span>
214
  </div>
215
  </div>
216
- <div class="flex items-center gap-2"><span class="text-2xl font-bold text-gradient">٩٢</span> <span class="text-sm" style="color: var(--text-secondary);">التقييم</span>
217
  </div>
218
  </div>
219
- </div><!-- Floating Suggestion Card -->
220
  <div class="absolute -bottom-6 -left-6 p-4 rounded-2xl shadow-xl animate-fade-in" style="background: var(--surface-color); border: 1px solid rgba(34, 197, 94, 0.3); max-width: 280px;">
221
  <div class="flex items-start gap-3">
222
  <div class="w-10 h-10 rounded-xl flex items-center justify-center" style="background: rgba(34, 197, 94, 0.15);"><span style="color: #22c55e; font-size: 20px;">✓</span>
@@ -808,7 +815,7 @@
808
  </svg><span class="text-base">تلخيص النصوص بالذكاء الاصطناعي</span></li>
809
  <li class="flex items-center gap-3">
810
  <svg class="w-5 h-5" style="color: #22c55e;" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
811
- </svg><span class="text-base">إضافة المتصفح</span></li>
812
  </ul><button onclick="showPage('editor')" class="w-full py-4 rounded-2xl text-lg font-bold text-white gradient-accent transition-all hover:scale-105 hover:shadow-2xl"> الترقية للاحت��افي </button>
813
  </div><!-- Enterprise Plan -->
814
  <div class="p-8 rounded-3xl transition-all hover:scale-105" style="background: var(--surface-color); border: 1px solid rgba(255, 255, 255, 0.08);">
@@ -861,8 +868,41 @@
861
  </div>
862
  </div>
863
  </footer>
 
 
 
 
 
 
864
  </div>
865
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
866
  // Default configuration
867
  const defaultConfig = {
868
  brand_name: 'بيان',
@@ -1028,6 +1068,7 @@
1028
  if (btn) {
1029
  const originalText = btn.textContent;
1030
  btn.textContent = 'تم النسخ!';
 
1031
  setTimeout(() => btn.textContent = originalText, 2000);
1032
  }
1033
  }).catch(() => {
 
168
  <div class="flex items-center gap-8 justify-center lg:justify-start">
169
  <div class="text-center">
170
  <div class="text-3xl font-bold text-gradient">
171
+ ٣ أنواع
172
+ </div>
173
+ <div class="text-sm mt-1" style="color: var(--text-secondary);">
174
+ تصحيح ذكي
175
+ </div>
176
+ </div>
177
+ <div class="w-px h-12" style="background: rgba(255, 255, 255, 0.2);"></div>
178
+ <div class="text-center">
179
  <div class="text-3xl font-bold text-gradient">
180
+ فوري
181
  </div>
182
  <div class="text-sm mt-1" style="color: var(--text-secondary);">
183
+ تحليل أثناء الكتابة
184
  </div>
185
  </div>
186
  <div class="w-px h-12" style="background: rgba(255, 255, 255, 0.2);"></div>
187
  <div class="text-center">
188
  <div class="text-3xl font-bold text-gradient">
189
+ مجاني
190
  </div>
191
  <div class="text-sm mt-1" style="color: var(--text-secondary);">
192
+ بدون تسجيل
193
  </div>
194
  </div>
195
  </div>
 
205
  <div class="w-20"></div>
206
  </div><!-- Mock Editor Content -->
207
  <div class="p-8 editor-content text-right text-lg" dir="rtl" style="background: var(--surface-color); color: var(--text-color); min-height: 300px;">
208
+ <p class="mb-4">الكتابه <span class="spelling-error">الصحيحه</span> مهمة جداً في التواصل الفعّال<span class="punctuation-suggestion">.</span></p>
209
+ <p class="mb-4">الطلاب <span class="grammar-error">ذهبوا</span> <span class="spelling-error">الى</span> المدرسة صباحاً<span class="punctuation-suggestion">.</span></p>
210
  <p>جرّب المحرر الآن وشاهد كيف يمكن أن تصبح كتابتك أفضل!</p>
211
  </div><!-- Mock Stats Bar -->
212
  <div class="flex items-center justify-between p-4 border-t" style="border-color: rgba(255, 255, 255, 0.1);">
213
  <div class="flex items-center gap-6">
214
  <div class="flex items-center gap-2">
215
+ <div class="w-3 h-3 rounded-full" style="background: #ef4444;"></div><span class="text-sm" style="color: var(--text-secondary);">٢ إملائي</span>
216
  </div>
217
  <div class="flex items-center gap-2">
218
  <div class="w-3 h-3 rounded-full" style="background: #fbbf24;"></div><span class="text-sm" style="color: var(--text-secondary);">١ نحوي</span>
 
221
  <div class="w-3 h-3 rounded-full" style="background: #22c55e;"></div><span class="text-sm" style="color: var(--text-secondary);">٢ ترقيم</span>
222
  </div>
223
  </div>
224
+ <div class="flex items-center gap-2"><span class="text-2xl font-bold text-gradient">٨٥</span> <span class="text-sm" style="color: var(--text-secondary);">التقييم</span>
225
  </div>
226
  </div>
 
227
  <div class="absolute -bottom-6 -left-6 p-4 rounded-2xl shadow-xl animate-fade-in" style="background: var(--surface-color); border: 1px solid rgba(34, 197, 94, 0.3); max-width: 280px;">
228
  <div class="flex items-start gap-3">
229
  <div class="w-10 h-10 rounded-xl flex items-center justify-center" style="background: rgba(34, 197, 94, 0.15);"><span style="color: #22c55e; font-size: 20px;">✓</span>
 
815
  </svg><span class="text-base">تلخيص النصوص بالذكاء الاصطناعي</span></li>
816
  <li class="flex items-center gap-3">
817
  <svg class="w-5 h-5" style="color: #22c55e;" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
818
+ </svg><span class="text-base">تصدير PDF و Word</span></li>
819
  </ul><button onclick="showPage('editor')" class="w-full py-4 rounded-2xl text-lg font-bold text-white gradient-accent transition-all hover:scale-105 hover:shadow-2xl"> الترقية للاحت��افي </button>
820
  </div><!-- Enterprise Plan -->
821
  <div class="p-8 rounded-3xl transition-all hover:scale-105" style="background: var(--surface-color); border: 1px solid rgba(255, 255, 255, 0.08);">
 
868
  </div>
869
  </div>
870
  </footer>
871
+ <!-- Toast Container -->
872
+ <div id="toast-container" class="toast-container"></div>
873
+ <!-- Scroll to Top -->
874
+ <button id="scroll-top-btn" class="scroll-top-btn" type="button" aria-label="العودة للأعلى">
875
+ <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"/></svg>
876
+ </button>
877
  </div>
878
  <script>
879
+ // Toast notification system
880
+ function showToast(message, type = 'success', duration = 2500) {
881
+ const container = document.getElementById('toast-container');
882
+ if (!container) return;
883
+ const toast = document.createElement('div');
884
+ toast.className = 'toast toast--' + type;
885
+ toast.textContent = message;
886
+ container.appendChild(toast);
887
+ setTimeout(() => {
888
+ toast.classList.add('toast-out');
889
+ setTimeout(() => toast.remove(), 300);
890
+ }, duration);
891
+ }
892
+
893
+ // Scroll to top
894
+ (function() {
895
+ const btn = document.getElementById('scroll-top-btn');
896
+ const scrollContainer = document.querySelector('.h-full.overflow-auto');
897
+ if (!btn || !scrollContainer) return;
898
+ scrollContainer.addEventListener('scroll', () => {
899
+ btn.classList.toggle('visible', scrollContainer.scrollTop > 400);
900
+ });
901
+ btn.addEventListener('click', () => {
902
+ scrollContainer.scrollTo({ top: 0, behavior: 'smooth' });
903
+ });
904
+ })();
905
+
906
  // Default configuration
907
  const defaultConfig = {
908
  brand_name: 'بيان',
 
1068
  if (btn) {
1069
  const originalText = btn.textContent;
1070
  btn.textContent = 'تم النسخ!';
1071
+ if (typeof showToast === 'function') showToast('✓ تم نسخ الملخص');
1072
  setTimeout(() => btn.textContent = originalText, 2000);
1073
  }
1074
  }).catch(() => {
src/js/editor.js CHANGED
@@ -504,21 +504,17 @@ function loadDocumentText(text, options = {}) {
504
 
505
  function copyText() {
506
  const text = getEditorText();
507
- navigator.clipboard.writeText(text).catch(() => {
 
 
508
  const temp = document.createElement('textarea');
509
  temp.value = text;
510
  document.body.appendChild(temp);
511
  temp.select();
512
  document.execCommand('copy');
513
  document.body.removeChild(temp);
 
514
  });
515
-
516
- const btn = event?.target;
517
- if (btn) {
518
- const originalText = btn.textContent;
519
- btn.textContent = 'تم النسخ!';
520
- setTimeout(() => { btn.textContent = originalText; }, 2000);
521
- }
522
  }
523
 
524
  if (typeof module !== 'undefined' && module.exports) {
 
504
 
505
  function copyText() {
506
  const text = getEditorText();
507
+ navigator.clipboard.writeText(text).then(() => {
508
+ if (typeof showToast === 'function') showToast('✓ تم نسخ النص');
509
+ }).catch(() => {
510
  const temp = document.createElement('textarea');
511
  temp.value = text;
512
  document.body.appendChild(temp);
513
  temp.select();
514
  document.execCommand('copy');
515
  document.body.removeChild(temp);
516
+ if (typeof showToast === 'function') showToast('✓ تم نسخ النص');
517
  });
 
 
 
 
 
 
 
518
  }
519
 
520
  if (typeof module !== 'undefined' && module.exports) {