From 87f806098cfd2107ff3081db1da48190b010ff94 Mon Sep 17 00:00:00 2001 From: Jonathan O'Riordan Date: Fri, 4 Oct 2024 18:04:32 +0100 Subject: [PATCH 1/3] Routes protected and styling added --- public/grocerease.png | Bin 0 -> 13720 bytes src/App.jsx | 39 +++++++++++++++++++++------------- src/utils/ProtectedRoutes.jsx | 6 ++++++ src/views/Login.jsx | 30 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 public/grocerease.png create mode 100644 src/utils/ProtectedRoutes.jsx create mode 100644 src/views/Login.jsx diff --git a/public/grocerease.png b/public/grocerease.png new file mode 100644 index 0000000000000000000000000000000000000000..7531031026b11f428ff50a4cfaa26d38c84e476e GIT binary patch literal 13720 zcmd6u^;?_2_wYAh0|o;M!`<2NV#Tf4a2PP0;ZAWMLxwvYF2jer`*15dq_~#h!<{eN z`|}4pKR(yh_U@f4IahL$oaCIm5~iXg^ZFIZt7p%iy_S;&t37-6eBKfRz>h%1UedsY>Larf!P(>ppuR@?d6GXna*-{*2_bjQ!0@vzE) z#Xoo$9Asce>i_aZRHSwG&5aw=#Hc@jM;g)1qZHF{jau!{x=iS)#~o?$X|TVA$Mx;M zqBTp`P;e8L{VMwh9Hl+Dp-%;eQORnNDpR#g8i&|V_A%JkXxo%~}oR{yT#ul6WU~NasmkysP_kOo|em-h<9=p$2xx9m2XE-OdK89o838=i0Qhk$e zbtipQ$`qc%^gcm_Q}Zba%8+aPFF{ed_oM1lLTY4qRnAimZeo0srxH?Dz;En!I`y{N zl|I+i-%Cn{Mc577h3>LQxVX5sIc*G;m6g-_-`?u{ElYrrAMWVx?q2x-w+YBRWDd;y zr3FKW7~pIsFct<5;<3Nzk8UF(6TUI#5Y)x9l~NtDFk0nWE15Czxf?wGmgBaJFZWl%bKc1Gco+>YvBous>#hi&RQi?~ zm$JNc3gZlDv|A8%?w;V4SbB_%`a&vYxWdXyL#RqY>J9WTzWb{|sPPXX=J(Ej4B$b} z4(A*@@Qtf8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5wlEP$3}iOc-u|&$uKcva~W@`9`AqoYi=$Mza#1ok1I&3 zOGBvziMN2V_Sf zQOAiq(=3uB)wVk_Xh$^U#%##{&55T06`WSV&~jbfuovyMRM#wIyLmfxX<4fa{8w+g zSL-c~OOg6&JUBlZ!tG(&gC9i%2T=B^^Y3*c6)wq|GbzxhDPDeY6X z1KcFT5@tU5`qw7?6Xr*;co{a^-LZ|$Pk9}ZFEG3C{GXy~pR=gayq~FS%?MMX`Fs21 q`N(xKjyv1Gnukw*2v~hYCM9{j7D3m^{&bt_nVggoxLm?0;Qs)y@Su(W literal 0 HcmV?d00001 diff --git a/src/App.jsx b/src/App.jsx index 5fa9782..d512693 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -6,6 +6,10 @@ import { useAuth, useShoppingListData, useShoppingLists } from './api'; import { useStateWithStorage } from './utils'; +import ProtectedRoutes from './utils/ProtectedRoutes'; + +import Login from './views/Login'; + export function App() { /** * This custom hook takes the path of a shopping list @@ -43,22 +47,27 @@ export function App() { return ( - }> - - } - /> - } - /> - } - /> + }> + }> + + } + /> + } + /> + + } + /> + + } path="/login" /> ); diff --git a/src/utils/ProtectedRoutes.jsx b/src/utils/ProtectedRoutes.jsx new file mode 100644 index 0000000..699e57a --- /dev/null +++ b/src/utils/ProtectedRoutes.jsx @@ -0,0 +1,6 @@ +import { Outlet, Navigate } from 'react-router-dom'; + +const ProtectedRoutes = ({ user }) => { + return user ? : ; // Redirect to login if not authenticated +}; +export default ProtectedRoutes; diff --git a/src/views/Login.jsx b/src/views/Login.jsx new file mode 100644 index 0000000..b3fa5b4 --- /dev/null +++ b/src/views/Login.jsx @@ -0,0 +1,30 @@ +import { SignInButton, SignOutButton } from '../api/useAuth'; +import { useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; + +function Login({ user }) { + const navigate = useNavigate(); + + useEffect(() => { + if (user) { + navigate('/'); + } + }, [user]); + + return ( +
+
+
+ Shopping app logo +
+
+
+ +
+
+
+
+ ); +} + +export default Login; From c99a06f5c794eccd763531866dfc7859ff9f8406 Mon Sep 17 00:00:00 2001 From: Jonathan O'Riordan Date: Sat, 5 Oct 2024 18:23:41 +0100 Subject: [PATCH 2/3] Fixed: styling and refresh issue --- public/grocerease-light.png | Bin 0 -> 5372 bytes public/grocerease.png | Bin 13720 -> 5379 bytes src/api/useAuth.jsx | 25 +++++++++++++++++++++---- src/utils/ProtectedRoutes.jsx | 7 +++++-- src/views/Login.jsx | 19 +++++++++++-------- 5 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 public/grocerease-light.png diff --git a/public/grocerease-light.png b/public/grocerease-light.png new file mode 100644 index 0000000000000000000000000000000000000000..331194004282d66f97f70ef7548775a2759f7f0f GIT binary patch literal 5372 zcmb7|Ra6uX(Dp@8LKpB)NGu^BAmJh*3%jr`N+}^ANOvsVOSgamE=YGvtxI?3f^?_k z(hExoBKdmpo$va6&zX7VW-ewf=A37KU*4<811Oj%?%cTpP*ixM{;!_=OGC2z|Mbj_ zgX+#5+AhU6@DH9u`x$yJ3vy{;O+>q|6g5p8Hm3(El*-zFTbS}BJ}i>OghG+$|>*pM88tGw^lg1p$`c*D}-U5sCqVh=K^$|xloUjD%0tboQlzUG? zF3WCD$=CEJO8=H#U*94p1!YC6*v+#Oye!&0y$u#k--tYrx&L(r1`AKQmKo}6zIGTJ z42}u4MQJiJ7-+cW=aRq`Lj8}gXJ8(OHKkuKi>`42brk88S(jUN=LkNtc^lMcp$8tB zs-R_2-(}EZ)+uo799GMwM>HwdBAoijzU@nvpeEU3`O#tMUy7>axz3Ejvdu1;t8j9X zS;WbEy6mG(*t0&-GRO()Q=}z50h)7`j-J+7Qhz70bv11V#LUby_wxK5Mo$(CKYDbV zy%|MTbttPIw!$`(v9!2100ctQVBDqS-cY|aRVnazaEpABt$Oqqx)X@ay4C#X zN7AgHpW~}3Kg&<%50D-)5E&6gbTeq+Gjfw$re3?jmF9+W{(AevXVc!ARNSO~N(ssuJjiUn_HKfC+aP^Lt#z)fRFg8niO0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@J*+|LLD{Fi={oX+~Lqealf;3 zXWSn~m~^p{FBAybwEkc@d!+68FrZf;`@=ux#aX`ks!LR6h`xhXYfamgf~wk-2b!td zV`E7n5n{f_;0aXfQ|Pm9ZEHWGEwJBP&KXfWN%V&*`z9RmnDg!l!Pvr1nQl;`_GL4+ zU3-hUAf}67lXgh9dsGVts^k6JgSy*xNVP2G>1bVXE!fh8N^{j0Lfo=fS@TG_Gz}hA zS&RGg5Wcj9jPJn*bT>H85y{SI1haF!u4Av}b)c)}U3)IC_HRxjz(Z~|pK+=djF-dz ig%SRLn%GKl!*+!apwK1Kg8ieKcNAq+-jvE12mcQjn1+A= literal 0 HcmV?d00001 diff --git a/public/grocerease.png b/public/grocerease.png index 7531031026b11f428ff50a4cfaa26d38c84e476e..49783f86b91c2a8b3b83a70738f3c2fa25a3483a 100644 GIT binary patch literal 5379 zcma)=S2!CE*v0L=TC*{`XloP+F-omg%}}aFtd^iwjUsk!HCv++t0=0rgxdV6o!Bcj zQHi}*1z*3r@A7+|bKdj3@5Q-)f3XJon#>FU1~M`-W~~<*FaPD?KU>k!{F^7(B5WxF4B`XZUS#o1s&M(g8t1}0IJGO}ih)tFdCb}1?G z26FYIxB=0s=CJhF!`{CWctZ>O1Fp=>JPlKS)_lK7b3wY}qILWkk(MSh)aND5en*v! z>i?|>+_x8O5xinKBv&KnAf8K@DsH{}YKVN^_Q_4EWnq8Qrjr!n{do@!Afp;fQsVUq zZJd|htD~frKiAu1{Lerrq1A6M+N7+beroyhj9|i&J6HCHW?f*rW2qSbIdP;J+rbZ_ zMA}Ca8RYF(H>qy3$EOJLU(XRLKNN~W0-Ue6x$Cog=AO3UlW3gg3vS)%5St6Ql6zvt z6!z_Ce{1-#@w)mLL-%d;=((sLI-KVEsD$m^$XO==CW?6jV?50n0`ab`JoSFiZoV#J z9NLxArj~4Lb?UH9&yD@pRCbb8GFhKFtAJVeJ zbi4{1{5bvMjHOw*!gk6OuJen0=P-#pdfUcnt_)!zQvyn>$?O~C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4jBOJNu!BI$bg|Hd!A)9>IF zteJ=TUu%YgRJBu&r_fPb5wlEP$3}iOc-u|&$uKcva~W@`9`AqoYi=$Mza#1ok1I&3 zOGBvziMN2V_Sf zQOAiq(=3uB)wVk_Xh$^U#%##{&55T06`WSV&~jbfuovyMRM#wIyLmfxX<4fa{8w+g zSL-c~OOg6&JUBlZ!tG(&gC9i%2T=B^^Y3*c6)wq|GbzxhDPDeY6X z1KcFT5@tU5`qw7?6Xr*;co{a^-LZ|$Pk9}ZFEG3C{GXy~pR=gayq~FS%?MMX`Fs21 q`N(xKjyv1Gnukw*2v~hYCM9{j7D3m^{&bt_nVggoxLm?0;Qs)y@Su(W diff --git a/src/api/useAuth.jsx b/src/api/useAuth.jsx index ca07ae6..45d78db 100644 --- a/src/api/useAuth.jsx +++ b/src/api/useAuth.jsx @@ -32,16 +32,33 @@ export const SignOutButton = () => ( * @see https://firebase.google.com/docs/auth/web/start#set_an_authentication_state_observer_and_get_user_data */ export const useAuth = () => { - const [user, setUser] = useState(null); + const [user, setUser] = useState(() => { + const storedUser = localStorage.getItem('user'); + return storedUser ? JSON.parse(storedUser) : null; + }); useEffect(() => { - auth.onAuthStateChanged((user) => { - setUser(user); + const unsubscribe = auth.onAuthStateChanged((user) => { if (user) { + setUser(user); + localStorage.setItem('user', JSON.stringify(user)); addUserToDatabase(user); + } else { + setUser(null); + localStorage.removeItem('user'); } }); + return () => unsubscribe(); }, []); - return { user }; + const signIn = async () => { + await signInWithPopup(auth, new GoogleAuthProvider()); + }; + + const signOut = async () => { + await auth.signOut(); + localStorage.removeItem('user'); + }; + + return { user, signIn, signOut }; }; diff --git a/src/utils/ProtectedRoutes.jsx b/src/utils/ProtectedRoutes.jsx index 699e57a..c78e76d 100644 --- a/src/utils/ProtectedRoutes.jsx +++ b/src/utils/ProtectedRoutes.jsx @@ -1,6 +1,9 @@ import { Outlet, Navigate } from 'react-router-dom'; +import { useAuth } from '../api/useAuth'; -const ProtectedRoutes = ({ user }) => { - return user ? : ; // Redirect to login if not authenticated +const ProtectedRoutes = ({}) => { + const { user } = useAuth(); + const isAuthenticated = user || localStorage.getItem('user'); + return isAuthenticated ? : ; // Redirect to login if not authenticated }; export default ProtectedRoutes; diff --git a/src/views/Login.jsx b/src/views/Login.jsx index b3fa5b4..f0fb585 100644 --- a/src/views/Login.jsx +++ b/src/views/Login.jsx @@ -1,8 +1,9 @@ -import { SignInButton, SignOutButton } from '../api/useAuth'; +import { useAuth } from '../api/useAuth'; import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; -function Login({ user }) { +function Login() { + const { user, signIn } = useAuth(); const navigate = useNavigate(); useEffect(() => { @@ -13,13 +14,15 @@ function Login({ user }) { return (
-
-
- Shopping app logo +
+
+ Shopping app logo
-
-
- +
+
+
From 60ffafcf45fc8b8dfad5d291ddff3046ac1a8306 Mon Sep 17 00:00:00 2001 From: marshjaja <114920895+marshjaja@users.noreply.github.com> Date: Sun, 6 Oct 2024 12:58:42 +0100 Subject: [PATCH 3/3] fix: resolve merge conflict --- src/App.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index c93d9df..dbcdfe9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -59,7 +59,9 @@ export function App() { /> } + element={ + + } /> + } path="/login" />