@@ -215,8 +215,14 @@ const Home = () => {
215
215
}
216
216
)
217
217
const projects = useFolders ( )
218
- const prompts = [ { prompt : 'lol' } , { prompt : 'never gonna give you up' } , { prompt : 'takethisli' } ]
219
- const [ tabSelected , setTabSelected ] = useState < HomeTabKeys > ( HomeTabKeys . Projects )
218
+ const prompts = [
219
+ { prompt : 'lol' } ,
220
+ { prompt : 'never gonna give you up' } ,
221
+ { prompt : 'takethisli' } ,
222
+ ]
223
+ const [ tabSelected , setTabSelected ] = useState < HomeTabKeys > (
224
+ HomeTabKeys . Projects
225
+ )
220
226
const [ items , setItems ] = useState < Project [ ] | Prompt [ ] > ( projects )
221
227
const [ searchParams , setSearchParams ] = useSearchParams ( )
222
228
const { searchResults, query, searchAgainst } = useHomeSearch ( projects )
@@ -422,7 +428,13 @@ const Home = () => {
422
428
</ li >
423
429
</ ul >
424
430
</ aside >
425
- < HomeItemsArea tabSelected = { tabSelected } searchResults = { searchResults } sortBy = { sortBy } query = { query } />
431
+ < HomeItemsArea
432
+ tabSelected = { tabSelected }
433
+ searchResults = { searchResults }
434
+ sortBy = { sortBy }
435
+ query = { query }
436
+ />
437
+ < LowerRightControls navigate = { navigate } />
426
438
</ div >
427
439
< StatusBar
428
440
globalItems = { [
@@ -442,7 +454,7 @@ enum HomeTabKeys {
442
454
443
455
interface HomeTabProps {
444
456
onChange : ( key : HomeTabKeys ) => void
445
- selected : HomeTabKeys ,
457
+ selected : HomeTabKeys
446
458
}
447
459
448
460
function HomeTab ( props : HomeTabProps ) {
@@ -462,19 +474,22 @@ function HomeTab(props: HomeTabProps) {
462
474
props . onChange ( key )
463
475
}
464
476
465
- return < div className = "flex flex-row" >
466
- { tabs . map (
467
- ( el ) => < div
468
- className = { el . key === selected ? cssActive : cssInactive }
469
- onClick = { onClickTab ( el . key ) } >
470
- { el . name }
471
- </ div >
472
- ) }
473
- </ div >
477
+ return (
478
+ < div className = "flex flex-row" >
479
+ { tabs . map ( ( el ) => (
480
+ < div
481
+ className = { el . key === selected ? cssActive : cssInactive }
482
+ onClick = { onClickTab ( el . key ) }
483
+ >
484
+ { el . name }
485
+ </ div >
486
+ ) ) }
487
+ </ div >
488
+ )
474
489
}
475
490
476
491
interface HomeHeaderProps extends HTMLProps < HTMLDivElement > {
477
- tabSelected : HomeTabKeys ,
492
+ tabSelected : HomeTabKeys
478
493
onChangeHomeSearchBar : ( query : string ) => void
479
494
onChangeTab : ( key : HomeTabKeys ) => void
480
495
sortBy : string
@@ -583,11 +598,15 @@ function HomeHeader({
583
598
}
584
599
585
600
function NoResults ( ) {
586
- return < div className = "col-start-2 -col-end-1 w-full flex flex-col justify-center items-center" > No results.</ div >
601
+ return (
602
+ < div className = "col-start-2 -col-end-1 w-full flex flex-col justify-center items-center" >
603
+ No results.
604
+ </ div >
605
+ )
587
606
}
588
607
589
608
interface HomeItemsAreaProps {
590
- tabSelected : HomeTabKeys ,
609
+ tabSelected : HomeTabKeys
591
610
searchResults : HomeItems
592
611
sortBy : string
593
612
query : string
@@ -598,50 +617,56 @@ function HomeItemsArea(props: HomeItemsAreaProps) {
598
617
599
618
switch ( props . tabSelected ) {
600
619
case HomeTabKeys . Projects :
601
- grid = areHomeItemsProjects ( props . searchResults )
602
- ? < ResultGridProjects
603
- searchResults = { props . searchResults }
604
- query = { props . query }
605
- sortBy = { props . sortBy }
620
+ grid = areHomeItemsProjects ( props . searchResults ) ? (
621
+ < ResultGridProjects
622
+ searchResults = { props . searchResults }
623
+ query = { props . query }
624
+ sortBy = { props . sortBy }
606
625
/>
607
- : < NoResults />
626
+ ) : (
627
+ < NoResults />
628
+ )
608
629
break
609
630
case HomeTabKeys . Prompts :
610
- grid = areHomeItemsPrompts ( props . searchResults )
611
- ? < ResultGridPrompts
612
- searchResults = { props . searchResults }
613
- query = { props . query }
614
- sortBy = { props . sortBy }
615
- />
616
- : < NoResults />
631
+ grid = areHomeItemsPrompts ( props . searchResults ) ? (
632
+ < ResultGridPrompts
633
+ searchResults = { props . searchResults }
634
+ query = { props . query }
635
+ sortBy = { props . sortBy }
636
+ />
637
+ ) : (
638
+ < NoResults />
639
+ )
617
640
break
618
641
default :
619
642
const _ex : never = props . tabSelected
620
643
}
621
644
622
- return < div className = "flex-1 col-start-2 -col-end-1 overflow-y-auto pr-2 pb-24" >
623
- { grid }
624
- </ div >
645
+ return (
646
+ < div className = "flex-1 col-start-2 -col-end-1 overflow-y-auto pr-2 pb-24" >
647
+ { grid }
648
+ </ div >
649
+ )
625
650
}
626
651
627
652
interface ResultGridProjectsProps {
628
- searchResults : Prompt [ ] ,
653
+ searchResults : Prompt [ ]
629
654
query : string
630
655
sortBy : string
631
656
}
632
657
633
658
function ResultGridPrompts ( props ) {
634
- return < div >
635
- { props . searchResults . map (
636
- ( el ) => < div key = { el . prompt } >
637
- { el . prompt }
638
- </ div >
639
- ) }
640
- </ div >
659
+ return (
660
+ < div >
661
+ { props . searchResults . map ( ( el ) => (
662
+ < div key = { el . prompt } > { el . prompt } </ div >
663
+ ) ) }
664
+ </ div >
665
+ )
641
666
}
642
667
643
668
interface ResultGridProjectsProps extends HTMLProps < HTMLDivElement > {
644
- searchResults : Project [ ] ,
669
+ searchResults : Project [ ]
645
670
query : string
646
671
sortBy : string
647
672
}
@@ -657,16 +682,16 @@ function ResultGridProjects(props: ResultGridProjectsProps) {
657
682
< >
658
683
{ props . searchResults . length > 0 ? (
659
684
< ul className = "grid w-full sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" >
660
- { ( props . searchResults ?? [ ] )
685
+ { ( props . searchResults ?? [ ] )
661
686
. sort ( getSortFunction ( props . sortBy ) )
662
- . map ( ( item ) =>
663
- < ProjectCard
664
- key = { item . name }
665
- project = { item }
666
- handleRenameProject = { handleRenameProject }
667
- handleDeleteProject = { handleDeleteProject }
668
- />
669
- ) }
687
+ . map ( ( item ) => (
688
+ < ProjectCard
689
+ key = { item . name }
690
+ project = { item }
691
+ handleRenameProject = { handleRenameProject }
692
+ handleDeleteProject = { handleDeleteProject }
693
+ />
694
+ ) ) }
670
695
</ ul >
671
696
) : (
672
697
< p className = "p-4 my-8 border border-dashed rounded border-chalkboard-30 dark:border-chalkboard-70" >
0 commit comments