@@ -87,18 +87,8 @@ export default function Home() {
8787
8888 const showPopup = useShowPopup ( ) ;
8989 const [ colorScheme , themeParams ] = useThemeParams ( ) ;
90- const [ initDataUnsafe , initData ] = useInitData ( ) ;
9190 const router = useRouter ( ) ;
9291
93- // Update the webAppParams object
94- const webAppParams = {
95- colorScheme,
96- themeParams,
97- initData,
98- initDataUnsafe,
99- } ;
100-
101- // Add action buttons configuration
10292 const actionButtons : ActionButton [ ] = [
10393 {
10494 label : "View Assistant" ,
@@ -116,11 +106,23 @@ export default function Home() {
116106 } ,
117107 {
118108 label : "Restart" ,
119- action : ( ) => {
120- showPopup ( {
121- message : 'Restarting bot...' ,
122- buttons : [ { type : 'ok' } ]
123- } ) ;
109+ action : async ( ) => {
110+ try {
111+ showPopup ( {
112+ message : 'Restarting bot...' ,
113+ buttons : [ { type : 'ok' } ]
114+ } ) ;
115+ const result = await api . api . restartBot ( ) ;
116+ showPopup ( {
117+ message : result . status || 'Bot restarted successfully' ,
118+ buttons : [ { type : 'ok' } ]
119+ } ) ;
120+ } catch ( error ) {
121+ showPopup ( {
122+ message : 'Failed to restart bot. Please try again.' ,
123+ buttons : [ { type : 'ok' } ]
124+ } ) ;
125+ }
124126 } ,
125127 icon : (
126128 < svg className = "w-5 h-5" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" >
@@ -130,11 +132,23 @@ export default function Home() {
130132 } ,
131133 {
132134 label : "Update" ,
133- action : ( ) => {
134- showPopup ( {
135- message : 'Checking for updates...' ,
136- buttons : [ { type : 'ok' } ]
137- } ) ;
135+ action : async ( ) => {
136+ try {
137+ showPopup ( {
138+ message : 'Checking for updates...' ,
139+ buttons : [ { type : 'ok' } ]
140+ } ) ;
141+ const result = await api . api . updateBot ( ) ;
142+ showPopup ( {
143+ message : result . status || 'Bot updated successfully' ,
144+ buttons : [ { type : 'ok' } ]
145+ } ) ;
146+ } catch ( error ) {
147+ showPopup ( {
148+ message : 'Failed to update bot. Please try again.' ,
149+ buttons : [ { type : 'ok' } ]
150+ } ) ;
151+ }
138152 } ,
139153 icon : (
140154 < svg className = "w-5 h-5" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" >
@@ -144,7 +158,6 @@ export default function Home() {
144158 }
145159 ] ;
146160
147- // Update scroll handler to include header hiding
148161 useEffect ( ( ) => {
149162 const handleScroll = ( ) => {
150163 const currentScrollY = window . scrollY ;
@@ -158,7 +171,6 @@ export default function Home() {
158171 setLastScrollY ( currentScrollY ) ;
159172 setScrollY ( currentScrollY ) ;
160173
161- // Check if elements are in viewport
162174 const observer = new IntersectionObserver (
163175 ( entries ) => {
164176 entries . forEach ( ( entry ) => {
@@ -240,7 +252,6 @@ export default function Home() {
240252
241253 const avatarUrl = getUserAvatar ( userData ) ;
242254
243- // Enhanced parallax transforms with smooth easing
244255 const headerTransform = `translateY(${ scrollY * 0.2 } px) scale(${ 1 - scrollY * 0.0005 } )` ;
245256 const statsTransform = `translateY(${ scrollY * 0.1 } px)` ;
246257 const skillsTransform = `translateY(${ scrollY * 0.05 } px)` ;
@@ -344,7 +355,7 @@ export default function Home() {
344355 className = { `text-center mb-16 relative transform transition-all duration-700 ${
345356 isVisible ? 'translate-y-0 opacity-100' : 'translate-y-10 opacity-0'
346357 } `}
347- style = { { transform : headerTransform , transition : 'transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)' } }
358+ style = { { transform : headerTransform } }
348359 >
349360 < div className = "relative w-48 h-48 mx-auto mb-8" >
350361 < div className = "relative w-full h-full rounded-full overflow-hidden shadow-2xl ring-2 ring-primary/20 transition-transform duration-300 hover:scale-105" >
@@ -386,14 +397,14 @@ export default function Home() {
386397 className = { `mb-16 relative transform transition-all duration-700 ${
387398 isVisible ? 'translate-y-0 opacity-100' : 'translate-y-10 opacity-0'
388399 } `}
389- style = { { transform : statsTransform , transition : 'transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)' } }
400+ style = { { transform : statsTransform } }
390401 >
391402 < div className = "p-8 rounded-2xl bg-white/5 text-center shadow-xl backdrop-blur-md border border-white/10 hover:border-primary/20 transition-all duration-500 group" >
392403 < div className = "relative" >
393404 < div className = "absolute inset-0 bg-gradient-to-r from-primary/20 to-accent/20 blur-xl rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-500" > </ div >
394405 < div className = "relative" >
395- < div className = "text-sm text-gray-400 uppercase tracking-wider font-medium" > Uptime since</ div >
396- < div className = "text-5xl font-bold text-primary mb-2 transition-all duration-300 group-hover:scale-110" > { userData . stats . uptime } </ div >
406+ < div className = "text-sm text-gray-400 uppercase tracking-wider font-medium" > Uptime since</ div >
407+ < div className = "text-5xl font-bold text-primary mb-2 transition-all duration-300 group-hover:scale-110" > { userData . stats . uptime } </ div >
397408 </ div >
398409 </ div >
399410 </ div >
@@ -404,7 +415,7 @@ export default function Home() {
404415 className = { `mb-16 relative transform transition-all duration-700 ${
405416 isVisible ? 'translate-y-0 opacity-100' : 'translate-y-10 opacity-0'
406417 } `}
407- style = { { transform : skillsTransform , transition : 'transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)' } }
418+ style = { { transform : skillsTransform } }
408419 >
409420 < h2 className = "text-2xl font-bold mb-6 text-white relative inline-block" >
410421 < span className = "relative" >
@@ -430,34 +441,6 @@ export default function Home() {
430441 </ div >
431442 </ div >
432443
433- < div className = "mb-16 space-y-6" >
434- < div className = "p-6 rounded-2xl bg-white/5 backdrop-blur-md border border-white/10" >
435- < h2 className = "text-2xl font-bold mb-4 text-white" >
436- Theme Parameters
437- </ h2 >
438- < pre className = "overflow-auto p-4 rounded-lg bg-black/30 text-white/90" >
439- { JSON . stringify ( { colorScheme, themeParams } , null , 2 ) }
440- </ pre >
441- </ div >
442-
443- < div className = "p-6 rounded-2xl bg-white/5 backdrop-blur-md border border-white/10" >
444- < h2 className = "text-2xl font-bold mb-4 text-white" >
445- Auth Data
446- </ h2 >
447- < pre className = "overflow-auto p-4 rounded-lg bg-black/30 text-white/90" >
448- { JSON . stringify (
449- {
450- user : initDataUnsafe ?. user || null ,
451- startParam : initDataUnsafe ?. start_param || null ,
452- initData : initData || null ,
453- } ,
454- null ,
455- 2
456- ) }
457- </ pre >
458- </ div >
459- </ div >
460-
461444 < div className = "mb-16" >
462445 < div className = "grid grid-cols-3 gap-4" >
463446 { actionButtons . map ( ( button , index ) => (
0 commit comments