@@ -7,30 +7,31 @@ import Privacy from './pages/Privacy';
77import LearnMore from './pages/LearnMore' ;
88import Pricing from './pages/Pricing' ;
99import CliAuth from './pages/CliAuth/CliAuth' ;
10- import { AuthProvider , useAuth } from './contexts/AuthContext' ;
1110
1211const AppContent : React . FC = ( ) => {
1312 const [ currentPage , setCurrentPage ] = useState ( 'welcome' ) ;
14- const { user, isLoading} = useAuth ( ) ;
1513
1614 useEffect ( ( ) => {
1715 const handleHashChange = ( ) => {
1816 const hash = window . location . hash . slice ( 1 ) ;
19- if ( hash === 'auth' ) {
17+ // Extract the page name before any query parameters
18+ const pageName = hash . split ( '?' ) [ 0 ] ;
19+
20+ if ( pageName === 'auth' ) {
2021 setCurrentPage ( 'auth' ) ;
21- } else if ( hash === 'account' ) {
22+ } else if ( pageName === 'account' ) {
2223 setCurrentPage ( 'account' ) ;
23- } else if ( hash === 'terms' ) {
24+ } else if ( pageName === 'terms' ) {
2425 setCurrentPage ( 'terms' ) ;
25- } else if ( hash === 'privacy' ) {
26+ } else if ( pageName === 'privacy' ) {
2627 setCurrentPage ( 'privacy' ) ;
27- } else if ( hash === 'learn-more' ) {
28+ } else if ( pageName === 'learn-more' ) {
2829 setCurrentPage ( 'learn-more' ) ;
29- } else if ( hash === 'pricing' ) {
30+ } else if ( pageName === 'pricing' ) {
3031 setCurrentPage ( 'pricing' ) ;
31- } else if ( hash === 'cli-auth' ) {
32+ } else if ( pageName === 'cli-auth' ) {
3233 setCurrentPage ( 'cli-auth' ) ;
33- } else if ( hash === 'welcome' ) {
34+ } else if ( pageName === 'welcome' ) {
3435 setCurrentPage ( 'welcome' ) ;
3536 } else {
3637 setCurrentPage ( 'welcome' ) ;
@@ -45,85 +46,6 @@ const AppContent: React.FC = () => {
4546 } ;
4647 } , [ ] ) ;
4748
48- // Show loading while checking auth state
49- if ( isLoading ) {
50- return (
51- < div style = { {
52- minHeight : '100vh' ,
53- display : 'flex' ,
54- alignItems : 'center' ,
55- justifyContent : 'center' ,
56- backgroundColor : '#111827' ,
57- padding : '20px' ,
58- fontFamily : '"Fira Code", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace'
59- } } >
60- < div style = { {
61- background : '#1f2937' ,
62- border : '1px solid #374151' ,
63- borderRadius : '16px' ,
64- boxShadow : '0 20px 40px rgba(0, 0, 0, 0.3)' ,
65- padding : '48px 40px' ,
66- textAlign : 'center' ,
67- maxWidth : '400px' ,
68- width : '100%'
69- } } >
70- < div style = { {
71- width : '48px' ,
72- height : '48px' ,
73- margin : '0 auto 24px' ,
74- background : '#ff6b35' ,
75- borderRadius : '8px' ,
76- display : 'flex' ,
77- alignItems : 'center' ,
78- justifyContent : 'center' ,
79- fontSize : '24px' ,
80- color : 'white' ,
81- fontWeight : 'bold'
82- } } >
83- S
84- </ div >
85- < h1 style = { {
86- fontSize : '24px' ,
87- fontWeight : '600' ,
88- color : '#f9fafb' ,
89- margin : '0 0 8px 0'
90- } } >
91- Salamander
92- </ h1 >
93- < p style = { {
94- fontSize : '14px' ,
95- color : '#d1d5db' ,
96- margin : '0 0 32px 0' ,
97- fontWeight : '500'
98- } } >
99- Never be AFK
100- </ p >
101- < div style = { {
102- width : '32px' ,
103- height : '32px' ,
104- border : '3px solid #374151' ,
105- borderTop : '3px solid #ff6b35' ,
106- borderRadius : '50%' ,
107- animation : 'spin 1s linear infinite' ,
108- margin : '0 auto'
109- } } > </ div >
110- </ div >
111- </ div >
112- ) ;
113- }
114-
115- // If user is logged in and trying to access auth page, redirect to account
116- if ( user && currentPage === 'auth' ) {
117- window . location . hash = 'account' ;
118- return null ;
119- }
120-
121- // If user is not logged in and trying to access account page, redirect to welcome
122- if ( ! user && currentPage === 'account' ) {
123- window . location . hash = 'welcome' ;
124- return null ;
125- }
126-
12749 if ( currentPage === 'auth' ) {
12850 return < Auth /> ;
12951 }
@@ -157,15 +79,7 @@ const AppContent: React.FC = () => {
15779
15880const App : React . FC = ( ) => {
15981 return (
160- < AuthProvider >
161- < AppContent />
162- < style > { `
163- @keyframes spin {
164- 0% { transform: rotate(0deg); }
165- 100% { transform: rotate(360deg); }
166- }
167- ` } </ style >
168- </ AuthProvider >
82+ < AppContent />
16983 ) ;
17084} ;
17185
0 commit comments