Oluşturuldu
154
README.md
Normal file
@ -0,0 +1,154 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||
|
||||
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import Header from './components/Header';
|
||||
// import NavRight from './components/NavRight';
|
||||
import NavLeft from './components/NavLeft';
|
||||
import Pages from './components/Pages';
|
||||
import ProfileMenuBox from './components/ProfileMenuBox';
|
||||
import MusikBox from './components/MusikBox';
|
||||
|
||||
export default class App extends Component {
|
||||
state = {
|
||||
profile: {
|
||||
info: {
|
||||
id: 1,
|
||||
first_name: "Batuhan",
|
||||
second_name: "Coşkun",
|
||||
username: "bc1428"
|
||||
},
|
||||
selectedCategory: '',
|
||||
functions: {
|
||||
changeCategory: (id) => {
|
||||
this.setState({selectedCategory: id});
|
||||
}
|
||||
}
|
||||
},
|
||||
selectedMenu: '',
|
||||
isTurn: false,
|
||||
menus: [{
|
||||
id: 1,
|
||||
title: "Anasayfa",
|
||||
path: ""
|
||||
},{
|
||||
id: 2,
|
||||
title: "Bloglar",
|
||||
path: "blogs"
|
||||
}],
|
||||
functions: {
|
||||
changeMenu: (menu)=>{
|
||||
this.setState({selectedMenu: menu.id})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
musiks = [{
|
||||
id: 1,
|
||||
title: "Müzik 1"
|
||||
}]
|
||||
|
||||
selectedMenu = (data, id)=>{
|
||||
this.setState({selectedMenu: id})
|
||||
data.isTurn = true;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className='flex flex-col h-screen'>
|
||||
<Header/>
|
||||
<div className='grid grid-cols-5 p-2 gap-4 h-screen overflow-hidden'>
|
||||
<div id='content-left' className='flex flex-col gap-4 h-full justify-between'>
|
||||
<div className='flex flex-col items-start h-full bg-white shadow-md rounded-2xl overflow-hidden'>
|
||||
<NavLeft data={this.state} changeMenu={this.state.functions.changeMenu}/>
|
||||
</div>
|
||||
<div className='flex items-center justify-center bg-white shadow-md rounded-2xl overflow-hidden'>
|
||||
<ProfileMenuBox data={this.state} changeMenu={this.state.functions.changeMenu}/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-col col-span-4 overflow-y-scroll'>
|
||||
<div id='content-center' className='flex flex-col items-center w-full col-span-4 p-4 shadow-md rounded-2xl bg-white overflow-y-scroll'>
|
||||
<Pages data={this.state} selectedMenu={this.selectedMenu}/>
|
||||
</div>
|
||||
<div className='flex'>
|
||||
<MusikBox/>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div id='content-right' className='flex flex-col items-end col-start-5 bg-white shadow-md rounded-l-2xl'>
|
||||
<NavRight/>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
};
|
||||
17853
package-lock.json
generated
Normal file
51
package.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "wondanes-react",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"antd": "^5.24.4",
|
||||
"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",
|
||||
"react-infinite-scroll-component": "^6.1.0",
|
||||
"react-loading-skeleton": "^3.5.0",
|
||||
"react-redux": "^9.2.0",
|
||||
"react-router-dom": "^7.1.3",
|
||||
"react-scripts": "5.0.1",
|
||||
"redux": "^5.0.1",
|
||||
"universal-cookie": "^7.2.2",
|
||||
"web-vitals": "^4.2.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.5.3",
|
||||
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
|
||||
}
|
||||
}
|
||||
BIN
public/1.1.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
public/1.mp3
Normal file
BIN
public/16.9.jpg
Normal file
|
After Width: | Height: | Size: 399 KiB |
BIN
public/9.16.jpg
Normal file
|
After Width: | Height: | Size: 492 KiB |
BIN
public/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
28
public/icons/failed.svg
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 512 512" xml:space="preserve">
|
||||
<circle style="fill:#FF757C;" cx="256" cy="256" r="245.801"/>
|
||||
<polygon style="fill:#F2F2F2;" points="395.561,164.038 347.961,116.44 256,208.401 164.039,116.44 116.439,164.038 208.401,256
|
||||
116.439,347.962 164.039,395.56 256,303.599 347.961,395.56 395.561,347.962 303.599,256 "/>
|
||||
<g>
|
||||
<path style="fill:#4D4D4D;" d="M256,512c-68.38,0-132.667-26.628-181.02-74.98S0,324.38,0,256S26.628,123.333,74.98,74.98
|
||||
S187.62,0,256,0s132.667,26.628,181.02,74.98S512,187.62,512,256s-26.628,132.667-74.98,181.02S324.38,512,256,512z M256,20.398
|
||||
C126.089,20.398,20.398,126.089,20.398,256S126.089,491.602,256,491.602S491.602,385.911,491.602,256S385.911,20.398,256,20.398z"
|
||||
/>
|
||||
<path style="fill:#4D4D4D;" d="M347.962,405.759c-2.61,0-5.221-0.996-7.212-2.987L256,318.022l-84.749,84.75
|
||||
c-3.983,3.982-10.441,3.982-14.425,0l-47.599-47.599c-3.983-3.983-3.983-10.441,0-14.425L193.978,256l-84.75-84.749
|
||||
c-3.983-3.983-3.983-10.441,0-14.425l47.599-47.599c3.983-3.982,10.441-3.982,14.425,0L256,193.978l84.749-84.75
|
||||
c3.983-3.982,10.441-3.982,14.425,0l47.599,47.599c3.983,3.983,3.983,10.441,0,14.425L318.022,256l84.75,84.749
|
||||
c3.983,3.983,3.983,10.441,0,14.425l-47.599,47.599C353.182,404.764,350.572,405.759,347.962,405.759z M256,293.399
|
||||
c2.61,0,5.221,0.996,7.212,2.987l84.749,84.75l33.175-33.175l-84.75-84.749c-3.983-3.983-3.983-10.441,0-14.425l84.75-84.749
|
||||
l-33.175-33.175l-84.749,84.75c-3.983,3.982-10.441,3.982-14.425,0l-84.749-84.75l-33.175,33.175l84.75,84.749
|
||||
c3.983,3.983,3.983,10.441,0,14.425l-84.75,84.749l33.175,33.175l84.749-84.75C250.779,294.396,253.39,293.399,256,293.399z"/>
|
||||
<path style="fill:#4D4D4D;" d="M454.369,338.616c-1.16,0-2.338-0.199-3.49-0.619c-5.292-1.929-8.02-7.782-6.092-13.074
|
||||
c9.746-26.753,13.736-55.957,11.539-84.458c-0.433-5.616,3.769-10.519,9.385-10.953c5.622-0.449,10.519,3.769,10.953,9.385
|
||||
c2.419,31.381-1.977,63.542-12.711,93.008C462.445,336.044,458.534,338.616,454.369,338.616z"/>
|
||||
<path style="fill:#4D4D4D;" d="M459.567,210.106c-4.479,0-8.586-2.973-9.829-7.502c-0.802-2.917-1.68-5.856-2.613-8.735
|
||||
c-1.737-5.358,1.199-11.11,6.558-12.847c5.356-1.738,11.11,1.198,12.847,6.558c1.028,3.171,1.997,6.408,2.879,9.623
|
||||
c1.491,5.432-1.702,11.044-7.135,12.536C461.369,209.987,460.46,210.106,459.567,210.106z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
4
public/icons/homepage.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 0L0 6V8H1V15H4V10H7V15H15V8H16V6L14 4.5V1H11V2.25L8 0ZM9 10H12V13H9V10Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 372 B |
47
public/icons/musicplayer-play-button.svg
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 16.933333 16.933333"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="musicplayer-play-button.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="9.9875375"
|
||||
inkscape:cx="41.25141"
|
||||
inkscape:cy="34.092488"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Katman 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="path4033"
|
||||
style="fill:none;stroke:#000000;stroke-width:1.6973;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none"
|
||||
d="M 0.84865074,0.90625991 V 8.4670345 16.027073 L 16.084789,8.4670345 Z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
13
public/icons/success.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 117 117" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title/>
|
||||
<desc/>
|
||||
<defs/>
|
||||
<g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1">
|
||||
<g fill-rule="nonzero" id="correct">
|
||||
<path d="M34.5,55.1 C32.9,53.5 30.3,53.5 28.7,55.1 C27.1,56.7 27.1,59.3 28.7,60.9 L47.6,79.8 C48.4,80.6 49.4,81 50.5,81 C50.6,81 50.6,81 50.7,81 C51.8,80.9 52.9,80.4 53.7,79.5 L101,22.8 C102.4,21.1 102.2,18.5 100.5,17 C98.8,15.6 96.2,15.8 94.7,17.5 L50.2,70.8 L34.5,55.1 Z" fill="#17AB13" id="Shape"/>
|
||||
<path d="M89.1,9.3 C66.1,-5.1 36.6,-1.7 17.4,17.5 C-5.2,40.1 -5.2,77 17.4,99.6 C28.7,110.9 43.6,116.6 58.4,116.6 C73.2,116.6 88.1,110.9 99.4,99.6 C118.7,80.3 122,50.7 107.5,27.7 C106.3,25.8 103.8,25.2 101.9,26.4 C100,27.6 99.4,30.1 100.6,32 C113.1,51.8 110.2,77.2 93.6,93.8 C74.2,113.2 42.5,113.2 23.1,93.8 C3.7,74.4 3.7,42.7 23.1,23.3 C39.7,6.8 65,3.9 84.8,16.2 C86.7,17.4 89.2,16.8 90.4,14.9 C91.6,13 91,10.5 89.1,9.3 Z" fill="#4A4A4A" id="Shape"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
43
public/index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
BIN
public/loading.gif
Normal file
|
After Width: | Height: | Size: 11 KiB |
25
public/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
6
public/profile-photo.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.4" d="M12.1207 12.78C12.0507 12.77 11.9607 12.77 11.8807 12.78C10.1207 12.72 8.7207 11.28 8.7207 9.50998C8.7207 7.69998 10.1807 6.22998 12.0007 6.22998C13.8107 6.22998 15.2807 7.69998 15.2807 9.50998C15.2707 11.28 13.8807 12.72 12.1207 12.78Z" stroke="#292D32" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path opacity="0.34" d="M18.7398 19.3801C16.9598 21.0101 14.5998 22.0001 11.9998 22.0001C9.39977 22.0001 7.03977 21.0101 5.25977 19.3801C5.35977 18.4401 5.95977 17.5201 7.02977 16.8001C9.76977 14.9801 14.2498 14.9801 16.9698 16.8001C18.0398 17.5201 18.6398 18.4401 18.7398 19.3801Z" stroke="#292D32" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#292D32" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
38
src/App.js
Normal file
@ -0,0 +1,38 @@
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
import { getAllBooks } from './middlewares/books/get';
|
||||
import { GSProvider } from './middlewares/GlobalStore'
|
||||
import Cookies from 'universal-cookie'
|
||||
import Books from './components/books/pages/Books';
|
||||
import Pages from './components/Pages';
|
||||
import Left from './components/patchs/Left';
|
||||
const cookie = new Cookies();
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<div className='flex flex-col w-full'>
|
||||
{/* <Navbar/> */}
|
||||
<div className='flex h-full'>
|
||||
<div className='flex gap-4 m-auto page-container pt-6'>
|
||||
<div className='flex w-3/12 overflow-visible'>
|
||||
<div className='flex flex-col gap-4 h-24 sticky w-full'>
|
||||
<Left/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex w-1/2 h-full mb-8 justify-center'>
|
||||
<Pages/>
|
||||
</div>
|
||||
<div className='flex flex-col gap-4 h-0 sticky w-3/12 top-20'>
|
||||
{/* {rightMenu} */}
|
||||
</div>
|
||||
</div>
|
||||
<div id='screen-popup' className='hidden fixed w-full h-full justify-center items-center'>
|
||||
{/* {popup} */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
// <GSProvider>
|
||||
// </GSProvider>
|
||||
17
src/components/Pages.jsx
Normal file
@ -0,0 +1,17 @@
|
||||
import React from 'react'
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import Books from './books/pages/Books';
|
||||
import Book from './books/pages/Book';
|
||||
import Publish from './quotes/pages/Publish';
|
||||
import Page from './home/Page';
|
||||
|
||||
export default function Pages() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path='/' element={<Page/>} />
|
||||
<Route path='/books' element={<Books/>} />
|
||||
<Route path='/book/:id' element={<Book/>} />
|
||||
<Route path='/publish' element={<Publish/>}/>
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
7
src/components/books/Unit.jsx
Normal file
@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function Unit() {
|
||||
return (
|
||||
<div>Unit</div>
|
||||
)
|
||||
}
|
||||
87
src/components/books/pages/Book.jsx
Normal file
@ -0,0 +1,87 @@
|
||||
import React, { useContext, useEffect, useState } from 'react'
|
||||
import { FetchPOST } from '../../../middlewares/Fetch';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
export default function Book() {
|
||||
const {id} = useParams();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [book, setBook] = useState({});
|
||||
const [quotes, setQuotes] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/" + id
|
||||
}).then(res => {
|
||||
setBook(res.book);
|
||||
setQuotes(res.quotes)
|
||||
setLoading(false);
|
||||
})
|
||||
},[]);
|
||||
|
||||
if(loading){
|
||||
return(<></>)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex flex-col w-full gap-4'>
|
||||
<div className='flex flex-col p-2 gap-1 rounded-lg border-4 border-pc'>
|
||||
<div className='flex gap-1'>
|
||||
<p className='font-bold'>Kitab Adı:</p>
|
||||
<p>{book.title}</p>
|
||||
</div>
|
||||
<div className='flex gap-1'>
|
||||
{
|
||||
(book.author.length > 0) &&
|
||||
<>
|
||||
<p className='font-bold'>Yazar:</p>
|
||||
<div className='flex gap-1'>
|
||||
{book.author.map((get, b_index) =>
|
||||
<p>{get.name} {(book.author[b_index + 1] && ",")}</p>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
<div className='flex gap-1'>
|
||||
<p className='font-bold'>Alıntı Sayısı:</p>
|
||||
<p>{quotes.length}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className='flex w-full'>
|
||||
<input className='w-full p-1 rounded-lg border-pc border-4'></input>
|
||||
</div> */}
|
||||
<div className='flex flex-col gap-6'>
|
||||
<div className='flex flex-col gap-1'>
|
||||
<p className='font-bold text-base'>Alıntı Arama</p>
|
||||
<input className='p-1 rounded-lg shadow-md' onChange={searchQuotes}></input>
|
||||
</div>
|
||||
<div className='flex flex-col p-2 gap-4'>
|
||||
{
|
||||
quotes.map(get =>
|
||||
<div className='flex flex-col bg-gray-200 rounded-lg p-2 gap-2 shadow-md'>
|
||||
<div className='flex items-center justify-between'>
|
||||
<p className='font-bold'>{get.title}</p>
|
||||
<p># {get.id}</p>
|
||||
</div>
|
||||
<div className='flex'>
|
||||
<p>{get.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
function searchQuotes(e) {
|
||||
const element = e.target;
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/quotes/get/search?book_id=" + id + "&q=" + element.value
|
||||
}).then(res => {
|
||||
setQuotes(res);
|
||||
});
|
||||
};
|
||||
};
|
||||
69
src/components/books/pages/Books.jsx
Normal file
@ -0,0 +1,69 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { FetchPOST } from '../../../middlewares/Fetch';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
export default function Books() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [books, setBooks] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/all"
|
||||
}).then(res => {
|
||||
setBooks(res);
|
||||
setLoading(false);
|
||||
});
|
||||
},[]);
|
||||
|
||||
if(loading === true){
|
||||
return (<></>)
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='flex flex-col m-4 w-full gap-6'>
|
||||
<div className='flex w-full'>
|
||||
<input className='w-full p-2 rounded-2xl border-4 border-pc' onChange={e => search(e)}></input>
|
||||
</div>
|
||||
{
|
||||
books.map((get, b_index) =>
|
||||
<Link to={"/book/" + get.id} className='flex gap-2 cursor-pointer bg-gray-200 rounded-2xl overflow-hidden hover:bg-pc'>
|
||||
<div className='flex p-2 items-center justify-center bg-pc'>
|
||||
<p className='font-bold'>{b_index + 1}</p>
|
||||
</div>
|
||||
<div className='flex flex-col p-2'>
|
||||
<p className='font-bold'>{get.title}</p>
|
||||
<div className='flex gap-1'>
|
||||
{
|
||||
get.author.map((author, a_index) =>
|
||||
<p>{author.name} {(get.author[a_index + 1] && ",")}</p>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
||||
function search(e) {
|
||||
const element = e.target;
|
||||
console.log(element.value.length)
|
||||
if(element.value.length === 0){
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/all"
|
||||
}).then(res => {
|
||||
setBooks(res);
|
||||
});
|
||||
}else if(element.value.length > 0){
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/search?q=" + element.value
|
||||
}).then(res => {
|
||||
setBooks(res);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
12
src/components/home/Page.jsx
Normal file
@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<div className='grid w-full'>
|
||||
<Link to={"/books"} className='flex flex-col p-10 w-full bg-gray-200 rounded-2xl hover:bg-gray-300'>
|
||||
Kitaplar
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
18
src/components/patchs/Left.jsx
Normal file
@ -0,0 +1,18 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
function Left() {
|
||||
return (
|
||||
<div className='flex flex-col gap-2'>
|
||||
<div className='flex flex-col gap-2'>
|
||||
<a className='w-full p-4 bg-gray-200 cursor-pointer rounded-2xl hover:bg-gray-300' onClick={() => window.history.back()}>Geri Git</a>
|
||||
<Link to={"/publish"} className='w-full p-4 bg-gray-200 rounded-2xl hover:bg-gray-300'>Gönderi Oluştur</Link>
|
||||
</div>
|
||||
<div className='flex flex-col bg-gray-200 overflow-hidden rounded-lg'>
|
||||
<Link to={"/"} className='p-3 hover:bg-gray-300'>Anasayfa</Link>
|
||||
<Link to={"/books"} className='p-3 hover:bg-gray-300'>Kitaplar</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default Left
|
||||
81
src/components/quotes/pages/Publish.jsx
Normal file
@ -0,0 +1,81 @@
|
||||
import React, { useState } from 'react'
|
||||
import { FetchPOST } from '../../../middlewares/Fetch';
|
||||
|
||||
export default function Publish() {
|
||||
const [books, setBooks] = useState([]);
|
||||
const [selectedBook, setSelectedBook] = useState(null);
|
||||
|
||||
return (
|
||||
<div className='flex flex-col gap-4 w-full'>
|
||||
<div className='flex flex-col w-full gap-2 overflow-hidden bg-white rounded-lg'>
|
||||
<div className='flex flex-col gap-2 p-2'>
|
||||
<div className='flex flex-col overflow-hidden'>
|
||||
{/* <p className='font-bold ml-1'>Başlık</p> */}
|
||||
<input id='title' placeholder='Başlık' className='p-2 outline-none rounded-lg'></input>
|
||||
</div>
|
||||
<div className='flex flex-col gap-2'>
|
||||
{/* <p className='font-bold'>İçerik</p> */}
|
||||
<textarea id='text' placeholder='İçerik' className='w-full h-48 rounded-lg resize-none p-2 outline-none'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<a className='w-full p-2 cursor-pointer items-center justify-center text-center font-bold border-solid border-t-2 border-black hover:bg-pb' onClick={publish}>Paylaş</a>
|
||||
</div>
|
||||
<div className='flex flex-col w-full rounded-lg p-2 gap-2'>
|
||||
<p className='font-bold text-base'>Kitabı aratın ve seçin</p>
|
||||
<div className='flex gap-4 mb-4 w-full'>
|
||||
<input id='book-search' className='w-full rounded-lg p-2' onChange={(e) => book_search(e)}></input>
|
||||
<a className='flex items-center justify-center cursor-pointer p-2 bg-white rounded-lg' onClick={(e) => {setSelectedBook(null)}}>Temizle</a>
|
||||
</div>
|
||||
{
|
||||
books.map(get =>
|
||||
<div key={get.id} className={'flex flex-col gap-2 p-4 bg-white cursor-pointer rounded-lg ' + ((selectedBook) && "bg-pb")} onClick={(e) => setSelectedBook(get.id)}>
|
||||
<p className='font-bold'>{get.title}</p>
|
||||
<p>{get.author[0].name}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
function book_search(e) {
|
||||
const element = e.target;
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/search/?q=" + element.value
|
||||
}).then(get => {
|
||||
setBooks(get);
|
||||
});
|
||||
};
|
||||
|
||||
function publish(){
|
||||
const title_element = document.getElementById("title");
|
||||
const text_element = document.getElementById("text");
|
||||
const book_search_element = document.getElementById("book-search");
|
||||
FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/quotes/post/create",
|
||||
fetchData: {
|
||||
method: "post",
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Accept' : 'application/json',
|
||||
'Content-Type' : 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: title_element.value,
|
||||
text: text_element.value,
|
||||
book_id: selectedBook,
|
||||
user_id: 1
|
||||
})
|
||||
}
|
||||
}).then(res => {
|
||||
if(res.success === true){
|
||||
title_element.value = "";
|
||||
text_element.value = "";
|
||||
book_search_element.value = "";
|
||||
setBooks([]);
|
||||
setSelectedBook(null);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
32
src/index.css
Normal file
@ -0,0 +1,32 @@
|
||||
/* ./src/index.css */
|
||||
@import "tailwindcss/base";
|
||||
@import "tailwindcss/components";
|
||||
@import "tailwindcss/utilities";
|
||||
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body{
|
||||
background: #f3f4f6;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.aspect-square{
|
||||
aspect-ratio: 1/1;
|
||||
}
|
||||
|
||||
.nav-left:hover{
|
||||
grid-column: 1fr;
|
||||
}
|
||||
|
||||
.page-container{
|
||||
width: 1440px;
|
||||
}
|
||||
|
||||
:root{
|
||||
--navbar-p: 1rem;
|
||||
--bg-pc:#cff9ff;
|
||||
}
|
||||
19
src/index.js
Normal file
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import {BrowserRouter} from 'react-router-dom';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
|
||||
root.render(
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
5
src/middlewares/Fetch.jsx
Normal file
@ -0,0 +1,5 @@
|
||||
export async function FetchPOST({port, pathname, fetchData}) {
|
||||
return await fetch(window.location.protocol + "//" + window.location.hostname + ((port) && ":") + ((port) ? port : "") + pathname, {...fetchData, credentials: 'include'})
|
||||
.then(res => res.json())
|
||||
.then(res => {return res});
|
||||
};
|
||||
17
src/middlewares/GlobalStore.jsx
Normal file
@ -0,0 +1,17 @@
|
||||
import { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
const GSContext = createContext();
|
||||
|
||||
const GSProvider = ({ children, data, locales }) => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
if(loading === false){
|
||||
return (
|
||||
<GSContext.Provider>
|
||||
{children}
|
||||
</GSContext.Provider>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export { GSProvider, GSContext };
|
||||
8
src/middlewares/books/get.jsx
Normal file
@ -0,0 +1,8 @@
|
||||
const { FetchPOST } = require("../Fetch")
|
||||
|
||||
export async function getAllBooks(){
|
||||
return await FetchPOST({
|
||||
port: 3001,
|
||||
pathname: "/api/v1/books/get/all"
|
||||
});
|
||||
};
|
||||
13
src/reportWebVitals.js
Normal file
@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
5
src/setupTests.js
Normal file
@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
26
tailwind.config.js
Normal file
@ -0,0 +1,26 @@
|
||||
module.exports = {
|
||||
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
|
||||
darkMode: false, // or 'media' or 'class'
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
'pc': '#10cccc',
|
||||
'pb': '#cff9ff'
|
||||
},
|
||||
height: {
|
||||
'navbar-full': 'calc(100vh - var(--navbar-h) - var(--navbar-p))',
|
||||
'navbar': 'var(--navbar-h)'
|
||||
},
|
||||
padding: {
|
||||
'navbar': 'var(--navbar-p)'
|
||||
},
|
||||
border: {
|
||||
'1r': '0.1rem'
|
||||
}
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||