1
- " use client" ;
1
+ ' use client' ;
2
2
3
- import { useContext , useEffect } from "react" ;
4
- import { AuthContext } from "@/contexts/auth" ;
5
- import { title , subtitle } from "@/components/primitives" ;
6
- import Scripts from "@/components/scripts" ;
7
- import Loading from "@/components/loading" ;
8
- import { NavContext } from "@/contexts/nav" ;
9
- import { GoPeople } from "react-icons/go" ;
10
- import Create from "@/components/scripts/create" ;
3
+ import React , { useContext , useEffect , useState } from 'react' ;
4
+ import { AuthContext } from '@/contexts/auth' ;
5
+ import Scripts from '@/components/scripts' ;
6
+ import Loading from '@/components/loading' ;
7
+ import { NavContext } from '@/contexts/nav' ;
8
+ import { GoPeople } from 'react-icons/go' ;
9
+ import Create from '@/components/scripts/create' ;
10
+ import { Button , Divider , useDisclosure } from '@nextui-org/react' ;
11
+ import { MdOutlineTravelExplore } from 'react-icons/md' ;
12
+ import ExploreModal from '@/components/explore/ExploreModal' ;
11
13
12
14
export default function Home ( ) {
13
- const { loading} = useContext ( AuthContext ) ;
14
- const { setCurrent} = useContext ( NavContext ) ;
15
- useEffect ( ( ) => setCurrent ( '/build' ) , [ ] )
16
- if ( loading ) return < Loading /> ;
17
- return (
18
- < section className = "w-full gap-4 px-20 pt-20" >
19
- < div className = "flex justify-between" >
20
- < h1 className = "text-4xl font-bold text-primary-400" >
21
- < GoPeople className = "inline mb-2 mr-1 text-5xl" /> My Assistants
22
- </ h1 >
23
- < Create />
24
- </ div >
15
+ const { loading } = useContext ( AuthContext ) ;
16
+ const { setCurrent } = useContext ( NavContext ) ;
17
+ const { isOpen, onOpen, onClose } = useDisclosure ( ) ;
18
+ const [ showFavorites , setShowFavorites ] = useState < boolean > ( false ) ;
25
19
26
- < div className = "w-full pt-16 pb-24" >
27
- < Scripts />
28
- </ div >
29
- </ section >
30
- ) ;
31
- }
20
+ useEffect ( ( ) => setCurrent ( '/build' ) , [ ] ) ;
21
+ if ( loading ) return < Loading /> ;
22
+ return (
23
+ < section className = "w-full gap-4 px-20 pt-20" >
24
+ < div className = "flex justify-between" >
25
+ < h1 className = "text-4xl font-bold text-primary-400" >
26
+ < GoPeople className = "inline mb-2 mr-1 text-5xl" /> My Assistants
27
+ </ h1 >
28
+ < div >
29
+ < Create />
30
+ < Button
31
+ isLoading = { loading }
32
+ size = "md"
33
+ startContent = { < MdOutlineTravelExplore /> }
34
+ color = "primary"
35
+ variant = "flat"
36
+ className = "ml-2"
37
+ onPress = { ( ) => {
38
+ onOpen ( ) ;
39
+ } }
40
+ >
41
+ Assistant Catalog
42
+ </ Button >
43
+ </ div >
44
+ </ div >
45
+ < div className = "flex h-5 ml-2 mt-5 items-center space-x-4 text-medium text-zinc-500" >
46
+ < div
47
+ className = { `cursor-pointer hover:text-zinc-700 dark:hover:text-zinc-300 ${ ! showFavorites ? 'font-bold text-zinc-900 dark:text-white' : '' } ` }
48
+ onClick = { ( ) => setShowFavorites ( false ) }
49
+ >
50
+ My Assistants
51
+ </ div >
52
+ < Divider orientation = "vertical" />
53
+ < div
54
+ className = { `cursor-pointer hover:text-zinc-700 dark:hover:text-zinc-300 ${ showFavorites ? 'font-bold text-zinc-900 dark:text-white' : '' } ` }
55
+ onClick = { ( ) => setShowFavorites ( true ) }
56
+ >
57
+ Favorites
58
+ </ div >
59
+ </ div >
60
+
61
+ < div className = "w-full pt-8 pb-24" >
62
+ < Scripts showFavorites = { showFavorites } />
63
+ </ div >
64
+ < ExploreModal isOpen = { isOpen } onOpen = { onOpen } onClose = { onClose } />
65
+ </ section >
66
+ ) ;
67
+ }
0 commit comments