File tree Expand file tree Collapse file tree
ui-admin-route-listing-operations/src
ui-admin-route-shared/src
ui-admin-route-user-operations/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export const AppContainer: FC = () => {
1313 } ) ;
1414
1515 if ( ! auth . isAuthenticated ) {
16- return < App isAuthenticated = { false } /> ;
16+ return < App /> ;
1717 }
1818
1919 const user = data ?. currentAdminUser ;
@@ -26,7 +26,7 @@ export const AppContainer: FC = () => {
2626 error = { error }
2727 hasDataComponent = {
2828 < UserIdProvider userId = { userId } >
29- < App isAuthenticated = { auth . isAuthenticated } />
29+ < App />
3030 </ UserIdProvider >
3131 }
3232 />
Original file line number Diff line number Diff line change @@ -9,25 +9,28 @@ import { RequireAuth } from '@sthrift/ui-admin-route-shared';
99import { UserOperationsRoutes } from '@sthrift/ui-admin-route-user-operations' ;
1010import type React from 'react' ;
1111
12+ const appSection = (
13+ < RequireAuth redirectPath = "/login" >
14+ < AppRoutes />
15+ </ RequireAuth >
16+ ) ;
17+
1218const listingOperationsSection = (
13- < RequireAuth redirectPath = "/" >
19+ < RequireAuth redirectPath = "/login " >
1420 < ListingOperationsRoutes />
1521 </ RequireAuth >
1622) ;
1723
1824const userOperationsSection = (
19- < RequireAuth redirectPath = "/" >
25+ < RequireAuth redirectPath = "/login " >
2026 < UserOperationsRoutes />
2127 </ RequireAuth >
2228) ;
2329
24- interface AppProps {
25- isAuthenticated : boolean ;
26- }
27- export const App : React . FC < AppProps > = ( ) => {
30+ export const App : React . FC = ( ) => {
2831 return (
2932 < Routes >
30- < Route path = "/*" element = { < AppRoutes /> } />
33+ < Route path = "/*" element = { appSection } />
3134 < Route path = "/login" element = { < AdminLogin /> } />
3235 < Route path = "/auth-redirect" element = { < AuthRedirect /> } />
3336 < Route
Original file line number Diff line number Diff line change @@ -56,10 +56,6 @@ export const SectionLayout: React.FC = () => {
5656 return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
5757 } , [ auth . isAuthenticated ] ) ;
5858
59- const handleOnLogin = ( ) => {
60- navigate ( '/login' ) ;
61- } ;
62-
6359 const handleLogOut = ( ) => {
6460 HandleLogout ( auth , apolloClient , window . location . origin ) ;
6561 } ;
@@ -93,7 +89,6 @@ export const SectionLayout: React.FC = () => {
9389 >
9490 < AdminHeader
9591 isAuthenticated = { auth . isAuthenticated }
96- onLogin = { handleOnLogin }
9792 onLogout = { handleLogOut }
9893 />
9994 < div
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export const AdminLogin: React.FC = () => {
1313 const [ submitting , setSubmitting ] = useState ( false ) ;
1414 const navigate = useNavigate ( ) ;
1515 const auth = useAuth ( ) ;
16+ const handleBack = ( ) => undefined ;
1617
1718 const handleLogin = ( _values : LoginFormData ) => {
1819 setSubmitting ( true ) ;
@@ -23,25 +24,17 @@ export const AdminLogin: React.FC = () => {
2324 }
2425 } ;
2526
26- const handleBack = ( ) => {
27- navigate ( '/' ) ;
28- } ;
29-
30- const handleOnLogin = ( ) => {
31- globalThis . location . href = '/auth-redirect' ;
32- } ;
33-
3427 return (
3528 < LoginForm
3629 title = "Admin Log In"
3730 emailPlaceholder = "admin@sharethrift.com"
3831 onSubmit = { handleLogin }
3932 submitting = { submitting }
4033 onBack = { handleBack }
34+ showBack = { false }
4135 headerSlot = {
4236 < AdminHeader
4337 isAuthenticated = { auth . isAuthenticated }
44- onLogin = { handleOnLogin }
4538 onLogout = { ( ) => navigate ( '/' ) }
4639 />
4740 }
Original file line number Diff line number Diff line change 11import { Route , Routes } from 'react-router-dom' ;
2- import { RequireAuth } from '@sthrift/ui-admin-route-shared' ;
32import { SectionLayout } from './section-layout.tsx' ;
43import { Listings } from './components/pages/home/pages/all-listings-page.tsx' ;
54import { ViewListing } from './components/pages/view-listing/pages/view-listing-page.tsx' ;
@@ -11,14 +10,7 @@ export const AppRoutes: React.FC = () => {
1110 < Route path = "" element = { < SectionLayout /> } >
1211 < Route path = "" element = { < Listings /> } />
1312 < Route path = "listing/:listingId" element = { < ViewListing /> } />
14- < Route
15- path = "messages/*"
16- element = {
17- < RequireAuth redirectPath = "/" >
18- < MessagesRoutes />
19- </ RequireAuth >
20- }
21- />
13+ < Route path = "messages/*" element = { < MessagesRoutes /> } />
2214 </ Route >
2315 </ Routes >
2416 ) ;
Original file line number Diff line number Diff line change @@ -56,10 +56,6 @@ export const SectionLayout: React.FC = () => {
5656 return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
5757 } , [ auth . isAuthenticated ] ) ;
5858
59- const handleOnLogin = ( ) => {
60- navigate ( '/login' ) ;
61- } ;
62-
6359 const handleLogOut = ( ) => {
6460 HandleLogout ( auth , apolloClient , window . location . origin ) ;
6561 } ;
@@ -93,7 +89,6 @@ export const SectionLayout: React.FC = () => {
9389 >
9490 < AdminHeader
9591 isAuthenticated = { auth . isAuthenticated }
96- onLogin = { handleOnLogin }
9792 onLogout = { handleLogOut }
9893 />
9994 < div
Original file line number Diff line number Diff line change 3737
3838.brandName {
3939 font-family : var (--Urbanist );
40- font-size : 1.1 rem ;
40+ font-size : 24 px ;
4141 font-weight : 700 ;
42+ line-height : 32px ;
4243 letter-spacing : 0.02em ;
43- color : var (--color-message-text );
44+ color : var (--color-primary );
4445 text-transform : lowercase;
4546}
4647
8788 }
8889
8990 .brandName {
90- font-size : 1 rem ;
91+ font-size : 20 px ;
9192 }
9293
9394 .portalPill {
Original file line number Diff line number Diff line change @@ -6,15 +6,13 @@ import styles from './admin-header.module.css';
66
77interface AdminHeaderProps {
88 isAuthenticated : boolean ;
9- onLogin ?: ( ) => void ;
109 onLogout ?: ( ) => void ;
1110}
1211
1312const { Header : AntHeader } = Layout ;
1413
1514export const AdminHeader : React . FC < AdminHeaderProps > = ( {
1615 isAuthenticated,
17- onLogin,
1816 onLogout,
1917} ) => {
2018 return (
@@ -35,15 +33,7 @@ export const AdminHeader: React.FC<AdminHeaderProps> = ({
3533 >
3634 Log Out
3735 </ Button >
38- ) : (
39- < Button
40- type = "link"
41- className = { styles [ 'authButton' ] }
42- onClick = { onLogin }
43- >
44- Log In
45- </ Button >
46- ) }
36+ ) : null }
4737 </ nav >
4838 </ AntHeader >
4939 ) ;
Original file line number Diff line number Diff line change @@ -56,10 +56,6 @@ export const SectionLayout: React.FC = () => {
5656 return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
5757 } , [ auth . isAuthenticated ] ) ;
5858
59- const handleOnLogin = ( ) => {
60- navigate ( '/login' ) ;
61- } ;
62-
6359 const handleLogOut = ( ) => {
6460 HandleLogout ( auth , apolloClient , window . location . origin ) ;
6561 } ;
@@ -93,7 +89,6 @@ export const SectionLayout: React.FC = () => {
9389 >
9490 < AdminHeader
9591 isAuthenticated = { auth . isAuthenticated }
96- onLogin = { handleOnLogin }
9792 onLogout = { handleLogOut }
9893 />
9994 < div
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ interface LoginFormProps {
1818 onBack : ( ) => void ;
1919 headerSlot : React . ReactNode ;
2020 footerSlot ?: React . ReactNode ;
21+ showBack ?: boolean ;
2122 showForgotPassword ?: boolean ;
2223 onForgotPassword ?: ( ) => void ;
2324}
@@ -30,6 +31,7 @@ export const LoginForm: React.FC<LoginFormProps> = ({
3031 onBack,
3132 headerSlot,
3233 footerSlot,
34+ showBack = true ,
3335 showForgotPassword,
3436 onForgotPassword,
3537} ) => {
@@ -166,17 +168,24 @@ export const LoginForm: React.FC<LoginFormProps> = ({
166168 < div
167169 style = { {
168170 display : 'flex' ,
169- justifyContent : showForgotPassword ? 'space-between' : 'flex-start' ,
171+ justifyContent :
172+ showBack && showForgotPassword
173+ ? 'space-between'
174+ : showBack
175+ ? 'flex-start'
176+ : 'flex-end' ,
170177 marginTop : '1rem' ,
171178 } }
172179 >
173- < Button
174- type = "link"
175- onClick = { onBack }
176- style = { { padding : 0 } }
177- >
178- ← Back to Home
179- </ Button >
180+ { showBack && (
181+ < Button
182+ type = "link"
183+ onClick = { onBack }
184+ style = { { padding : 0 } }
185+ >
186+ ← Back to Home
187+ </ Button >
188+ ) }
180189 { showForgotPassword && onForgotPassword && (
181190 < Button
182191 type = "link"
You can’t perform that action at this time.
0 commit comments