diff --git a/public/1.1.jpg b/public/1.1.jpg new file mode 100644 index 0000000..7a13c36 Binary files /dev/null and b/public/1.1.jpg differ diff --git a/public/16.9.jpg b/public/16.9.jpg new file mode 100644 index 0000000..b233cb6 Binary files /dev/null and b/public/16.9.jpg differ diff --git a/public/9.16.jpg b/public/9.16.jpg new file mode 100644 index 0000000..a771d66 Binary files /dev/null and b/public/9.16.jpg differ diff --git a/public/icons/homepage.svg b/public/icons/homepage.svg new file mode 100644 index 0000000..8aaa6f4 --- /dev/null +++ b/public/icons/homepage.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/App.js b/src/App.js index 2503c9c..e7390ed 100644 --- a/src/App.js +++ b/src/App.js @@ -10,6 +10,8 @@ import {FetchPOST} from './middlewares/Fetch'; import MusikBox from './components/MusikBox'; import NavRight from './components/NavRight'; import { I18nProvider } from './middlewares/Locale'; +import { Link } from 'react-router-dom'; +import { GSProvider } from './middlewares/GlobalState'; const cookie = new Cookies(); export default function App() { @@ -19,8 +21,9 @@ export default function App() { const [selectedMenu, setSelectedMenu] = useState(""); const [profile, setProfile] = useState(""); const [auth, setAuth] = useState(""); - const [rightPage, setRightPage] = useState("null"); + const [right, setRight] = useState("null"); const [locale, setLocale] = useState(''); + const [left, setLeft] = useState(''); const [pageMenusContent, setPageMenusContent] = useState("null"); // Yeni state @@ -55,7 +58,7 @@ export default function App() { setPageMenusContent(content); }; - const exports = {setRightPage, rightPage}; + const exports = {setRight, right, left, setLeft, profile}; if(auth === false){ return ( @@ -76,18 +79,16 @@ export default function App() { ) }else if(auth === true){ return ( - -
-
-
-
-
-
-
- -
+ + +
+
+
+
+
+ {left}
-
+
- -
-
- -
-
-
+ {/*
+
+ +
+
*/}
- -
- + + ); + // return ( + // + //
+ //
+ //
+ //
+ //
+ //
+ //
+ // + //
+ //
+ //
+ // + //
+ // + //
+ //
+ //
+ // + //
+ //
+ //
+ //
+ //
+ //
+ // + //
+ //
+ // ); } }; \ No newline at end of file diff --git a/src/components/Categories.jsx b/src/components/Categories.jsx index 17b0fd6..852d000 100644 --- a/src/components/Categories.jsx +++ b/src/components/Categories.jsx @@ -2,46 +2,37 @@ import React, { useEffect, useState } from 'react' import { Link, useParams } from 'react-router-dom' import { FetchPOST } from '../middlewares/Fetch'; -export default function Categories({data, changeMenu, selectedMenu, setSelectedMenu, isChangeMenu = false, pathname}) { - const [loading, setLoading] = useState(true); - const [cates, setCates] = useState([]); - const { cate } = useParams(); - const [selectedCate, setSelectedCate] = useState(0); +export default function Categories({cates, selectedMenu, setSelectedMenu, isChangeMenu = false, pathname}) { + const [loading, setLoading] = useState(false); - useEffect(() => { - if(!data){ - FetchPOST({ - port: 3001, - pathname: "/get/blogs/cate/all" - }) - .then(res => setCates(res)); - }; - - setLoading(false); - },[]); - - if(loading){return (
)}; - if(isChangeMenu === true && loading === false){ return ( -
- {changeMenu(0)}} className={'flex h-20 rounded-2xl bg-gray-200 aspect-square items-center justify-center cursor-pointer hover:bg-pc hover:bg-opacity-50 ' + ((selectedMenu === 0) && "bg-pc")}> - Genel +
+ {setSelectedMenu(0)}} className={'flex h-20 rounded-2xl bg-white items-center justify-center cursor-pointer hover:bg-pc hover:bg-opacity-50 ' + ((selectedMenu === 0) && 'bg-pc')}> + Genel { + (cates) && + cates.map(get => + {setSelectedMenu(get.id)}} key={get.id} className={'flex h-20 rounded-2xl bg-white items-center justify-center cursor-pointer hover:bg-pc hover:bg-opacity-50 ' + ((selectedMenu === get.id) && 'bg-pc')}> + {get.title} + + ) + } + {/* { (data) ? data.categories.map(get => ( - {changeMenu(get.id)}} className={'flex h-20 rounded-2xl bg-gray-200 aspect-square items-center justify-center cursor-pointer hover:bg-pc hover:bg-opacity-50 ' + ((selectedMenu === get.id) && "bg-pc")}> + {get.title} )) : cates.map(get => ( - {changeMenu(get.id)}} className={'flex h-20 rounded-2xl bg-gray-200 aspect-square items-center justify-center cursor-pointer hover:bg-pc hover:bg-opacity-50 ' + ((selectedMenu === get.id) && "bg-pc")}> + {get.title} )) - } + } */}
); }else if(isChangeMenu === false && loading === false){ @@ -58,4 +49,20 @@ export default function Categories({data, changeMenu, selectedMenu, setSelectedM
); }; -}; \ No newline at end of file +}; + +function changeCategory(id, categoriesIds, setData) { + if(id === 0){ + FetchPOST({ + port: 3001, + pathname: "/get/blogs/all" + }).then(res => setData(res)); + }else if(categoriesIds.includes(id)){ + FetchPOST({ + port: 3001, + pathname: "/get/blogs/" + id + }).then(res => setData(res)); + }else { + setData([]) + } + }; \ No newline at end of file diff --git a/src/components/Header.jsx b/src/components/Header.jsx index e4c2497..13aac6f 100644 --- a/src/components/Header.jsx +++ b/src/components/Header.jsx @@ -13,13 +13,13 @@ export default function Header(props) { }; return ( -
+
+ ); }; \ No newline at end of file diff --git a/src/components/NavLeft.jsx b/src/components/NavLeft.jsx index 55d8b5c..012eae3 100644 --- a/src/components/NavLeft.jsx +++ b/src/components/NavLeft.jsx @@ -6,12 +6,6 @@ import { I18nContext } from '../middlewares/Locale'; export default function NavLeft(props) { const { locale } = useContext(I18nContext) return ( -
-
- {menus.map(get => ( - props.setSelectedMenu(get.id)} className={'p-4 hover:bg-pc hover:bg-opacity-50 ' + (get.id === props.selectedMenu && 'bg-pc font-bold')}>{locale[get.title]} - ))} -
-
+ <> ) } \ No newline at end of file diff --git a/src/components/Pages.jsx b/src/components/Pages.jsx index eab3735..93417a9 100644 --- a/src/components/Pages.jsx +++ b/src/components/Pages.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import React, { useEffect, useState } from 'react' import {Routes, Route} from 'react-router-dom'; @@ -22,19 +22,32 @@ import Request from './profiles/Follow/Request'; import Default from './profiles/Follow/Default'; export default function Pages(props) { + const [pageTitle, setPageTitle] = useState(); + const importData = { - ...props + ...props, + pageTitle, + setPageTitle }; + useEffect(()=>{ + return () => { + setPageTitle(); + }; + },[]); + return (
+ {/*
+

{pageTitle}

+
*/} }/> }> }> }> }> - }> + }> }> }> @@ -54,7 +67,7 @@ export default function Pages(props) { }> - }> + }> }/> }/> diff --git a/src/components/Post.jsx b/src/components/Post.jsx index b28a78b..f9bd728 100644 --- a/src/components/Post.jsx +++ b/src/components/Post.jsx @@ -2,49 +2,82 @@ import React, { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import { FetchPOST } from '../middlewares/Fetch' import SavedButton from './blogs/posts/SavedButton'; +import { openPopup } from '../middlewares/PopupActions'; +import Photo from './popups/Photo'; export default function Post(props) { return ( -
-
-
-
-
-
- {props.data.user.first_name} {props.data.user.second_name} - {/* Takip Et */} -
-

{props.data.title}

+
+
+
+
+
+ +
+
+ {props.data.user.first_name} {props.data.user.second_name} + @{props.data.user.username}
-
-
- {/* data.blogsCate.title */} - (props.changeMenu) && props.changeMenu(props.data.category.id)}>{props.data.category.title} -

-

-

01.01.2024

-
-
- {/* Bildir */} -
+
+ {props.data.category.title}
-
- {props.data.text} +
+

{props.data.text}

-
-
- - {(false) ? -
- {/* Devamını Oku */} +
+ +
+
+ + Paylaş
- : "" - } - - -
+ //
+ //
+ //
+ //
+ //
+ //
+ // {props.data.user.first_name} {props.data.user.second_name} + // {/* Takip Et */} + //
+ //

{props.data.title}

+ //
+ //
+ //
+ //
+ // {/* data.blogsCate.title */} + // (props.changeMenu) && props.changeMenu(props.data.category.id)}>{props.data.category.title} + //

-

+ //

01.01.2024

+ //
+ //
+ // {/* Bildir */} + //
+ //
+ //
+ //
+ // {props.data.text} + //
+ //
+ // openPopup()} className='aspect-square object-cover rounded-2xl' src='/1.1.jpg'> + //
+ //
+ //
+ + // {(false) ? + //
+ // {/* Devamını Oku */} + //
+ // : "" + // } + + // + + //
+ //
) } \ No newline at end of file diff --git a/src/components/Posts.jsx b/src/components/Posts.jsx index 7a33ae8..fe0d635 100644 --- a/src/components/Posts.jsx +++ b/src/components/Posts.jsx @@ -1,8 +1,10 @@ -import React, { useEffect, useState } from 'react' +import React, { useContext, useEffect, useState } from 'react' import Post from './Post' import { FetchPOST } from '../middlewares/Fetch' import { Link, useOutletContext, useParams } from 'react-router-dom'; import Categories from './Categories'; +import { GSContext } from '../middlewares/GlobalState'; +import Right from './profiles/Right'; export default function Posts(props) { const [data, setData] = useState([]); @@ -12,10 +14,9 @@ export default function Posts(props) { const [cates, setCates] = useState([]); const [selectedCate, setSelectedCate] = useState(""); const { selectedMenu, setSelectedMenu, profileMenus, username } = useOutletContext(); + const { exports } = useContext(GSContext); useEffect(() => { - profileMenus.map(res => res.path === props.uid && setSelectedMenu(res.id)); - if(cate){ FetchPOST({ port: 3001, @@ -24,6 +25,7 @@ export default function Posts(props) { setData(res) if(res.length > 0){ setLoading(false); + setSelectedCate(0) }; }); }else{ @@ -31,19 +33,22 @@ export default function Posts(props) { port: 3001, pathname: "/get/blogs/user/" + username }).then(res => { - setData(res) + setData(res); if(res.length > 0){ setLoading(false); + setSelectedCate(0) }; }); }; - + FetchPOST({ - port: 3001, - pathname: "/get/blogs/cate/all" + port: 3001, + pathname: "/get/blogs/cate/all" }) .then(res => { setCates(res); + console.log(46, selectedCate) + exports.setRight(}>); res.map(get => { if(get.title.toLowerCase() === cate){ @@ -52,17 +57,11 @@ export default function Posts(props) { setSelectedCate(0); }; }); - }); - - },[cate]); return (
-
- -
{ (!loading) ? data.map(get => ) @@ -73,5 +72,5 @@ export default function Posts(props) {
}
- ) + ); }; \ No newline at end of file diff --git a/src/components/ProfileDetail.jsx b/src/components/ProfileDetail.jsx index 3659e48..394f8d5 100644 --- a/src/components/ProfileDetail.jsx +++ b/src/components/ProfileDetail.jsx @@ -1,10 +1,12 @@ -import React, { useEffect, useState } from 'react' -import {Outlet, useParams} from 'react-router-dom'; +import React, { useContext, useEffect, useState } from 'react' +import {Link, Outlet, useParams} from 'react-router-dom'; import { FetchPOST } from '../middlewares/Fetch'; import Menus from './profiles/components/Menus'; import Header from './profiles/components/Header'; +import { GSContext } from '../middlewares/GlobalState'; +import Left from './profiles/Left'; -export default function ProfileDetail({uid}) { +export default function ProfileDetail({uid, setLeft}) { const profileMenus = [{ id: 1, title: "Gönderiler", @@ -33,18 +35,12 @@ export default function ProfileDetail({uid}) { console.log(res) if(res){ setData(res); + setLeft() setLoading(false); }else{ setData(true); }; }); - - // FetchPOST({ - // port: 3001, - // pathname: "/get/user/my" - // }).then(res => { - // setMyData(res); - // }); return () => { setData([]); @@ -61,10 +57,10 @@ export default function ProfileDetail({uid}) { return (
-
- + {/*
*/} + {/* */} -
+
{ (data.user) && } diff --git a/src/components/ProfileMenuBox.jsx b/src/components/ProfileMenuBox.jsx index a01500c..fd2c4c8 100644 --- a/src/components/ProfileMenuBox.jsx +++ b/src/components/ProfileMenuBox.jsx @@ -1,8 +1,25 @@ -import React from 'react' +import React, { useContext } from 'react' import { Link } from 'react-router-dom' +import { GSContext } from '../middlewares/GlobalState'; export default function ProfileMenuBox(props) { + const { profile } = useContext(GSContext); + + console.log(profile) + return ( - {props.setSelectedMenu(0)}} className={'flex items-center justify-center h-full w-full hover:bg-pc hover:bg-opacity-50 ' + (props.selectedMenu === 0 && 'bg-pc font-bold')}>{props.profile.first_name} {props.profile.second_name} + + +
+
+

{profile.first_name} {profile.second_name}

+

@{profile.username}

+
+
+ {/*

{profile.followers} Takipçi

*/} + {/*

30 Takip

*/} +
+
+ ); }; \ No newline at end of file diff --git a/src/components/blogs/Right.jsx b/src/components/blogs/Right.jsx new file mode 100644 index 0000000..ea0b082 --- /dev/null +++ b/src/components/blogs/Right.jsx @@ -0,0 +1,27 @@ +import React, { useEffect, useState } from 'react' +import Categories from '../Categories' +import { FetchPOST } from '../../middlewares/Fetch'; +import { Link } from 'react-router-dom'; + +export default function Right(props) { + const [selectedMenu, setSelectedMenu] = useState(0); + const [cates, setCates] = useState(); + + useEffect(()=>{ + if(!cates){ + FetchPOST({ + port: 3001, + pathname: "/get/blogs/cate/all" + }) + .then(res => setCates(res)); + } + console.log(cates) + },[]) + + return ( + <> + Gönderi Oluştur + + + ); +}; \ No newline at end of file diff --git a/src/components/blogs/posts/SavedButton.jsx b/src/components/blogs/posts/SavedButton.jsx index e6ff32b..88fb063 100644 --- a/src/components/blogs/posts/SavedButton.jsx +++ b/src/components/blogs/posts/SavedButton.jsx @@ -4,7 +4,7 @@ import { FetchPOST } from '../../../middlewares/Fetch'; export default function SavedButton({blogId, saved}) { const [isSaved, setIsSaved] = useState((saved.length > 0) && saved[0].statu); return ( -

{setIsSaved(await saveBlog(blogId))}}> +

{setIsSaved(await saveBlog(blogId))}}> {(isSaved) ? 'Kaydettin' : 'Kaydet'}

) diff --git a/src/components/homepage/Left.jsx b/src/components/homepage/Left.jsx new file mode 100644 index 0000000..27a85b4 --- /dev/null +++ b/src/components/homepage/Left.jsx @@ -0,0 +1,46 @@ +import React from 'react' +import ProfileMenuBox from '../ProfileMenuBox' +import { Link } from 'react-router-dom' + +export default function Left({profile, selectedMenu, setSelectedMenu}) { + return ( + <> +
+ +
+
+
    +
  • +
    + + + + +

    Anasayfa

    + + Gönderiler + Keşfet +
    +
    +
  • +
  • + Mesajlar + Bildirimler +
  • +
+
+
+
    +
  • +
    + Yardım + Hakkında + Gizlilik Politikası + Hizmet Standartları +
    +
  • +
+
+ + ) +} diff --git a/src/components/popups/Photo.jsx b/src/components/popups/Photo.jsx new file mode 100644 index 0000000..47c701e --- /dev/null +++ b/src/components/popups/Photo.jsx @@ -0,0 +1,15 @@ +import React from 'react' +import { closePopup } from '../../middlewares/PopupActions' + +export default function Photo({src}) { + return ( +
+
+

Kapat

+
+
+ +
+
+ ); +}; \ No newline at end of file diff --git a/src/components/profiles/Follow/components/User.jsx b/src/components/profiles/Follow/components/User.jsx index d4989b6..739015a 100644 --- a/src/components/profiles/Follow/components/User.jsx +++ b/src/components/profiles/Follow/components/User.jsx @@ -26,8 +26,8 @@ export default function User({data, button, buttonAction, uid="default"}) {

@{data.username}

- {buttonAction(e, data.id, "accept")}}>Kabul Et - {buttonAction(e, data.id, "reject")}}>Reddet +

{buttonAction(e, data.id, "accept")}}>Kabul Et

