diff --git a/src/assets/MacBookPro.svg b/src/assets/MacBookPro.svg index 4448809..16126b5 100644 --- a/src/assets/MacBookPro.svg +++ b/src/assets/MacBookPro.svg @@ -3,20 +3,20 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -25,7 +25,7 @@ - + @@ -39,11 +39,11 @@ - + - + @@ -58,20 +58,20 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -83,20 +83,20 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -105,7 +105,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -127,27 +127,27 @@ - + - - - - - - - - - - + + + + + + + + + + - + @@ -156,7 +156,7 @@ - + @@ -164,7 +164,7 @@ - + @@ -178,11 +178,11 @@ - + - + @@ -205,27 +205,27 @@ - - - - - - - - - - + + + + + + + + + + - + - + @@ -233,7 +233,7 @@ - + @@ -247,11 +247,11 @@ - + - + @@ -263,38 +263,38 @@ - + - + - + - - - - - - - - - - + + + + + + + + + + - + - + @@ -302,7 +302,7 @@ - + @@ -316,69 +316,69 @@ - + - + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - - - + + + - + - + @@ -386,9 +386,9 @@ - + - + @@ -402,34 +402,34 @@ - + - - + + - + - + - + - + - - + + - - + + @@ -450,18 +450,18 @@ - - + + - - + + - - + + @@ -477,8 +477,8 @@ - - + + @@ -505,8 +505,8 @@ - - + + @@ -527,23 +527,23 @@ - - + + - - + + - - + + - - + + @@ -564,18 +564,18 @@ - - + + - - + + - - + + @@ -591,8 +591,8 @@ - - + + @@ -613,18 +613,18 @@ - - + + - - + + - - + + @@ -640,8 +640,8 @@ - - + + @@ -662,23 +662,23 @@ - - + + - - + + - - + + - - + + @@ -686,8 +686,8 @@ - - + + diff --git a/src/assets/bgoverherosection.png b/src/assets/bgoverherosection.png new file mode 100644 index 0000000..0c5d409 Binary files /dev/null and b/src/assets/bgoverherosection.png differ diff --git a/src/components/shared/GetUser.ts b/src/components/shared/GetUser.ts new file mode 100644 index 0000000..b89c004 --- /dev/null +++ b/src/components/shared/GetUser.ts @@ -0,0 +1,14 @@ +export const GetUser = () => { + let user = null; + const userRaw = localStorage.getItem('sp_user'); + if (userRaw) { + try { + const userObj = JSON.parse(userRaw); + user = userObj?.email || null; + return user + } catch (e) { + user = null; + return null + } + } +} diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 6cd5f45..50ae768 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,23 +1,25 @@ import { useState } from 'react' import Herosection from "../assets/herosection.svg" +import Bgoverherosection from "../assets/bgoverherosection.png" import DashboardPreview from "../assets/MacBookPro.svg" import { Link, useNavigate } from 'react-router-dom' import { useAppDispatch, useAppSelector } from '../store/hooks' import { setUrl } from '../store/urlSlice' +import { GetUser } from '../components/shared/GetUser' const HomePage = () => { const [urlInput, setUrlInput] = useState('') const navigate = useNavigate() const dispatch = useAppDispatch() - const user = JSON.parse(localStorage.getItem('sp_user') || '').email + // const user = useAppSelector((state) => state.url.isLoggedIn); // or change to your auth state const handleButtonClick = () => { if (urlInput.trim()) { dispatch(setUrl(urlInput.trim())) - if (user) { + if (GetUser()) { navigate('/keywords'); } else navigate('/login') @@ -28,11 +30,11 @@ const HomePage = () => {
+ style={{ background: `url(${Bgoverherosection})`, backgroundSize: 'cover', backgroundPosition: 'center' }} />