1
1
'use client'
2
2
3
+ import { NavItem } from '@/app/[locale]/_components/NavItem'
4
+ import { NavModal } from '@/app/[locale]/_components/NavModal'
3
5
import ChatBox from '@/components/common/chats/ChatBox'
4
- import { NavItem } from '@/components/main/NavItem'
5
- import { NavModal } from '@/components/main/NavModal'
6
+ import LoadingCircle from '@/components/common/loadings/LoadingCircle'
6
7
import { ChatBubbleLeftEllipsisIcon , DocumentIcon } from '@heroicons/react/24/solid'
7
8
import { Application , SPEObject } from '@splinetool/runtime'
8
9
import { motion } from 'framer-motion'
@@ -12,27 +13,7 @@ import { useRef, useState } from 'react'
12
13
13
14
const Spline = dynamic ( ( ) => import ( '@splinetool/react-spline' ) , {
14
15
ssr : false ,
15
- loading : ( ) => (
16
- < div role = "status" >
17
- < svg
18
- aria-hidden = "true"
19
- className = "w-8 h-8 text-light/40 animate-spin fill-primary"
20
- viewBox = "0 0 100 101"
21
- fill = "none"
22
- xmlns = "http://www.w3.org/2000/svg"
23
- >
24
- < path
25
- d = "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
26
- fill = "currentColor"
27
- />
28
- < path
29
- d = "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
30
- fill = "currentFill"
31
- />
32
- </ svg >
33
- < span className = "sr-only" > Loading...</ span >
34
- </ div >
35
- )
16
+ loading : ( ) => < LoadingCircle />
36
17
} )
37
18
38
19
const inter = Inter ( { variable : '--font-inter' , subsets : [ 'latin' ] } )
@@ -78,7 +59,7 @@ const chat = {
78
59
const SPLINE_SCENE = 'https://prod.spline.design/W83XdmrQbaQnPMlJ/scene.splinecode'
79
60
const SPLINE_BOT_ID = '7a1937ee-e0ec-4da1-bca9-10b1ff105490'
80
61
81
- const Home = ( ) => {
62
+ const MainContainer = ( ) => {
82
63
const [ selected , setSelected ] = useState < string | null > ( null )
83
64
const [ isBotChatOpened , setIsBotChatOpened ] = useState < boolean > ( false )
84
65
@@ -109,74 +90,72 @@ const Home = () => {
109
90
}
110
91
111
92
return (
112
- < main className = { inter . variable } >
113
- < div className = "w-full h-[100vh] flex justify-center relative overflow-hidden touch-none" >
114
- { /* Background Component */ }
93
+ < div className = "w-full h-[100vh] flex justify-center relative overflow-hidden touch-none" >
94
+ { /* Background Component */ }
115
95
116
- < div
117
- className = "fixed w-full h-full
96
+ < div
97
+ className = "fixed w-full h-full
118
98
flex justify-center items-center z-30 pointer-events-auto bg-gradient-to-tl from-primary to-primary/60"
119
- >
120
- < Spline scene = { SPLINE_SCENE } onLoad = { onLoad } />
121
- </ div >
99
+ >
100
+ < Spline scene = { SPLINE_SCENE } onLoad = { onLoad } />
101
+ </ div >
122
102
123
- < div
124
- className = { `fixed w-full h-full max-w-[1020px] px-[24px] pt-4 pb-[40px] md:pb-[100px]
103
+ < div
104
+ className = { `fixed w-full h-full max-w-[1020px] px-[24px] pt-4 pb-[40px] md:pb-[100px]
125
105
flex justify-end items-center z-30 pointer-events-auto` }
126
- >
127
- < ChatBox isOpen = { isBotChatOpened } />
128
- </ div >
106
+ >
107
+ < ChatBox isOpen = { isBotChatOpened } />
108
+ </ div >
109
+
110
+ { navList . map ( ( nav , i ) => (
111
+ < NavModal selected = { selected === nav . name } { ...nav } key = { `nav-modal-${ nav } -${ i } ` } />
112
+ ) ) }
129
113
130
- { navList . map ( ( nav , i ) => (
131
- < NavModal selected = { selected === nav . name } { ...nav } key = { `nav-modal-${ nav } -${ i } ` } />
132
- ) ) }
133
-
134
- { /* Navigation */ }
135
- < div className = "fixed bottom-[30px] md:bottom-[60px] w-full max-w-[900px] h-full justify-start items-end z-50 pointer-events-none" >
136
- < div className = "w-full h-full flex flex-col-reverse bottom-[200px]" >
137
- < nav className = "flex justify-center gap-[16px]" >
138
- { navList . map ( ( nav , i ) => (
139
- < div id = { nav . name } key = { `${ nav . name } -${ i } ` } className = "pointer-events-auto" >
140
- < motion . div
141
- initial = { { y : 40 , opacity : 0 } }
142
- animate = { { y : 0 , opacity : 100 } }
143
- transition = { { ease : 'easeInOut' , duration : 0.25 * i } }
144
- >
145
- < NavItem
146
- { ...nav }
147
- selected = { selected === nav . name }
148
- onClick = { ( ) => {
149
- if ( ! ! isBotChatOpened ) {
150
- toggleChat ( )
151
- }
152
- handleNavSelect ( nav . name )
153
- } }
154
- />
155
- </ motion . div >
156
- </ div >
157
- ) ) }
158
- < div id = { chat . name } className = "pointer-events-auto" >
114
+ { /* Navigation */ }
115
+ < div className = "fixed bottom-[30px] md:bottom-[60px] w-full max-w-[900px] h-full justify-start items-end z-50 pointer-events-none" >
116
+ < div className = "w-full h-full flex flex-col-reverse bottom-[200px]" >
117
+ < nav className = "flex justify-center gap-[16px]" >
118
+ { navList . map ( ( nav , i ) => (
119
+ < div id = { nav . name } key = { `${ nav . name } -${ i } ` } className = "pointer-events-auto" >
159
120
< motion . div
160
121
initial = { { y : 40 , opacity : 0 } }
161
122
animate = { { y : 0 , opacity : 100 } }
162
- transition = { { ease : 'easeInOut' , duration : 0.25 * navList . length } }
123
+ transition = { { ease : 'easeInOut' , duration : 0.25 * i } }
163
124
>
164
125
< NavItem
165
- selected = { ! ! isBotChatOpened }
166
- { ... chat }
126
+ { ... nav }
127
+ selected = { selected === nav . name }
167
128
onClick = { ( ) => {
168
- setSelected ( null )
169
- toggleChat ( )
129
+ if ( ! ! isBotChatOpened ) {
130
+ toggleChat ( )
131
+ }
132
+ handleNavSelect ( nav . name )
170
133
} }
171
134
/>
172
135
</ motion . div >
173
136
</ div >
174
- </ nav >
175
- </ div >
137
+ ) ) }
138
+ < div id = { chat . name } className = "pointer-events-auto" >
139
+ < motion . div
140
+ initial = { { y : 40 , opacity : 0 } }
141
+ animate = { { y : 0 , opacity : 100 } }
142
+ transition = { { ease : 'easeInOut' , duration : 0.25 * navList . length } }
143
+ >
144
+ < NavItem
145
+ selected = { ! ! isBotChatOpened }
146
+ { ...chat }
147
+ onClick = { ( ) => {
148
+ setSelected ( null )
149
+ toggleChat ( )
150
+ } }
151
+ />
152
+ </ motion . div >
153
+ </ div >
154
+ </ nav >
176
155
</ div >
177
156
</ div >
178
- </ main >
157
+ </ div >
179
158
)
180
159
}
181
160
182
- export default Home
161
+ export default MainContainer
0 commit comments