ntphuc149 commited on
Commit
182168a
·
verified ·
1 Parent(s): bf1e8ee

Update src/App.js

Browse files
Files changed (1) hide show
  1. src/App.js +81 -55
src/App.js CHANGED
@@ -192,44 +192,12 @@ const HoroscopeApp = () => {
192
  {
193
  id: "overall",
194
  name: "Overall",
195
- icon: (
196
- <svg
197
- width="20"
198
- height="20"
199
- viewBox="0 0 24 24"
200
- fill="none"
201
- stroke="currentColor"
202
- strokeWidth="2"
203
- strokeLinecap="round"
204
- strokeLinejoin="round"
205
- >
206
- <path d="M3 4l18 0" />
207
- <path d="M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10" />
208
- <path d="M12 16l0 4" />
209
- <path d="M9 20l6 0" />
210
- <path d="M8 12l3 -3l2 2l3 -3" />
211
- </svg>
212
- ),
213
  },
214
  {
215
  id: "fortune",
216
  name: "Fortune",
217
- icon: (
218
- <svg
219
- width="20"
220
- height="20"
221
- viewBox="0 0 24 24"
222
- fill="none"
223
- stroke="currentColor"
224
- strokeWidth="2"
225
- strokeLinecap="round"
226
- strokeLinejoin="round"
227
- >
228
- <path d="M6.73 17.018a8 8 0 1 1 10.54 0" />
229
- <path d="M5 19a2 2 0 0 0 2 2h10a2 2 0 1 0 0 -4h-10a2 2 0 0 0 -2 2z" />
230
- <path d="M11 7a3 3 0 0 0 -3 3" />
231
- </svg>
232
- ),
233
  },
234
  {
235
  id: "health",
@@ -357,6 +325,9 @@ const HoroscopeApp = () => {
357
  };
358
 
359
  const getHoroscopeText = () => {
 
 
 
360
  return horoscopeContent[selectedCategory][selectedPeriod];
361
  };
362
 
@@ -379,7 +350,7 @@ const HoroscopeApp = () => {
379
  setIsDarkMode(!isDarkMode);
380
  };
381
 
382
- // Scroll to selected zodiac sign on mount
383
  useEffect(() => {
384
  if (zodiacScrollRef.current) {
385
  const selectedElement = zodiacScrollRef.current.querySelector(
@@ -393,7 +364,12 @@ const HoroscopeApp = () => {
393
  });
394
  }
395
  }
396
- }, []);
 
 
 
 
 
397
 
398
  return (
399
  <div
@@ -428,7 +404,23 @@ const HoroscopeApp = () => {
428
  {/* App Icon - Visible on mobile - Fixed centering */}
429
  <div className="sm:hidden flex-1 flex justify-center">
430
  <div className="inline-flex items-center justify-center w-12 h-12 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full shadow-lg">
431
- <i className="ri-magic-line text-xl text-white"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  </div>
433
  </div>
434
 
@@ -488,7 +480,23 @@ const HoroscopeApp = () => {
488
  {/* App Title - Hidden on mobile */}
489
  <div className="text-center mb-6 md:mb-10 hidden sm:block">
490
  <div className="inline-flex items-center justify-center w-16 h-16 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full mb-4 shadow-lg">
491
- <i className="ri-magic-line text-2xl text-white"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
  </div>
493
  <h1 className="text-4xl font-bold mb-2">Horoscope App</h1>
494
  </div>
@@ -503,12 +511,14 @@ const HoroscopeApp = () => {
503
  <div
504
  key={sign.id}
505
  data-sign={sign.id}
506
- onClick={() => setSelectedSign(sign.id)}
507
  className="flex flex-col items-center cursor-pointer transition-all duration-300 hover:scale-105 flex-shrink-0 py-1"
508
  >
509
  <div
510
- className={`w-20 h-20 md:w-24 md:h-24 rounded-full p-0.5 transition-all ${
511
- selectedSign === sign.id ? "shadow-lg" : ""
 
 
512
  }`}
513
  style={{
514
  background:
@@ -541,7 +551,7 @@ const HoroscopeApp = () => {
541
  ) : (
542
  <ZodiacIcon
543
  sign={sign.id}
544
- size={28}
545
  className="text-gray-600"
546
  />
547
  )}
@@ -555,10 +565,14 @@ const HoroscopeApp = () => {
555
  </div>
556
  </div>
557
  </div>
558
- <p className="text-xs font-medium mt-3 text-center flex items-center justify-center gap-1">
 
 
 
 
559
  <ZodiacIcon
560
  sign={sign.id}
561
- size={16}
562
  className="text-current"
563
  />
564
  {sign.name}
@@ -579,7 +593,7 @@ const HoroscopeApp = () => {
579
  <button
580
  key={period.id}
581
  onClick={() => setSelectedPeriod(period.id)}
582
- className={`px-4 md:px-6 py-2 md:py-3 rounded-full font-medium transition-all text-sm md:text-base ${
583
  selectedPeriod === period.id
584
  ? "bg-blue-400 text-white shadow-md"
585
  : isDarkMode
@@ -588,6 +602,9 @@ const HoroscopeApp = () => {
588
  }`}
589
  >
590
  {period.name}
 
 
 
591
  </button>
592
  ))}
593
  </div>
@@ -669,7 +686,22 @@ const HoroscopeApp = () => {
669
  <div className="flex-1">
670
  <h2 className="text-3xl font-bold text-blue-400 flex items-center gap-2 mb-2">
671
  {getPeriodTitle()}
672
- <i className="ri-pulse-line text-xl"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  </h2>
674
  <div className="flex items-center gap-2">
675
  <ZodiacIcon
@@ -677,19 +709,13 @@ const HoroscopeApp = () => {
677
  size={20}
678
  className="text-current"
679
  />
680
- <span className="font-semibold">{getCurrentSign()?.name}</span>
 
 
681
  </div>
682
  </div>
683
  </div>
684
 
685
- <p
686
- className={`font-medium mb-6 ${
687
- isDarkMode ? "text-gray-300" : "text-gray-600"
688
- }`}
689
- >
690
- {getCurrentSign()?.name} ({getCurrentSign()?.dates})
691
- </p>
692
-
693
  <p className="text-lg leading-relaxed mb-8">{getHoroscopeText()}</p>
694
  </div>
695
 
 
192
  {
193
  id: "overall",
194
  name: "Overall",
195
+ icon: <i class="ri-dashboard-line"></i>,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  },
197
  {
198
  id: "fortune",
199
  name: "Fortune",
200
+ icon: <i class="ri-seedling-line"></i>,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  },
202
  {
203
  id: "health",
 
325
  };
326
 
327
  const getHoroscopeText = () => {
328
+ if (selectedPeriod !== "today") {
329
+ return "Upgrade to Premium to unlock weekly, monthly, and yearly horoscope insights. Get deeper cosmic guidance and detailed predictions for your future.";
330
+ }
331
  return horoscopeContent[selectedCategory][selectedPeriod];
332
  };
333
 
 
350
  setIsDarkMode(!isDarkMode);
351
  };
352
 
353
+ // Scroll to selected zodiac sign on mount and selection change
354
  useEffect(() => {
355
  if (zodiacScrollRef.current) {
356
  const selectedElement = zodiacScrollRef.current.querySelector(
 
364
  });
365
  }
366
  }
367
+ }, [selectedSign]);
368
+
369
+ // Handle zodiac sign selection with auto-center
370
+ const handleSignSelect = (signId) => {
371
+ setSelectedSign(signId);
372
+ };
373
 
374
  return (
375
  <div
 
404
  {/* App Icon - Visible on mobile - Fixed centering */}
405
  <div className="sm:hidden flex-1 flex justify-center">
406
  <div className="inline-flex items-center justify-center w-12 h-12 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full shadow-lg">
407
+ <svg
408
+ xmlns="http://www.w3.org/2000/svg"
409
+ width="24"
410
+ height="24"
411
+ viewBox="0 0 24 24"
412
+ fill="none"
413
+ stroke="currentColor"
414
+ stroke-width="2"
415
+ stroke-linecap="round"
416
+ stroke-linejoin="round"
417
+ class="icon icon-tabler icons-tabler-outline icon-tabler-crystal-ball"
418
+ >
419
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
420
+ <path d="M6.73 17.018a8 8 0 1 1 10.54 0" />
421
+ <path d="M5 19a2 2 0 0 0 2 2h10a2 2 0 1 0 0 -4h-10a2 2 0 0 0 -2 2z" />
422
+ <path d="M11 7a3 3 0 0 0 -3 3" />
423
+ </svg>
424
  </div>
425
  </div>
426
 
 
480
  {/* App Title - Hidden on mobile */}
481
  <div className="text-center mb-6 md:mb-10 hidden sm:block">
482
  <div className="inline-flex items-center justify-center w-16 h-16 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full mb-4 shadow-lg">
483
+ <svg
484
+ xmlns="http://www.w3.org/2000/svg"
485
+ width="24"
486
+ height="24"
487
+ viewBox="0 0 24 24"
488
+ fill="none"
489
+ stroke="currentColor"
490
+ stroke-width="2"
491
+ stroke-linecap="round"
492
+ stroke-linejoin="round"
493
+ class="icon icon-tabler icons-tabler-outline icon-tabler-crystal-ball"
494
+ >
495
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
496
+ <path d="M6.73 17.018a8 8 0 1 1 10.54 0" />
497
+ <path d="M5 19a2 2 0 0 0 2 2h10a2 2 0 1 0 0 -4h-10a2 2 0 0 0 -2 2z" />
498
+ <path d="M11 7a3 3 0 0 0 -3 3" />
499
+ </svg>
500
  </div>
501
  <h1 className="text-4xl font-bold mb-2">Horoscope App</h1>
502
  </div>
 
511
  <div
512
  key={sign.id}
513
  data-sign={sign.id}
514
+ onClick={() => handleSignSelect(sign.id)}
515
  className="flex flex-col items-center cursor-pointer transition-all duration-300 hover:scale-105 flex-shrink-0 py-1"
516
  >
517
  <div
518
+ className={`rounded-full p-0.5 transition-all duration-300 ${
519
+ selectedSign === sign.id
520
+ ? "w-24 h-24 md:w-28 md:h-28 shadow-lg"
521
+ : "w-20 h-20 md:w-24 md:h-24"
522
  }`}
523
  style={{
524
  background:
 
551
  ) : (
552
  <ZodiacIcon
553
  sign={sign.id}
554
+ size={selectedSign === sign.id ? 30 : 28}
555
  className="text-gray-600"
556
  />
557
  )}
 
565
  </div>
566
  </div>
567
  </div>
568
+ <p
569
+ className={`text-xs font-medium mt-3 text-center flex items-center justify-center gap-1 transition-all duration-300 ${
570
+ selectedSign === sign.id ? "font-bold" : ""
571
+ }`}
572
+ >
573
  <ZodiacIcon
574
  sign={sign.id}
575
+ size={selectedSign === sign.id ? 17 : 16}
576
  className="text-current"
577
  />
578
  {sign.name}
 
593
  <button
594
  key={period.id}
595
  onClick={() => setSelectedPeriod(period.id)}
596
+ className={`px-4 md:px-6 py-2 md:py-3 rounded-full font-medium transition-all text-sm md:text-base flex items-center gap-1 ${
597
  selectedPeriod === period.id
598
  ? "bg-blue-400 text-white shadow-md"
599
  : isDarkMode
 
602
  }`}
603
  >
604
  {period.name}
605
+ {period.id !== "today" && (
606
+ <i className="ri-lock-line text-xs opacity-70"></i>
607
+ )}
608
  </button>
609
  ))}
610
  </div>
 
686
  <div className="flex-1">
687
  <h2 className="text-3xl font-bold text-blue-400 flex items-center gap-2 mb-2">
688
  {getPeriodTitle()}
689
+ <svg
690
+ xmlns="http://www.w3.org/2000/svg"
691
+ width="24"
692
+ height="24"
693
+ viewBox="0 0 24 24"
694
+ fill="none"
695
+ stroke="currentColor"
696
+ stroke-width="2"
697
+ stroke-linecap="round"
698
+ stroke-linejoin="round"
699
+ class="icon icon-tabler icons-tabler-outline icon-tabler-trending-up"
700
+ >
701
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
702
+ <path d="M3 17l6 -6l4 4l8 -8" />
703
+ <path d="M14 7l7 0l0 7" />
704
+ </svg>
705
  </h2>
706
  <div className="flex items-center gap-2">
707
  <ZodiacIcon
 
709
  size={20}
710
  className="text-current"
711
  />
712
+ <span className="font-semibold">
713
+ {getCurrentSign()?.name} ({getCurrentSign()?.dates})
714
+ </span>
715
  </div>
716
  </div>
717
  </div>
718
 
 
 
 
 
 
 
 
 
719
  <p className="text-lg leading-relaxed mb-8">{getHoroscopeText()}</p>
720
  </div>
721