A LITTLE MORE >_<
This commit is contained in:
parent
1240c7ec90
commit
ce0ea8903e
17341
frontend/package-lock.json
generated
Normal file
17341
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
frontend/package.json
Normal file
39
frontend/package.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"axios": "^1.4.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"web-vitals": "^2.1.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"
|
||||
]
|
||||
}
|
||||
}
|
BIN
frontend/public/favicon.ico
Normal file
BIN
frontend/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
43
frontend/public/index.html
Normal file
43
frontend/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
frontend/public/logo192.png
Normal file
BIN
frontend/public/logo192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
frontend/public/logo512.png
Normal file
BIN
frontend/public/logo512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
25
frontend/public/manifest.json
Normal file
25
frontend/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"
|
||||
}
|
3
frontend/public/robots.txt
Normal file
3
frontend/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
38
frontend/src/App.css
Normal file
38
frontend/src/App.css
Normal file
@ -0,0 +1,38 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
26
frontend/src/App.js
Normal file
26
frontend/src/App.js
Normal file
@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import './style.css';
|
||||
import 'bootstrap/dist/css/bootstrap.css';
|
||||
import MainPage from './Pages/Mainpage'
|
||||
import SearchPage from './Pages/Searchpage'
|
||||
import LibPage from './Pages/Librarypage'
|
||||
import RegPage from './Pages/Regpage'
|
||||
import FilmInfo from './Pages/Filmpage'
|
||||
import { BrowserRouter as Router,Routes,Route} from 'react-router-dom';
|
||||
export default function App() {
|
||||
return (
|
||||
<div>
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path='/movie/:customerId' render={(props) => <MainPage/>} />
|
||||
<Route path='/genre:customerId' element={<SearchPage/>} />
|
||||
<Route path='/library/:customerId' element={<LibPage/>} />
|
||||
<Route path='/customer' element={<RegPage/>} />
|
||||
<Route path='/movie/:customerId/:movieId' element={<FilmInfo/>} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
8
frontend/src/App.test.js
Normal file
8
frontend/src/App.test.js
Normal file
@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
57
frontend/src/Components/DataService.js
Normal file
57
frontend/src/Components/DataService.js
Normal file
@ -0,0 +1,57 @@
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
const host = "http://localhost:8080";
|
||||
|
||||
export async function registerUser(fullName,password)
|
||||
{
|
||||
|
||||
const response = await axios.post(`${host}/customer`, {
|
||||
fullName,
|
||||
password,
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
const customerDTO = response.data;
|
||||
return customerDTO;}
|
||||
|
||||
}
|
||||
|
||||
export async function getMovies()
|
||||
{
|
||||
const response = await axios.get(`${host}/movie`);
|
||||
if (response.status === 200) {
|
||||
const moviesData = response.data;
|
||||
return moviesData;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMovie(movieId)
|
||||
{
|
||||
const response = await axios.get(`${host}/movie/${movieId}`);
|
||||
if (response.status === 200) {
|
||||
const movieDTO = response.data;
|
||||
return movieDTO;}
|
||||
}
|
||||
export async function getCustomerMovies(customerId)
|
||||
{
|
||||
const response = await axios.get(`${host}/movie/${customerId}`);
|
||||
}
|
||||
|
||||
export async function acquireMovie(movieId,customerId)
|
||||
{
|
||||
const response = await axios.get(`${host}/movie/${customerId}/${movieId}`);
|
||||
if (response.status === 200) {
|
||||
const movieDTO= response.data;
|
||||
return movieDTO;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMoviesByGenre(genre)
|
||||
{
|
||||
const response = await axios.get(`${host}/movie/${genre}`);
|
||||
if (response.status === 200) {
|
||||
const moviesData= response.data;
|
||||
return moviesData;
|
||||
}
|
||||
}
|
23
frontend/src/Components/Film.js
Normal file
23
frontend/src/Components/Film.js
Normal file
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
|
||||
function Film({customerId,movieId,title, acquire,main})
|
||||
{
|
||||
const handleAcquireClick = () => {
|
||||
acquire();
|
||||
};
|
||||
return (
|
||||
<div className="flex-containerB" style={{flexDirection: "column", display: "flex", width: "350px",height:"500px"}}>
|
||||
<div className="flex-item1" style={{flex: "10"}}>
|
||||
<img src="https://www.seekpng.com/png/detail/8-84931_question-mark-question-mark-white-background.png" alt = "cover" width="100%" height="420px"/>
|
||||
</div>
|
||||
<div className="flex-item12 text-center" style={{flex: "1", color:"white",fontSize: " 32px",fontWeight: "bold"}}><Link to={`/movie/${customerId}/${movieId}`}>{title}</Link></div>
|
||||
{main ? (
|
||||
<button onClick={handleAcquireClick}>Add</button>
|
||||
) : (<div></div>)}
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Film;
|
10
frontend/src/Components/Footer.js
Normal file
10
frontend/src/Components/Footer.js
Normal file
@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer className="flex-item6">
|
||||
<div className="text-center text-light p-2" style={{fontSize: "30px", fontWeight: "bold"}}>@2022 Copyright: BLSJY.com</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
export default Footer;
|
13
frontend/src/Components/LibraryExtraBar.js
Normal file
13
frontend/src/Components/LibraryExtraBar.js
Normal file
@ -0,0 +1,13 @@
|
||||
const LibraryExtraBar = () =>{
|
||||
return(
|
||||
<div className="flex-container justify-content-center" id="filterbar" style={{display: "flex" , flex:"1" , flexDirection: "column", gap: "10px", textAlign: "center"}}>
|
||||
<div className="flex-item-profile sidebar rounded-4 align-self-center">
|
||||
<button className="button" style={{height: "110px", width:"160px", fontSize: "25px", opacity: "0.6"}} disabled="true">REVIEWED</button>
|
||||
</div>
|
||||
<div className="flex-item-search sidebar rounded-4 align-self-center">
|
||||
<button className="button" style={{height: "110px", width:"160px", fontSize: "25px"}}>WATCHED</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default LibraryExtraBar;
|
25
frontend/src/Components/ModalWindow.js
Normal file
25
frontend/src/Components/ModalWindow.js
Normal file
@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
const ModalWindow = () => {
|
||||
return (
|
||||
<div className="modal fade" id="myModal" role="dialog">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<button className="close" type="button" data-bs-dismiss="modal">×</button>
|
||||
<h4 className="modal-title">Do you want to change or delete?</h4>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<input className="form-control" id="inputFilmName" type="name" value="" placeholder="Enter film name"/>
|
||||
<input className="form-control" id="inputPic" type="url-pic" value="" placeholder="Enter url of film cover"/>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-default" type="button" data-bs-dismiss="modal" onclick="changeMovie()">Change
|
||||
<button className="btn btn-default" type="button" data-bs-dismiss="modal" onclick="deleteRequest()">Delete</button>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default ModalWindow;
|
25
frontend/src/Components/Navbar.js
Normal file
25
frontend/src/Components/Navbar.js
Normal file
@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
function Navbar({ customerId }) {
|
||||
return (
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<Link to={`/movie/${customerId}`}>Main Page</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link to={`/genre/${customerId}`}>Search Page</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link to={`/library/${customerId}`}>Library Page</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link to="/customer">Registration Page</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export default Navbar;
|
30
frontend/src/Components/SearchSuggestions.js
Normal file
30
frontend/src/Components/SearchSuggestions.js
Normal file
@ -0,0 +1,30 @@
|
||||
import React from "react";
|
||||
let imgs = ['https://cdn-l-cyberpunk.cdprojektred.com/edgerunners/Cyberpunk-Edgerunners-S1-Poster-en.jpg',
|
||||
'https://upload.wikimedia.org/wikipedia/ru/thumb/f/f2/%D0%90%D1%80%D0%BA%D0%B5%D0%B9%D0%BD_%28%D0%BC%D1%83%D0%BB%D1%8C%D1%82%D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%29.jpg/800px-%D0%90%D1%80%D0%BA%D0%B5%D0%B9%D0%BD_%28%D0%BC%D1%83%D0%BB%D1%8C%D1%82%D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%29.jpg',
|
||||
'https://cdn.shopify.com/s/files/1/0106/3708/2686/collections/Collection_Image_2_600x600_crop_center.jpg?v=1643983621'
|
||||
];
|
||||
const SearchSuggestions = () =>
|
||||
{
|
||||
return (
|
||||
<div className="flex-container" style={{display: "flex", flexDirection: "column", flex:"1" }}>
|
||||
<header className="flex-item" style={{display: "flex", height: "90px"}}>
|
||||
<div className="flex-itemB2 text-center align-self-center" style={{flex: "1", color: "white", fontSize: "32px", fontWeight: "bold"}}>You might like this</div>
|
||||
</header>
|
||||
<main style={{display: "flex", flex: "1", gap: "20px"}}>
|
||||
<div className="flex-containerB3" style={{flex: "1", flexDirection: "column", display: "flex", marginLeft: "20px"}}>
|
||||
<div className="flex-itemB31" style={{flex: "10"}}><img src={imgs[0]} alt = "cover1" width="100%" height="100%"/></div>
|
||||
<div className="flex-itemB32 text-center" style={{flex: "1", color:"white",fontSize: " 32px",fontWeight: "bold"}}>Cyberpunk: Edgerunners</div>
|
||||
</div>
|
||||
<div className="flex-containerB4" style={{flex: "1", flexDirection: "column", display: "flex"}}>
|
||||
<div className="flex-itemB41" style={{flex: "10"}}><img src={imgs[1]} alt="cover2" width="100%" height="100%"/></div>
|
||||
<div className="flex-itemB42 text-center" style={{flex: "1", color:"white",fontSize: " 32px",fontWeight: "bold"}}>Arcane</div>
|
||||
</div>
|
||||
<div className="flex-containerB5" style={{flex: "1", flexDirection: "column", display: "flex", marginRight: "20px"}}>
|
||||
<div className="flex-itemB51" style={{flex: "10"}}><img src={imgs[2]} alt = "cover3" width="100%" height="100%"/></div>
|
||||
<div className="flex-itemB52 text-center" style={{flex: "1", color:"white",fontSize: " 32px",fontWeight: "bold"}}>Stranger Things</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default SearchSuggestions;
|
44
frontend/src/Pages/Filmpage.js
Normal file
44
frontend/src/Pages/Filmpage.js
Normal file
@ -0,0 +1,44 @@
|
||||
import React,{useEffect} from "react";
|
||||
import { useParams } from 'react-router-dom';
|
||||
import gradientImg from '../Assets/background.png';
|
||||
import Navbar from '../Components/Navbar';
|
||||
import Footer from '../Components/Footer';
|
||||
import { getMovie } from "../Components/DataService";
|
||||
function Filmpage()
|
||||
{
|
||||
const { customerId, movieId } = useParams();
|
||||
const [movie, setMovie] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetchMovie();
|
||||
}, []);
|
||||
|
||||
const fetchMovie = async () => {
|
||||
const movieData = await getMovie();
|
||||
setMovie(movieData);
|
||||
};
|
||||
return(
|
||||
<body>
|
||||
<div className="flex-container" style={{flexDirection:"column",display: "flex",backgroundImage: `url(${gradientImg})`}}>
|
||||
<Navbar customerId={customerId}/>
|
||||
<div className="flex-container min-vh-100" style={{flexDirection: "column", display: "flex"}}>
|
||||
<main style={{display: "flex", flex: "1", gap:"100px"}}>
|
||||
|
||||
<div className="flex-container" style={{display: "inline-flex", flex:"1" , flexWrap:" wrap", gap: "40px"}}>
|
||||
<div className="flex-item1 align-self-center" style={{ flex:"1"}}>
|
||||
<img src="https://www.seekpng.com/png/detail/8-84931_question-mark-question-mark-white-background.png" width="400px" height="600px"/></div>
|
||||
<div className="flex-container align-self-center" style={{flex: "3"}}>
|
||||
<div className="flex-item1 text-light" style={{fontSize: "50px"}}><a>{movie.title}</a></div>
|
||||
<div className="flex-item3 text-light" style={{fontSize: "35px"}}>Average score: {movie.score}</div>
|
||||
<div className="flex-item3 text-light" style={{fontSize: "35px"}}>Length: {movie.length}</div>
|
||||
<div className="flex-item3 text-light" style={{fontSize: "35px"}}>Genre: {movie.genre}</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<Footer/>
|
||||
</div>
|
||||
</body>
|
||||
)
|
||||
}
|
||||
export default Filmpage;
|
52
frontend/src/Pages/Librarypage.js
Normal file
52
frontend/src/Pages/Librarypage.js
Normal file
@ -0,0 +1,52 @@
|
||||
import React,{useEffect} from "react";
|
||||
import gradientImg from '../Assets/background.png';
|
||||
import Footer from '../Components/Footer';
|
||||
import Navbar from '../Components/Navbar';
|
||||
import { useParams} from 'react-router-dom';
|
||||
import { getCustomerMovies } from "../Components/DataService";
|
||||
function Librarypage()
|
||||
{
|
||||
const [movies, setMovies] = useState([]);
|
||||
const { customerId } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
fetchMovies();
|
||||
}, []);
|
||||
|
||||
const fetchMovies = async () => {
|
||||
const moviesData = await getCustomerMovies(customerId);
|
||||
setMovies(moviesData);
|
||||
};
|
||||
|
||||
|
||||
return(
|
||||
<body>
|
||||
<div className="flex-container" style={{flexDirection:"column",display: "flex",backgroundImage: `url(${gradientImg})`}}>
|
||||
<Navbar customerId={customerId}/>
|
||||
<div className="flex-container min-vh-100" style={{flexDirection: "column", display: "flex"}}>
|
||||
<main style={{display: "flex", flex: "1",flexWrap: "wrap", gap:"30px"}}>
|
||||
{movies.length > 0 ? (
|
||||
<div>
|
||||
{movies.map((movie) => (
|
||||
<Film key={movie.id}
|
||||
title={movie.title}
|
||||
acquire={() => handleAcquireMovie(movie.id)}
|
||||
main={false}
|
||||
movieId = {movie.id}
|
||||
customerId={customerId}
|
||||
/>
|
||||
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p>No movies available</p>
|
||||
)}
|
||||
</main>
|
||||
</div>
|
||||
<Footer/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
)
|
||||
}
|
||||
export default Librarypage;
|
70
frontend/src/Pages/Mainpage.js
Normal file
70
frontend/src/Pages/Mainpage.js
Normal file
@ -0,0 +1,70 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import gradientImg from '../Assets/background.png';
|
||||
import Footer from '../Components/Footer';
|
||||
import { getMovies } from '../Components/DataService';
|
||||
import { acquireMovie } from '../Components/DataService';
|
||||
import { useParams} from 'react-router-dom';
|
||||
import Navbar from '../Components/Navbar';
|
||||
import Film from '../Components/Film';
|
||||
function MainPage() {
|
||||
const [movies, setMovies] = useState([]);
|
||||
const { customerId } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
fetchMovies();
|
||||
}, []);
|
||||
|
||||
const fetchMovies = async () => {
|
||||
const moviesData = await getMovies();
|
||||
setMovies(moviesData);
|
||||
};
|
||||
|
||||
const handleAcquireMovie = async (movieId) => {
|
||||
await acquireMovie(movieId,customerId);
|
||||
const updatedMovies = movies.map((movie) => {
|
||||
return movie;
|
||||
});
|
||||
|
||||
setMovies(updatedMovies);
|
||||
};
|
||||
|
||||
return (
|
||||
<body>
|
||||
<div className="flex-container" id = "cc" style={{flexDirection:"column",display: "flex",backgroundImage: `url(${gradientImg})`}}>
|
||||
<Navbar customerId={customerId}/>
|
||||
|
||||
<div className="flex-container min-vh-100" style={{flexDirection: "column", display: "flex"}}>
|
||||
<main style={{display: "flex", flex: "1", gap:"100px"}}>
|
||||
<div className="flex-container" style={{display: "flex", flexDirection: "column", flex:"1"}}>
|
||||
<header className="flex-item" style={{display: "flex", height: "90px"}}>
|
||||
<aside></aside>
|
||||
</header>
|
||||
|
||||
{movies.length > 0 ? (
|
||||
<div>
|
||||
{movies.map((movie) => (
|
||||
<Film key={movie.id}
|
||||
title={movie.title}
|
||||
acquire={() => handleAcquireMovie(movie.id)}
|
||||
main = {true}
|
||||
movieId = {movie.id}
|
||||
customerId={customerId}
|
||||
/>
|
||||
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p>No movies available</p>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<Footer/>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
export default MainPage;
|
73
frontend/src/Pages/Regpage.js
Normal file
73
frontend/src/Pages/Regpage.js
Normal file
@ -0,0 +1,73 @@
|
||||
import React,{useState} from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { registerUser } from '../Components/DateService.js';
|
||||
import gradientImg from '../Assets/background.png';
|
||||
import Header from '../Components/Header';
|
||||
import Footer from '../Components/Footer';
|
||||
import CoverImg from '../Assets/covers.jpg'
|
||||
import {addUser} from '../Components/DataService'
|
||||
function Regpage()
|
||||
{
|
||||
|
||||
const [inputUsername, setUsername] = useState('');
|
||||
const [inputPassword,setPassword] = useState('');
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
const {id , value} = e.target;
|
||||
if(id === "inputUsername"){
|
||||
setUsername(value);
|
||||
}
|
||||
if(id === "inputPassword"){
|
||||
setPassword(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const customerDTO = await registerUser(fullName, password);
|
||||
|
||||
history.push(`/movie/${customerDTO.id}`);
|
||||
|
||||
setUsername = '';
|
||||
setPassword = '';
|
||||
}
|
||||
|
||||
return(
|
||||
<body>
|
||||
<div className="flex-container" style={{flexDirection:"column",display: "flex",backgroundImage: `url(${gradientImg})`}}>
|
||||
<Header/>
|
||||
<div className="flex-container min-vh-100" style={{flexDirection: "column", display: "flex"}}>
|
||||
<main style={{display: "flex", flex: "1"}}>
|
||||
<aside className="flex-item2" style={{flex: "2"}}></aside>
|
||||
<div className="flex-item3 align-self-center" style={{flex: "3"}}><img src={CoverImg} alt = "cover" width="100%" height="600px"/></div>
|
||||
<section className="flex-container align-self-center" style={{height:"660px", flex: "4", backgroundColor: "#ffd79d", flexDirection: "column", display: "flex"}}>
|
||||
<form>
|
||||
<section className="flex-itemR1" style={{color: "#320D3E",fontSize: "50px",fontWeight: "bold", paddingLeft: "30px",paddingTop: "10px"}}>SIGN UP</section>
|
||||
<section className="flex-itemR2" style={{color: "#320D3E",fontSize: "35px",fontWeight: "bold", paddingLeft: "30px",paddingTop: "10px"}}>
|
||||
<label style={{color: "#320D3E",fontSize: "32px",fontWeight: "bold"}}>USERNAME</label>
|
||||
</section>
|
||||
<section className="flex-itemR3" style={{display: "flex", width: "320px", paddingLeft: "30px"}}>
|
||||
<input className="form-control" id="inputUsername" type="string" value={inputUsername} onChange = {(e) => handleInputChange(e)} placeholder="Enter username"/>
|
||||
</section>
|
||||
<section className="flex-itemR6" style={{color: "#320D3E",fontSize: "35px",fontWeight: "bold", paddingLeft: "30px",paddingTop: "10px"}}>
|
||||
<label style={{color: "#320D3E",fontSize: "32px",fontWeight: "bold"}}>PASSWORD</label>
|
||||
</section>
|
||||
<section className="flex-itemR7" style={{display: "flex", width: "320px", paddingLeft: "30px"}}>
|
||||
<input className="form-control" id="inputPassword" type="password" value={inputPassword} onChange = {(e) => handleInputChange(e)} placeholder="Enter password"/>
|
||||
</section>
|
||||
<button className="btn btn-primary" type="button" id="register" style={{fontSize: "20px", marginLeft: "30px", marginTop: "15px", width: "150px", backgroundColor: "#320D3E", color:"white", fontWeight: "bold"}} onClick={()=>{handleSubmit();addUser(inputUsername,inputPassword);}} >Register</button>
|
||||
</form>
|
||||
</section>
|
||||
<aside className="flex-item5" style={{flex: "2"}}></aside>
|
||||
</main>
|
||||
</div>
|
||||
<Footer/>
|
||||
</div>
|
||||
</body>
|
||||
)
|
||||
}
|
||||
export default Regpage;
|
74
frontend/src/Pages/Searchpage.js
Normal file
74
frontend/src/Pages/Searchpage.js
Normal file
@ -0,0 +1,74 @@
|
||||
import React,{useState} from "react";
|
||||
import gradientImg from '../Assets/background.png'
|
||||
import Navbar from '../Components/Navbar';
|
||||
import Footer from '../Components/Footer'
|
||||
import Film from '../Components/Film';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
function Searchpage()
|
||||
{
|
||||
|
||||
const { customerId } = useParams();
|
||||
const [genre, setGenre] = useState('');
|
||||
const [movies, setMovies] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleGenreChange = (event) => {
|
||||
setGenre(event.target.value);
|
||||
};
|
||||
|
||||
const handleSearch = async () => {
|
||||
setLoading(true);
|
||||
|
||||
const response = await getMoviesByGenre(genre);
|
||||
setMovies(response);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<body>
|
||||
<div className="flex-container" style={{flexDirection:"column",display: "flex",backgroundImage: `url(${gradientImg})`}}>
|
||||
<Navbar customerId={customerId}/>
|
||||
<div className="flex-container min-vh-100" style={{flexDirection: "column", display: "flex"}}>
|
||||
<main style={{display: "flex", flex: "1", gap:"100px"}}>
|
||||
<div>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Enter genre"
|
||||
value={genre}
|
||||
onChange={handleGenreChange}
|
||||
/>
|
||||
<button onClick={handleSearch}>Search</button>
|
||||
</div>
|
||||
{loading ? (
|
||||
<p>Loading movies...</p>
|
||||
) : (
|
||||
<div>
|
||||
{movies.length > 0 ? (
|
||||
<div>
|
||||
{movies.map((movie) => (
|
||||
<Film key={movie.id}
|
||||
title={movie.title}
|
||||
acquire={() => handleAcquireMovie(movie.id)}
|
||||
main = {true}
|
||||
movieId = {movie.id}
|
||||
customerId={customerId}
|
||||
/>
|
||||
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p>No movies found</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
</div>
|
||||
<Footer/>
|
||||
</div>
|
||||
</body>
|
||||
</>
|
||||
|
||||
);
|
||||
}
|
||||
export default Searchpage;
|
13
frontend/src/index.css
Normal file
13
frontend/src/index.css
Normal file
@ -0,0 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
15
frontend/src/index.js
Normal file
15
frontend/src/index.js
Normal file
@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<App />
|
||||
);
|
||||
|
||||
// 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();
|
13
frontend/src/reportWebVitals.js
Normal file
13
frontend/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
frontend/src/setupTests.js
Normal file
5
frontend/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';
|
23
frontend/src/style.css
Normal file
23
frontend/src/style.css
Normal file
@ -0,0 +1,23 @@
|
||||
@media screen and (max-width: 768px) {
|
||||
|
||||
main
|
||||
{
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
header
|
||||
{
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.button:hover
|
||||
{
|
||||
background-color: #ffd79d;
|
||||
color:black;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user