Diller eklendi.
This commit is contained in:
parent
0c9683cb60
commit
fdf64f705f
98
package-lock.json
generated
98
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
"cra-template": "1.2.0",
|
||||
"i18n": "^0.15.1",
|
||||
"react": "^19.0.0",
|
||||
"react-audio-player": "^0.17.0",
|
||||
"react-dom": "^19.0.0",
|
||||
@ -2775,6 +2776,45 @@
|
||||
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz",
|
||||
"integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw=="
|
||||
},
|
||||
"node_modules/@messageformat/core": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@messageformat/core/-/core-3.4.0.tgz",
|
||||
"integrity": "sha512-NgCFubFFIdMWJGN5WuQhHCNmzk7QgiVfrViFxcS99j7F5dDS5EP6raR54I+2ydhe4+5/XTn/YIEppFaqqVWHsw==",
|
||||
"dependencies": {
|
||||
"@messageformat/date-skeleton": "^1.0.0",
|
||||
"@messageformat/number-skeleton": "^1.0.0",
|
||||
"@messageformat/parser": "^5.1.0",
|
||||
"@messageformat/runtime": "^3.0.1",
|
||||
"make-plural": "^7.0.0",
|
||||
"safe-identifier": "^0.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@messageformat/date-skeleton": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@messageformat/date-skeleton/-/date-skeleton-1.1.0.tgz",
|
||||
"integrity": "sha512-rmGAfB1tIPER+gh3p/RgA+PVeRE/gxuQ2w4snFWPF5xtb5mbWR7Cbw7wCOftcUypbD6HVoxrVdyyghPm3WzP5A=="
|
||||
},
|
||||
"node_modules/@messageformat/number-skeleton": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@messageformat/number-skeleton/-/number-skeleton-1.2.0.tgz",
|
||||
"integrity": "sha512-xsgwcL7J7WhlHJ3RNbaVgssaIwcEyFkBqxHdcdaiJzwTZAWEOD8BuUFxnxV9k5S0qHN3v/KzUpq0IUpjH1seRg=="
|
||||
},
|
||||
"node_modules/@messageformat/parser": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@messageformat/parser/-/parser-5.1.1.tgz",
|
||||
"integrity": "sha512-3p0YRGCcTUCYvBKLIxtDDyrJ0YijGIwrTRu1DT8gIviIDZru8H23+FkY6MJBzM1n9n20CiM4VeDYuBsrrwnLjg==",
|
||||
"dependencies": {
|
||||
"moo": "^0.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@messageformat/runtime": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@messageformat/runtime/-/runtime-3.0.1.tgz",
|
||||
"integrity": "sha512-6RU5ol2lDtO8bD9Yxe6CZkl0DArdv0qkuoZC+ZwowU+cdRlVE1157wjCmlA5Rsf1Xc/brACnsZa5PZpEDfTFFg==",
|
||||
"dependencies": {
|
||||
"make-plural": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nicolo-ribaudo/eslint-scope-5-internals": {
|
||||
"version": "5.1.1-v1",
|
||||
"resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz",
|
||||
@ -7347,6 +7387,14 @@
|
||||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
|
||||
},
|
||||
"node_modules/fast-printf": {
|
||||
"version": "1.6.10",
|
||||
"resolved": "https://registry.npmjs.org/fast-printf/-/fast-printf-1.6.10.tgz",
|
||||
"integrity": "sha512-GwTgG9O4FVIdShhbVF3JxOgSBY2+ePGsu2V/UONgoCPzF9VY6ZdBMKsHKCYQHZwNk3qNouUolRDsgVxcVA5G1w==",
|
||||
"engines": {
|
||||
"node": ">=10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-uri": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz",
|
||||
@ -8427,6 +8475,25 @@
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/i18n": {
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmjs.org/i18n/-/i18n-0.15.1.tgz",
|
||||
"integrity": "sha512-yue187t8MqUPMHdKjiZGrX+L+xcUsDClGO0Cz4loaKUOK9WrGw5pgan4bv130utOwX7fHE9w2iUeHFalVQWkXA==",
|
||||
"dependencies": {
|
||||
"@messageformat/core": "^3.0.0",
|
||||
"debug": "^4.3.3",
|
||||
"fast-printf": "^1.6.9",
|
||||
"make-plural": "^7.0.0",
|
||||
"math-interval-parser": "^2.0.1",
|
||||
"mustache": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/mashpie"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
@ -10422,6 +10489,11 @@
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/make-plural": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-7.4.0.tgz",
|
||||
"integrity": "sha512-4/gC9KVNTV6pvYg2gFeQYTW3mWaoJt7WZE5vrp1KnQDgW92JtYZnzmZT81oj/dUTqAIu0ufI2x3dkgu3bB1tYg=="
|
||||
},
|
||||
"node_modules/makeerror": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
||||
@ -10430,6 +10502,14 @@
|
||||
"tmpl": "1.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/math-interval-parser": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/math-interval-parser/-/math-interval-parser-2.0.1.tgz",
|
||||
"integrity": "sha512-VmlAmb0UJwlvMyx8iPhXUDnVW1F9IrGEd9CIOmv+XL8AErCUUuozoDMrgImvnYt2A+53qVX/tPW6YJurMKYsvA==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
@ -10615,6 +10695,11 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/moo": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
|
||||
"integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q=="
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
@ -10632,6 +10717,14 @@
|
||||
"multicast-dns": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mustache": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
|
||||
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
|
||||
"bin": {
|
||||
"mustache": "bin/mustache"
|
||||
}
|
||||
},
|
||||
"node_modules/mz": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
|
||||
@ -13845,6 +13938,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/safe-identifier": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-identifier/-/safe-identifier-0.4.2.tgz",
|
||||
"integrity": "sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w=="
|
||||
},
|
||||
"node_modules/safe-push-apply": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
"cra-template": "1.2.0",
|
||||
"i18n": "^0.15.1",
|
||||
"react": "^19.0.0",
|
||||
"react-audio-player": "^0.17.0",
|
||||
"react-dom": "^19.0.0",
|
||||
|
||||
88
src/App.js
88
src/App.js
@ -9,6 +9,7 @@ import Cookies from 'universal-cookie';
|
||||
import {FetchPOST} from './middlewares/Fetch';
|
||||
import MusikBox from './components/MusikBox';
|
||||
import NavRight from './components/NavRight';
|
||||
import { I18nProvider } from './middlewares/Locale';
|
||||
const cookie = new Cookies();
|
||||
|
||||
export default function App() {
|
||||
@ -19,6 +20,7 @@ export default function App() {
|
||||
const [profile, setProfile] = useState("");
|
||||
const [auth, setAuth] = useState("");
|
||||
const [rightPage, setRightPage] = useState("null");
|
||||
const [locale, setLocale] = useState('');
|
||||
|
||||
const [pageMenusContent, setPageMenusContent] = useState("null"); // Yeni state
|
||||
|
||||
@ -27,7 +29,10 @@ export default function App() {
|
||||
port: 3001,
|
||||
pathname: "/get/user/my"
|
||||
})
|
||||
.then(res => setProfile(res.user));
|
||||
.then(res => {
|
||||
setProfile(res.user);
|
||||
setLocale(res.user.locale);
|
||||
});
|
||||
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
@ -50,60 +55,65 @@ export default function App() {
|
||||
setPageMenusContent(content);
|
||||
};
|
||||
|
||||
const exports = {setRightPage, rightPage}
|
||||
const exports = {setRightPage, rightPage};
|
||||
|
||||
if(auth === false){
|
||||
return (
|
||||
<div>
|
||||
<Header title={title} description={description} backEnd_URL={backEnd_URL} auth={auth}/>
|
||||
<div className='flex flex-col h-screen overflow-hidden p-4'>
|
||||
<div className='flex flex-col h-screen overflow-hidden gap-4'>
|
||||
<div className='grid grid-cols-5 h-full overflow-hidden gap-4'>
|
||||
<div className='flex items-center justify-center col-span-5 h-full overflow-y-scroll bg-white rounded-2xl p-4'>
|
||||
<Login auth={auth} setAuth={setAuth}/>
|
||||
<I18nProvider locale={locale}>
|
||||
<div>
|
||||
<Header title={title} description={description} backEnd_URL={backEnd_URL} auth={auth}/>
|
||||
<div className='flex flex-col h-screen overflow-hidden p-4'>
|
||||
<div className='flex flex-col h-screen overflow-hidden gap-4'>
|
||||
<div className='grid grid-cols-5 h-full overflow-hidden gap-4'>
|
||||
<div className='flex items-center justify-center col-span-5 h-full overflow-y-scroll bg-white rounded-2xl p-4'>
|
||||
<Login auth={auth} setAuth={setAuth}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</I18nProvider>
|
||||
)
|
||||
}else if(auth === true){
|
||||
return (
|
||||
<div className='flex flex-col h-screen overflow-hidden'>
|
||||
<Header title={title} description={description} backEnd_URL={backEnd_URL} auth={auth}/>
|
||||
<div className='flex flex-col h-screen overflow-hidden p-4'>
|
||||
<div className='flex flex-col h-screen overflow-hidden gap-4'>
|
||||
<div className='grid grid-cols-5 h-full overflow-hidden gap-4'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex bg-white h-full rounded-2xl overflow-hidden'>
|
||||
<NavLeft selectedMenu={selectedMenu} setSelectedMenu={setSelectedMenu}/>
|
||||
<I18nProvider locale={locale} setLocale={setLocale} localeCode={locale}>
|
||||
<div className='flex flex-col h-screen overflow-hidden'>
|
||||
<Header title={title} description={description} backEnd_URL={backEnd_URL} auth={auth}/>
|
||||
<div className='flex flex-col h-screen overflow-hidden p-4'>
|
||||
<div className='flex flex-col h-screen overflow-hidden gap-4'>
|
||||
<div className='grid grid-cols-5 h-full overflow-hidden gap-4'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex bg-white h-full rounded-2xl overflow-hidden'>
|
||||
<NavLeft selectedMenu={selectedMenu} setSelectedMenu={setSelectedMenu}/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex col-start-2 col-end-5 h-full overflow-y-scroll bg-white rounded-2xl border-8 border-white'>
|
||||
<Pages
|
||||
selectedMenu={selectedMenu}
|
||||
setSelectedMenu={setSelectedMenu}
|
||||
profile={profile}
|
||||
auth={auth}
|
||||
setAuth={setAuth}
|
||||
exports={exports}
|
||||
locale={locale}
|
||||
/>
|
||||
</div>
|
||||
<div id='page-menus' className='flex bg-white h-full rounded-2xl overflow-hidden'>
|
||||
<NavRight/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex col-start-2 col-end-5 h-full overflow-y-scroll bg-white rounded-2xl border-8 border-white'>
|
||||
<Pages
|
||||
selectedMenu={selectedMenu}
|
||||
setSelectedMenu={setSelectedMenu}
|
||||
profile={profile}
|
||||
auth={auth}
|
||||
setAuth={setAuth}
|
||||
exports={exports}
|
||||
/>
|
||||
<div className='grid grid-cols-5 h-16 gap-4'>
|
||||
<div className='flex bg-white rounded-2xl overflow-hidden'>
|
||||
<ProfileMenuBox selectedMenu={selectedMenu} setSelectedMenu={setSelectedMenu} profile={profile}/>
|
||||
</div>
|
||||
<div className='flex col-start-2 col-end-5 bg-white rounded-2xl'></div>
|
||||
<div className='flex bg-white rounded-2xl'></div>
|
||||
</div>
|
||||
<div id='page-menus' className='flex bg-white h-full rounded-2xl overflow-hidden'>
|
||||
<NavRight/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='grid grid-cols-5 h-16 gap-4'>
|
||||
<div className='flex bg-white rounded-2xl overflow-hidden'>
|
||||
<ProfileMenuBox selectedMenu={selectedMenu} setSelectedMenu={setSelectedMenu} profile={profile}/>
|
||||
</div>
|
||||
<div className='flex col-start-2 col-end-5 bg-white rounded-2xl'></div>
|
||||
<div className='flex bg-white rounded-2xl'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='popup' className='hidden absolute w-full h-full items-center justify-center overflow-hidden'></div>
|
||||
</div>
|
||||
<div id='popup' className='hidden absolute w-full h-full items-center justify-center overflow-hidden'></div>
|
||||
</div>
|
||||
</I18nProvider>
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -1,13 +1,15 @@
|
||||
import React from 'react'
|
||||
import React, { useContext } from 'react'
|
||||
import { Link } from 'react-router-dom';
|
||||
import { menus } from '../menus';
|
||||
import { I18nContext } from '../middlewares/Locale';
|
||||
|
||||
export default function NavLeft(props) {
|
||||
const { locale } = useContext(I18nContext)
|
||||
return (
|
||||
<div className='flex flex-col aspect-ratio w-full'>
|
||||
<div className='flex flex-col rounded-r-2xl'>
|
||||
{menus.map(get => (
|
||||
<Link key={get.id} to={get.path} onClick={() => props.setSelectedMenu(get.id)} className={'p-4 hover:bg-pc hover:bg-opacity-50 ' + (get.id === props.selectedMenu && 'bg-pc font-bold')}>{get.title}</Link>
|
||||
<Link key={get.id} to={get.path} onClick={() => 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]}</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -29,37 +29,37 @@ export default function Pages(props) {
|
||||
return (
|
||||
<div className='w-full overflow-hidden'>
|
||||
<Routes>
|
||||
<Route path='/' element={<Home importData={importData}/>}/>
|
||||
<Route path='/blogs' element={<Blogs importData={importData}/>}></Route>
|
||||
<Route path='/blogs/:cate' element={<Blogs importData={importData}/>}></Route>
|
||||
<Route path='/peoples' element={<Peoples importData={importData}/>}></Route>
|
||||
<Route path='/services' element={<Services importData={importData}/>}></Route>
|
||||
<Route path={'/profile/:username'} element={<Profile selectedMenu={props.selectedMenu} setSelectedMenu={props.setSelectedMenu}></Profile>}>
|
||||
<Route path='' element={<Posts uid={"posts"}/>}>
|
||||
<Route path=':cate' element={<Posts/>}></Route>
|
||||
<Route path='/' element={<Home importData={importData} locale={props.locale}/>}/>
|
||||
<Route path='/blogs' element={<Blogs importData={importData} locale={props.locale}/>}></Route>
|
||||
<Route path='/blogs/:cate' element={<Blogs importData={importData} locale={props.locale}/>}></Route>
|
||||
<Route path='/peoples' element={<Peoples importData={importData} locale={props.locale}/>}></Route>
|
||||
<Route path='/services' element={<Services importData={importData} locale={props.locale}/>}></Route>
|
||||
<Route path={'/profile/:username'} element={<Profile selectedMenu={props.selectedMenu} setSelectedMenu={props.setSelectedMenu} locale={props.locale}></Profile>}>
|
||||
<Route path='' element={<Posts uid={"posts"} locale={props.locale}/>}>
|
||||
<Route path=':cate' element={<Posts locale={props.locale}/>}></Route>
|
||||
</Route>
|
||||
{/* <Route path='' element={<Overview/>}></Route> */}
|
||||
<Route path='posts' element={<Posts uid={"posts"}/>}>
|
||||
<Route path=':cate' element={<Posts/>}></Route>
|
||||
<Route path='posts' element={<Posts uid={"posts"} locale={props.locale}/>}>
|
||||
<Route path=':cate' element={<Posts locale={props.locale}/>}></Route>
|
||||
</Route>
|
||||
{/* <Route path='about' element={<About/>}></Route> */}
|
||||
</Route>
|
||||
<Route path='/profile/:username/follow' element={<Follow importData={importData}/>}>
|
||||
<Route path='following' element={<Following importData={importData}/>}>
|
||||
<Route path='' element={<Default importData={importData}/>}/>
|
||||
<Route path='requests' element={<Request/>}></Route>
|
||||
<Route path='/profile/:username/follow' element={<Follow importData={importData} locale={props.locale}/>}>
|
||||
<Route path='following' element={<Following importData={importData} locale={props.locale}/>}>
|
||||
<Route path='' element={<Default importData={importData} locale={props.locale}/>}/>
|
||||
<Route path='requests' element={<Request locale={props.locale}/>}></Route>
|
||||
</Route>
|
||||
<Route path='follower' element={<Follower importData={importData}/>}>
|
||||
<Route path='' element={<Default importData={importData}/>}/>
|
||||
<Route path='requests' element={<Request/>}></Route>
|
||||
<Route path='follower' element={<Follower importData={importData} locale={props.locale}/>}>
|
||||
<Route path='' element={<Default importData={importData} locale={props.locale}/>}/>
|
||||
<Route path='requests' element={<Request locale={props.locale}/>}></Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route path='/profile/settings' element={<Settings uid={"settings"}/>}>
|
||||
<Route path='profile' element={<SettingsProfile/>}/>
|
||||
<Route path='password' element={<Password/>}/>
|
||||
<Route path='/profile/settings' element={<Settings uid={"settings"} locale={props.locale}/>}>
|
||||
<Route path='profile' element={<SettingsProfile locale={props.locale}/>}/>
|
||||
<Route path='password' element={<Password locale={props.locale}/>}/>
|
||||
</Route>
|
||||
{/* <Route path='/login' element={<Login/>} /> */}
|
||||
<Route path='*' element={<NotPage setSelectedMenu={props.setSelectedMenu}/>}/>
|
||||
<Route path='*' element={<NotPage setSelectedMenu={props.setSelectedMenu} locale={props.locale}/>}/>
|
||||
</Routes>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import React, { useContext, useEffect, useState } from 'react'
|
||||
import { FetchPOST } from '../../../middlewares/Fetch'
|
||||
import { useOutletContext } from 'react-router-dom';
|
||||
import Loading from '../../Loading';
|
||||
import { I18nContext } from '../../../middlewares/Locale';
|
||||
|
||||
export default function Profile(props) {
|
||||
const { selectedMenu, setSelectedMenu } = useOutletContext();
|
||||
const { locale, setLocale } = useContext(I18nContext);
|
||||
const [settings, setSettings] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@ -17,20 +19,10 @@ export default function Profile(props) {
|
||||
const [relation, setRelation] = useState("");
|
||||
const [privat, setPrivat] = useState("");
|
||||
const [about, setAbout] = useState("");
|
||||
|
||||
const [language, setLanguage] = useState("tr");
|
||||
|
||||
const settingsPOST = async function(e) {
|
||||
e.preventDefault();
|
||||
const h = {
|
||||
name: e.target.name.value,
|
||||
surname: e.target.surname.value,
|
||||
username: e.target.username.value,
|
||||
gender: e.target.gender.value,
|
||||
education: e.target.education.value,
|
||||
relation: e.target.relation.value,
|
||||
private: e.target.private.value,
|
||||
about: e.target.about.value
|
||||
};
|
||||
await FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/profile/settings",
|
||||
@ -49,12 +41,14 @@ export default function Profile(props) {
|
||||
education: e.target.education.value,
|
||||
about: e.target.about.value,
|
||||
relation: e.target.relation.value,
|
||||
private: e.target.private.value
|
||||
private: e.target.private.value,
|
||||
language: e.target.language.value
|
||||
})
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if(res.Status === "Success"){
|
||||
setLocale(e.target.language.value);
|
||||
window.location.reload();
|
||||
};
|
||||
});
|
||||
@ -78,6 +72,7 @@ export default function Profile(props) {
|
||||
setGender(res.data.user.gender);
|
||||
setRelation(res.data.user.relation);
|
||||
setAbout(res.data.user.about);
|
||||
setLanguage(res.data.user.locale);
|
||||
|
||||
setLoading(false);
|
||||
});
|
||||
@ -145,6 +140,27 @@ export default function Profile(props) {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 gap-4'>
|
||||
<div className='flex flex-col gap-2 rounded-2xl'>
|
||||
<p className='font-bold'>Arayüz Dili</p>
|
||||
<select name='language' className='p-2 rounded-2xl bg-white' value={language} onChange={(e) => setLanguage(e.target.value)}>
|
||||
<option></option>
|
||||
{
|
||||
Object.entries(settings.locales).map(([key, value]) =>
|
||||
<option value={key}>{value[0]} ({value[1]})</option>
|
||||
)
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
{/* <div className='flex flex-col gap-2 rounded-2xl'>
|
||||
<p className='font-bold'>Gizlilik</p>
|
||||
<select name='private' className='p-2 rounded-2xl bg-white' value={privat} onChange={(e) => setPrivat(e.target.value)}>
|
||||
<option></option>
|
||||
<option value={false}>Herkese Açık</option>
|
||||
<option value={true}>Gizli</option>
|
||||
</select>
|
||||
</div> */}
|
||||
</div>
|
||||
<div className='grid grid-cols-1 gap-4'>
|
||||
<div className='flex flex-col gap-2 rounded-2xl'>
|
||||
<p className='font-bold'>Hakkında</p>
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const menus = [{
|
||||
id: 1,
|
||||
title: "Anasayfa",
|
||||
title: "homepage",
|
||||
path: ""
|
||||
},{
|
||||
id: 2,
|
||||
title: "Bloglar",
|
||||
title: "blogs",
|
||||
path: "/blogs"
|
||||
},{
|
||||
id: 3,
|
||||
title: "Kişiler",
|
||||
title: "peoples",
|
||||
path: "/peoples"
|
||||
},{
|
||||
id: 4,
|
||||
title: "Servisler",
|
||||
title: "services",
|
||||
path: "/services"
|
||||
}];
|
||||
|
||||
|
||||
31
src/middlewares/Locale.jsx
Normal file
31
src/middlewares/Locale.jsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { createContext, useEffect, useState } from 'react';
|
||||
import { FetchPOST } from './Fetch';
|
||||
|
||||
const I18nContext = createContext();
|
||||
|
||||
const I18nProvider = ({ children }) => {
|
||||
const [locale, setLocale] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/get/user/my/get/locale"
|
||||
})
|
||||
.then(res => {
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/locales/" + res.locale
|
||||
})
|
||||
.then(res => setLocale(res));
|
||||
});
|
||||
|
||||
},[]);
|
||||
|
||||
return (
|
||||
<I18nContext.Provider value={{ locale, setLocale }}>
|
||||
{children}
|
||||
</I18nContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export { I18nProvider, I18nContext };
|
||||
@ -1,13 +1,16 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import React, { useContext, useEffect } from 'react'
|
||||
import { I18nContext } from '../middlewares/Locale';
|
||||
|
||||
export default function Home({importData}) {
|
||||
const { locale } = useContext(I18nContext);
|
||||
|
||||
useEffect(() => {
|
||||
importData.setSelectedMenu(1);
|
||||
},[]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
Anasayfa
|
||||
{locale['hello']}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user