+

{buttonAction(e, data.id, "reject")}}>Reddet

); diff --git a/src/components/profiles/Left.jsx b/src/components/profiles/Left.jsx new file mode 100644 index 0000000..bac6f3d --- /dev/null +++ b/src/components/profiles/Left.jsx @@ -0,0 +1,94 @@ +import React from 'react' +import { Link } from 'react-router-dom' +import { FetchPOST } from '../../middlewares/Fetch'; + +export default function Left({profile}) { + const friendPOST = (e) => { + FetchPOST({ + port: 3001, + pathname: "/post/follow", + fetchData:{ + method: "POST", + credentials: 'include', + headers: { + 'Accept' : 'application/json', + 'Content-Type' : 'application/json' + }, + body: JSON.stringify({ + userId: profile.user.id + }) + } + }).then(res => { + if(res.follow){ + e.target.innerText = res.follow.title; + console.log(res) + if(res.follow.statu === true){ + console.log(5) + e.target.classList.add("bg-pc", "bg-opacity-40") + } + }; + }); + }; + + return ( + <> +
+ +
+
+ +
+ +

{profile.user.first_name} {profile.user.second_name}

+

@{profile.user.username}

+ +
+ {profile.user.followers.length} Takipçi + {profile.user.followings.length} Takip +
+
+
+
+ { + (profile.isMy === false) && +
+

{(profile.user.follows.length > 0) ? profile.user.follows[0].button.text : profile.user.button.text}

+
+ } +
+
+
+
+
+

Hakkında

+
+
+
+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid, ullam accusantium provident iure consequuntur reprehenderit laborum aut aspernatur laboriosam repellat iusto nisi veniam sapiente vitae aperiam nobis dolorum ipsa temporibus.

+
+
+
+
+

Fotoğraflar

+
+
+
+ + + + + + + + + +
+
+

Tümünü Gör

+
+
+ + + ); +}; + diff --git a/src/components/profiles/Right.jsx b/src/components/profiles/Right.jsx new file mode 100644 index 0000000..0db5783 --- /dev/null +++ b/src/components/profiles/Right.jsx @@ -0,0 +1,23 @@ +import React, { useEffect } from 'react' +import { Link } from 'react-router-dom' + +export default function Right({pathname, plugin}) { + console.log(plugin) + return ( +
+ {plugin} +
+
    +
  • +
    + Özetleme +
    +
    + Gönderiler +
    +
  • +
+
+
+ ) +} diff --git a/src/components/profiles/components/Header.jsx b/src/components/profiles/components/Header.jsx index cac2a03..d3f4a4b 100644 --- a/src/components/profiles/components/Header.jsx +++ b/src/components/profiles/components/Header.jsx @@ -60,7 +60,7 @@ export default function Header({data}) { { (data.isMy === false) &&
- {(data.user.follows.length > 0) ? data.user.follows[0].button.text : data.user.button.text} +

{(data.user.follows.length > 0) ? data.user.follows[0].button.text : data.user.button.text}

}
diff --git a/src/components/profiles/posts/RightPlugin.jsx b/src/components/profiles/posts/RightPlugin.jsx new file mode 100644 index 0000000..e4f6137 --- /dev/null +++ b/src/components/profiles/posts/RightPlugin.jsx @@ -0,0 +1,11 @@ +import React, { useContext, useEffect } from 'react' +import { GSContext } from '../../../middlewares/GlobalState'; + +export default function RightPlugin({cates, selectedMenu, setSelectedMenus, pathname}) { + // const { exports } = useContext(GSContext); + + return ( +
+
+ ); +}; \ No newline at end of file diff --git a/src/index.css b/src/index.css index 9f84246..ba633ab 100644 --- a/src/index.css +++ b/src/index.css @@ -3,8 +3,15 @@ @import "tailwindcss/components"; @import "tailwindcss/utilities"; +*{ + margin: 0; + padding: 0; + box-sizing: border-box; +} + body{ - background: var(--bg-pc); + background: #f3f4f6; + font-size: smaller; } .aspect-square{ @@ -15,6 +22,10 @@ body{ grid-column: 1fr; } +.page-container{ + width: 1440px; +} + :root{ --navbar-p: 1rem; --bg-pc:#cff9ff; diff --git a/src/middlewares/GlobalState.jsx b/src/middlewares/GlobalState.jsx new file mode 100644 index 0000000..3296a48 --- /dev/null +++ b/src/middlewares/GlobalState.jsx @@ -0,0 +1,14 @@ +import { createContext, useEffect, useState } from 'react'; +import { FetchPOST } from './Fetch'; + +const GSContext = createContext(); + +const GSProvider = ({ children, profile, exports }) => { + return ( + + {children} + + ); +}; + +export { GSProvider, GSContext }; \ No newline at end of file diff --git a/src/pages/Blogs.jsx b/src/pages/Blogs.jsx index 9480ca5..a8bede7 100644 --- a/src/pages/Blogs.jsx +++ b/src/pages/Blogs.jsx @@ -1,10 +1,13 @@ -import React, { useEffect, useState } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { FetchPOST } from '../middlewares/Fetch'; import Post from '../components/Post'; import { useParams } from 'react-router-dom'; import { openPopup } from '../middlewares/PopupActions'; import Categories from '../components/Categories'; import WriteBoxPopup from '../components/WriteBoxPopup'; +import { GSContext } from '../middlewares/GlobalState'; +import Right from '../components/blogs/Right'; +import Left from '../components/homepage/Left'; export default function Blogs({importData}) { const [data, setData] = useState(); @@ -12,10 +15,13 @@ export default function Blogs({importData}) { const [selectedMenu, setSelectedMenu] = useState(0); const [loading, setLoading] = useState(true); const { cate } = useParams(); + const { exports, profile } = useContext(GSContext); useEffect(() => { - importData.setSelectedMenu(2) + importData.setSelectedMenu(2); + importData.setPageTitle("Gönderiler"); + if(cate === undefined){ FetchPOST({ port: 3001, @@ -31,6 +37,8 @@ export default function Blogs({importData}) { setData(res.blogs) setPageData(res); setLoading(false); + importData.exports.setLeft(); + exports.setRight(); }); }else if(cate){ FetchPOST({ @@ -44,9 +52,17 @@ export default function Blogs({importData}) { setLoading(false); changeCategory(res.currentCategory.id, categoriesIds, setData); setSelectedMenu(res.currentCategory.id); + exports.setRight(); }); } },[cate]); + + useEffect(() => { + return () => { + exports.setRight(); + importData.setPageTitle(""); + } + },[]) const changeMenu = (id) => { const categoriesIds = pageData.categories.map(get => get.id); @@ -60,13 +76,7 @@ export default function Blogs({importData}) { }; return ( -
-
- -

openPopup()} className={'flex h-20 rounded-2xl bg-gray-200 aspect-square items-center justify-center text-center cursor-pointer hover:bg-pc hover:bg-opacity-50'}> - Gönderi Yayınla -

