@@ -10,6 +10,7 @@ import {
10
10
Typography ,
11
11
Button ,
12
12
IconButton ,
13
+ CircularProgress ,
13
14
} from "@mui/material" ;
14
15
import { Delete , DoneAll , AddReaction } from "@mui/icons-material" ;
15
16
import { useState } from "react" ;
@@ -76,10 +77,6 @@ export default function Home() {
76
77
77
78
const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
78
79
79
- if ( ! tasks && ! reccos ) {
80
- return < div > Loading...</ div > ;
81
- }
82
-
83
80
function cleanString ( str : string ) {
84
81
const stopwords = [
85
82
"schedule" ,
@@ -435,7 +432,7 @@ export default function Home() {
435
432
</ div >
436
433
437
434
< div className = "tw-flex tw-flex-col tw-justify-between tw-w-max" >
438
- { Array . from ( { length : 24 } , ( _ , i ) => i ) . map ( ( hour ) => (
435
+ { Array . from ( { length : 17 } , ( _ , i ) => i + 7 ) . map ( ( hour ) => (
439
436
< div
440
437
key = { hour }
441
438
className = "tw-flex tw-row tw-items-center"
@@ -517,51 +514,54 @@ export default function Home() {
517
514
</ div >
518
515
519
516
< div className = "tw-flex tw-flex-col tw-justify-between tw-w-max" >
520
- { Array . from ( { length : 24 } , ( _ , i ) => i ) . map ( ( hour ) => (
521
- < div
522
- key = { hour }
523
- className = "tw-flex tw-row tw-items-center"
524
- >
525
- < div className = "tw-h-12 tw-flex tw-items-center tw-justify-start tw-w-[70px] tw-text-white" >
526
- { hour } :00
527
- </ div >
528
- < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
529
- { [ "Mon" ] . map ( ( day ) => {
530
- const currentTask = getReccosForTimeSlot (
531
- day ,
532
- hour
533
- ) ;
534
- const shouldDisplayTitle =
535
- currentTask && isReccosStart ( currentTask , hour ) ;
536
-
537
- if ( currentTask ) {
517
+ { Array . from ( { length : 17 } , ( _ , i ) => i + 7 ) . map (
518
+ ( hour ) => (
519
+ < div
520
+ key = { hour }
521
+ className = "tw-flex tw-row tw-items-center"
522
+ >
523
+ < div className = "tw-h-12 tw-flex tw-items-center tw-justify-start tw-w-[70px] tw-text-white" >
524
+ { hour } :00
525
+ </ div >
526
+ < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
527
+ { [ "Mon" ] . map ( ( day ) => {
528
+ const currentTask = getReccosForTimeSlot (
529
+ day ,
530
+ hour
531
+ ) ;
532
+ const shouldDisplayTitle =
533
+ currentTask &&
534
+ isReccosStart ( currentTask , hour ) ;
535
+
536
+ if ( currentTask ) {
537
+ return (
538
+ < div
539
+ className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
540
+ key = { day }
541
+ >
542
+ { /* Content for each hour can be added here */ }
543
+ < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-r-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
544
+ { shouldDisplayTitle && (
545
+ < TaskItem task = { currentTask } />
546
+ ) }
547
+ </ div >
548
+ </ div >
549
+ ) ;
550
+ }
538
551
return (
539
552
< div
540
553
className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
541
554
key = { day }
542
555
>
543
556
{ /* Content for each hour can be added here */ }
544
- < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-r-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
545
- { shouldDisplayTitle && (
546
- < TaskItem task = { currentTask } />
547
- ) }
548
- </ div >
557
+ < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-border-r-2 tw-text-white " > </ div >
549
558
</ div >
550
559
) ;
551
- }
552
- return (
553
- < div
554
- className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
555
- key = { day }
556
- >
557
- { /* Content for each hour can be added here */ }
558
- < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-border-r-2 tw-text-white " > </ div >
559
- </ div >
560
- ) ;
561
- } ) }
560
+ } ) }
561
+ </ div >
562
562
</ div >
563
- </ div >
564
- ) ) }
563
+ )
564
+ ) }
565
565
</ div >
566
566
</ div >
567
567
@@ -594,48 +594,51 @@ export default function Home() {
594
594
</ div >
595
595
596
596
< div className = "tw-flex tw-flex-col tw-justify-between tw-w-max" >
597
- { Array . from ( { length : 24 } , ( _ , i ) => i ) . map ( ( hour ) => (
598
- < div
599
- key = { hour }
600
- className = "tw-flex tw-row tw-items-center"
601
- >
602
- < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
603
- { [ "Mon" ] . map ( ( day ) => {
604
- const currentTask = getReccosForTimeSlot (
605
- day ,
606
- hour
607
- ) ;
608
- const shouldDisplayTitle =
609
- currentTask && isReccosStart ( currentTask , hour ) ;
610
-
611
- if ( currentTask ) {
597
+ { Array . from ( { length : 17 } , ( _ , i ) => i + 7 ) . map (
598
+ ( hour ) => (
599
+ < div
600
+ key = { hour }
601
+ className = "tw-flex tw-row tw-items-center"
602
+ >
603
+ < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
604
+ { [ "Mon" ] . map ( ( day ) => {
605
+ const currentTask = getReccosForTimeSlot (
606
+ day ,
607
+ hour
608
+ ) ;
609
+ const shouldDisplayTitle =
610
+ currentTask &&
611
+ isReccosStart ( currentTask , hour ) ;
612
+
613
+ if ( currentTask ) {
614
+ return (
615
+ < div
616
+ className = "tw-w-[500px] tw-flex tw-justify-center tw-text-center"
617
+ key = { day }
618
+ >
619
+ { /* Content for each hour can be added here */ }
620
+ < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-r-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
621
+ { shouldDisplayTitle && (
622
+ < Recommended recco = { currentTask } />
623
+ ) }
624
+ </ div >
625
+ </ div >
626
+ ) ;
627
+ }
612
628
return (
613
629
< div
614
- className = "tw-w-[500px] tw-flex tw-justify-center tw-text-center"
630
+ className = "tw-w-full tw-flex tw-justify-center tw-text-center"
615
631
key = { day }
616
632
>
617
633
{ /* Content for each hour can be added here */ }
618
- < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-r-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
619
- { shouldDisplayTitle && (
620
- < Recommended recco = { currentTask } />
621
- ) }
622
- </ div >
634
+ < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-border-r-2 tw-text-white " > </ div >
623
635
</ div >
624
636
) ;
625
- }
626
- return (
627
- < div
628
- className = "tw-w-full tw-flex tw-justify-center tw-text-center"
629
- key = { day }
630
- >
631
- { /* Content for each hour can be added here */ }
632
- < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-border-r-2 tw-text-white " > </ div >
633
- </ div >
634
- ) ;
635
- } ) }
637
+ } ) }
638
+ </ div >
636
639
</ div >
637
- </ div >
638
- ) ) }
640
+ )
641
+ ) }
639
642
</ div >
640
643
</ div >
641
644
</ div >
@@ -728,15 +731,21 @@ export default function Home() {
728
731
Insights
729
732
</ div >
730
733
< OverlayScrollbarsComponent style = { { height : "400px" } } >
731
- < div className = "tw-text-base tw-space-y-2" >
732
- { /* Assuming insights is an array of strings */ }
734
+ { ! tasks ? (
735
+ < div className = "tw-w-full tw-flex tw-justify-center" >
736
+ < CircularProgress />
737
+ </ div >
738
+ ) : (
739
+ < div className = "tw-text-base tw-space-y-2" >
740
+ { /* Assuming insights is an array of strings */ }
733
741
734
- { insights . map ( ( insight , index ) => (
735
- < div key = { index } className = "tw-p-1" >
736
- { insight }
737
- </ div >
738
- ) ) }
739
- </ div >
742
+ { insights . map ( ( insight , index ) => (
743
+ < div key = { index } className = "tw-p-1" >
744
+ { insight }
745
+ </ div >
746
+ ) ) }
747
+ </ div >
748
+ ) }
740
749
</ OverlayScrollbarsComponent >
741
750
</ div >
742
751
@@ -757,6 +766,7 @@ export default function Home() {
757
766
Calendar
758
767
</ h1 >
759
768
</ div >
769
+
760
770
< div className = "tw-flex tw-flex-col tw-px-6 tw-rounded-lg tw-shadow-md tw-overflow-x-auto tw-text-black tw-h-[80vh]" >
761
771
< div className = "tw-grid tw-grid-cols-25 tw-w-fit tw-ml-auto tw-mr-auto" >
762
772
{ /* Hour Labels */ }
@@ -784,9 +794,19 @@ export default function Home() {
784
794
className = "tw-flex tw-flex-row tw-w-max tw-justify-between tw-align-center "
785
795
>
786
796
< div className = "tw-h-3 tw-flex tw-items-center tw-justify-start tw-w-[50px]" > </ div >
787
- < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start " >
788
- { daysOfWeek . map ( ( day ) => {
789
- if ( day === "Sun" ) {
797
+ { tasks && (
798
+ < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start " >
799
+ { daysOfWeek . map ( ( day ) => {
800
+ if ( day === "Sun" ) {
801
+ return (
802
+ < div
803
+ key = { day }
804
+ className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center "
805
+ >
806
+ < div className = "tw-w-full tw-h-3 tw-border-l-2" > </ div >
807
+ </ div >
808
+ ) ;
809
+ }
790
810
return (
791
811
< div
792
812
key = { day }
@@ -795,61 +815,59 @@ export default function Home() {
795
815
< div className = "tw-w-full tw-h-3 tw-border-l-2" > </ div >
796
816
</ div >
797
817
) ;
798
- }
799
- return (
800
- < div
801
- key = { day }
802
- className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center "
803
- >
804
- < div className = "tw-w-full tw-h-3 tw-border-l-2" > </ div >
805
- </ div >
806
- ) ;
807
- } ) }
808
- </ div >
818
+ } ) }
819
+ </ div >
820
+ ) }
809
821
</ div >
810
822
</ div >
811
823
812
- < div className = "tw-flex tw-flex-col tw-justify-between tw-w-max" >
813
- { Array . from ( { length : 24 } , ( _ , i ) => i ) . map ( ( hour ) => (
814
- < div key = { hour } className = "tw-flex tw-row tw-items-center" >
815
- < div className = "tw-h-12 tw-flex tw-items-center tw-justify-start tw-w-[50px] tw-text-white" >
816
- { hour } :00
817
- </ div >
818
- < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
819
- { daysOfWeek . map ( ( day ) => {
820
- const currentTask = getTaskForTimeSlot ( day , hour ) ;
821
- const shouldDisplayTitle =
822
- currentTask && istaskStart ( currentTask , day , hour ) ;
824
+ { ! tasks ? (
825
+ < div className = "tw-flex tw-w-full tw-justify-center tw-mt-10 " >
826
+ < CircularProgress />
827
+ </ div >
828
+ ) : (
829
+ < div className = "tw-flex tw-flex-col tw-justify-between tw-w-max" >
830
+ { Array . from ( { length : 17 } , ( _ , i ) => i + 7 ) . map ( ( hour ) => (
831
+ < div key = { hour } className = "tw-flex tw-row tw-items-center" >
832
+ < div className = "tw-h-12 tw-flex tw-items-center tw-justify-start tw-w-[50px] tw-text-white" >
833
+ { hour } :00
834
+ </ div >
835
+ < div className = "tw-flex tw-row tw-item-center tw-w-full tw-justify-start" >
836
+ { daysOfWeek . map ( ( day ) => {
837
+ const currentTask = getTaskForTimeSlot ( day , hour ) ;
838
+ const shouldDisplayTitle =
839
+ currentTask && istaskStart ( currentTask , day , hour ) ;
823
840
824
- if ( currentTask ) {
841
+ if ( currentTask ) {
842
+ return (
843
+ < div
844
+ className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
845
+ key = { day }
846
+ >
847
+ { /* Content for each hour can be added here */ }
848
+ < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
849
+ { shouldDisplayTitle && (
850
+ < TaskItem task = { currentTask } />
851
+ ) }
852
+ </ div >
853
+ </ div >
854
+ ) ;
855
+ }
825
856
return (
826
857
< div
827
858
className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
828
859
key = { day }
829
860
>
830
861
{ /* Content for each hour can be added here */ }
831
- < div className = "tw-w-full tw-h-12 tw-border-l-2 tw-border-gray-200 tw-bg-[#3f50b5] tw-text-white" >
832
- { shouldDisplayTitle && (
833
- < TaskItem task = { currentTask } />
834
- ) }
835
- </ div >
862
+ < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-text-white " > </ div >
836
863
</ div >
837
864
) ;
838
- }
839
- return (
840
- < div
841
- className = "tw-w-[100px] tw-flex tw-justify-center tw-text-center"
842
- key = { day }
843
- >
844
- { /* Content for each hour can be added here */ }
845
- < div className = "tw-w-full tw-h-12 tw-border-b-2 tw-border-l-2 tw-text-white " > </ div >
846
- </ div >
847
- ) ;
848
- } ) }
865
+ } ) }
866
+ </ div >
849
867
</ div >
850
- </ div >
851
- ) ) }
852
- </ div >
868
+ ) ) }
869
+ </ div >
870
+ ) }
853
871
</ div >
854
872
</ div >
855
873
</ div >
0 commit comments