-
+
{ (data) && data.map(get =>
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index b200424..72617bf 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -1,12 +1,24 @@ -import React, { useContext, useEffect } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { I18nContext } from '../middlewares/Locale'; +import Left from '../components/homepage/Left'; +import { GSContext } from '../middlewares/GlobalState'; export default function Home({importData}) { const { locale } = useContext(I18nContext); + const { profile } = useContext(GSContext); + + const [loading, setLoading] = useState(true); useEffect(() => { importData.setSelectedMenu(1); + importData.exports.setLeft(); + importData.setPageTitle("Anasayfa") + setLoading(false); },[]); + + if(loading){ + return(<>) + }; return (
diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx index 446a7cd..f01f2b6 100644 --- a/src/pages/Profile.jsx +++ b/src/pages/Profile.jsx @@ -1,13 +1,18 @@ -import React, { useEffect, useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { FetchPOST } from '../middlewares/Fetch'; import ProfileDetail from '../components/ProfileDetail'; +import { GSContext } from '../middlewares/GlobalState'; +import Right from '../components/profiles/Right'; -export default function Profile({selectedMenu, setSelectedMenu, uid}) { +export default function Profile({selectedMenu, setSelectedMenu, uid, importData}) { const { username } = useParams(); + const { exports } = useContext(GSContext); + useEffect(() => { + exports.setRight() if(!username){ FetchPOST({ port: 3001, @@ -16,11 +21,14 @@ export default function Profile({selectedMenu, setSelectedMenu, uid}) { (get.user.username) ? setSelectedMenu(0) : setSelectedMenu(""); }); }; + return () => { + exports.setRight(); + }; },[]); return (
- +
); }; \ No newline at end of file