├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── favicon.jpg ├── images │ ├── cinema.png │ ├── github-icon.png │ ├── history.svg │ ├── home-background.png │ ├── home.svg │ ├── linkedin-icon.png │ ├── login-bg.jpg │ ├── muted.png │ ├── poster1.jpg │ ├── poster2.jpg │ ├── poster3.jpg │ ├── profile.svg │ ├── request.svg │ ├── tfs.png │ ├── ticket.png │ ├── tickets.svg │ └── unmuted.png ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json ├── robots.txt └── ticket_template │ └── ticket.pdf └── src ├── App.css ├── App.js ├── app └── store.js ├── components ├── booking │ ├── booking.js │ ├── condensed_movie_details │ │ └── condensed_movie_details.js │ ├── screening_details │ │ └── screening_details.js │ └── seat_chart │ │ ├── seat_chart.css │ │ └── seat_chart.js ├── footer │ └── footer.js ├── header │ └── header.js ├── home │ ├── home.js │ ├── movies_list │ │ └── movies_list.js │ └── slider │ │ └── slider.js ├── login │ └── login.js ├── movie │ ├── movie.js │ ├── movie_details │ │ └── movie_details.js │ └── screening_details │ │ └── screening_details.js └── ticket │ └── ticket.js ├── data └── data.js ├── features └── counter │ ├── Counter.js │ ├── Counter.module.css │ ├── counterAPI.js │ ├── counterSlice.js │ └── counterSlice.spec.js ├── index.css ├── index.js ├── serviceWorker.js └── setupTests.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TFS frontend 2 | 3 | This is the front end of TFS, a project inspired by [BookMyShow](https://in.bookmyshow.com/). This project aims to aid a cinema theatre where visitors can view upcoming films and purchase tickets. 4 | 5 | ## Deployed on Netlify: 6 | 7 | [View Deployment](https://tfs-frontend.netlify.app) 8 | 9 | ## Available Scripts 10 | 11 | In the project directory, you can run: 12 | 13 | ### `npm start` 14 | 15 | Runs the app in the development mode.
16 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 17 | 18 | The page will reload if you make edits.
19 | You will also see any lint errors in the console. 20 | 21 | ### `npm test` 22 | 23 | Launches the test runner in the interactive watch mode.
24 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 25 | 26 | ### `npm run build` 27 | 28 | Builds the app for production to the `build` folder.
29 | It correctly bundles React in production mode and optimizes the build for the best performance. 30 | 31 | The build is minified and the filenames include the hashes.
32 | Your app is ready to be deployed! 33 | 34 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 35 | 36 | ### `npm run eject` 37 | 38 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 39 | 40 | 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. 41 | 42 | 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. 43 | 44 | 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. 45 | 46 | ## Learn More 47 | 48 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 49 | 50 | To learn React, check out the [React documentation](https://reactjs.org/). 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tfs-frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/fontawesome-svg-core": "^1.2.36", 7 | "@fortawesome/free-solid-svg-icons": "^5.15.4", 8 | "@fortawesome/react-fontawesome": "^0.1.15", 9 | "@reduxjs/toolkit": "^1.6.1", 10 | "@testing-library/jest-dom": "^4.2.4", 11 | "@testing-library/react": "^9.5.0", 12 | "@testing-library/user-event": "^7.2.1", 13 | "font-awesome": "^4.7.0", 14 | "react": "^17.0.2", 15 | "react-dom": "^17.0.2", 16 | "react-moment": "^1.1.2", 17 | "react-player": "^2.9.0", 18 | "react-redux": "^7.2.5", 19 | "react-router-dom": "^5.3.0", 20 | "react-scripts": "4.0.3", 21 | "react-seat-picker": "^1.5.3", 22 | "react-slick": "^0.28.1", 23 | "react-tooltip": "^4.2.21", 24 | "slick-carousel": "^1.8.1", 25 | "styled-components": "^5.3.1" 26 | }, 27 | "scripts": { 28 | "start": "react-scripts start", 29 | "build": "react-scripts build", 30 | "test": "react-scripts test", 31 | "eject": "react-scripts eject" 32 | }, 33 | "eslintConfig": { 34 | "extends": "react-app" 35 | }, 36 | "browserslist": { 37 | "production": [ 38 | ">0.2%", 39 | "not dead", 40 | "not op_mini all" 41 | ], 42 | "development": [ 43 | "last 1 chrome version", 44 | "last 1 firefox version", 45 | "last 1 safari version" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/favicon.ico -------------------------------------------------------------------------------- /public/favicon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/favicon.jpg -------------------------------------------------------------------------------- /public/images/cinema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/cinema.png -------------------------------------------------------------------------------- /public/images/github-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/github-icon.png -------------------------------------------------------------------------------- /public/images/history.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/home-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/home-background.png -------------------------------------------------------------------------------- /public/images/home.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/linkedin-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/linkedin-icon.png -------------------------------------------------------------------------------- /public/images/login-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/login-bg.jpg -------------------------------------------------------------------------------- /public/images/muted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/muted.png -------------------------------------------------------------------------------- /public/images/poster1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/poster1.jpg -------------------------------------------------------------------------------- /public/images/poster2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/poster2.jpg -------------------------------------------------------------------------------- /public/images/poster3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/poster3.jpg -------------------------------------------------------------------------------- /public/images/profile.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/request.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/tfs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/tfs.png -------------------------------------------------------------------------------- /public/images/ticket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/ticket.png -------------------------------------------------------------------------------- /public/images/tickets.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | 13 | 16 | 21 | 22 | 25 | 30 | 33 | 34 | 35 | 36 | 38 | 39 | 42 | 47 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /public/images/unmuted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/images/unmuted.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | TFS 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /public/ticket_template/ticket.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wweverma1/tfs-frontend/f36af62164153c8b3ff49c613d0212e0bfa2d11e/public/ticket_template/ticket.pdf -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './App.css'; 3 | import Header from './components/header/header'; 4 | import Home from './components/home/home'; 5 | import Footer from './components/footer/footer' 6 | import Movie from './components/movie/movie'; 7 | import Login from './components/login/login'; 8 | import Booking from './components/booking/booking'; 9 | import Ticket from './components/ticket/ticket'; 10 | import { 11 | BrowserRouter as Router, 12 | Switch, 13 | Route, 14 | // Link 15 | } from "react-router-dom"; 16 | 17 | function App() { 18 | return ( 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
42 | ); 43 | } 44 | 45 | export default App; 46 | -------------------------------------------------------------------------------- /src/app/store.js: -------------------------------------------------------------------------------- 1 | import { configureStore } from '@reduxjs/toolkit'; 2 | import counterReducer from '../features/counter/counterSlice'; 3 | 4 | export const store = configureStore({ 5 | reducer: { 6 | counter: counterReducer, 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /src/components/booking/booking.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import CondensedMovieDetails from './condensed_movie_details/condensed_movie_details' 4 | import ScreeningDetails from './screening_details/screening_details' 5 | import SeatChart from './seat_chart/seat_chart' 6 | import { Link } from "react-router-dom"; 7 | import { useParams }from "react-router-dom" 8 | import { movieData } from "./../../data/data.js"; 9 | 10 | function setZoom() { 11 | if (navigator.appVersion.indexOf("Win") !== -1) 12 | { 13 | document.body.style.zoom = "75%"; 14 | } 15 | } 16 | 17 | const Booking = () => { 18 | const { movie_id } = useParams(); 19 | const booking_id = Math.floor(1000 + Math.random() * 9000); 20 | setZoom() 21 | return ( 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | BOOK TICKETS 32 | 33 | 34 | 35 | 36 | 37 | 38 | {movieData[movie_id-1]["name"]} 39 | 40 | 41 | 42 | ) 43 | } 44 | 45 | export default Booking 46 | 47 | const Container = styled.main` 48 | min-height: calc(100vh - 140px); 49 | padding: 0 calc(3.5vw + 5px); 50 | background: #0c111b; 51 | position: relative; 52 | overflow-x: hidden; 53 | display: flex; 54 | 55 | @media (max-width: 900px) { 56 | flex-direction: column-reverse; 57 | } 58 | ` 59 | 60 | const BookingSection = styled.div` 61 | margin-top: 40px; 62 | height: 100%; 63 | width: 40%; 64 | background: #0c111b; 65 | border-radius: 10px; 66 | padding: 10px 30px; 67 | 68 | @media (max-width: 900px) { 69 | padding: 10px 20px; 70 | width:100%; 71 | } 72 | ` 73 | const MoviePoster = styled.div` 74 | width: auto; 75 | margin: 0 auto; 76 | margin-top: 90px; 77 | ` 78 | const Wrap = styled.div` 79 | border-radius: 10px; 80 | border: 3px solid rgba(249, 249, 249, 0.1); 81 | box-shadow: rgba(0 0 0 / 69%) 0px 26px 30px -10px, 82 | rgba(0 0 0 / 73%) 0px 16px 10px -10px; 83 | transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s; 84 | overflow: hidden; 85 | 86 | img { 87 | height: 65vh; 88 | width: auto; 89 | object-fit: cover; 90 | } 91 | 92 | &:hover { 93 | transform: scale(1.05); 94 | box-shadow: rgba(0 0 0 / 80%) 0px 40px 58px -16px, 95 | rgba(0 0 0 / 72%) 0px 30px 22px -10px; 96 | border-color: rgba(249, 249, 249, 0.8); 97 | } 98 | ` 99 | const BookButton = styled.div` 100 | margin: 40px 0px; 101 | ` 102 | 103 | const BookTicket = styled.button` 104 | border-radius: 4px; 105 | font-size: 15px; 106 | padding: 15px 20px; 107 | background: rgb(249, 249, 249, 0.8); 108 | border: none; 109 | letter-spacing: 1.8px; 110 | cursor: pointer; 111 | 112 | &:hover { 113 | background: rgb(249, 249, 249); 114 | } 115 | 116 | img { 117 | vertical-align:middle; 118 | } 119 | 120 | @media (max-width: 900px) { 121 | width:100%; 122 | display: flex; 123 | align-items: center; 124 | justify-content: center; 125 | } 126 | ` -------------------------------------------------------------------------------- /src/components/booking/condensed_movie_details/condensed_movie_details.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const CondensedMovieDetails = (props) => { 5 | return ( 6 | 7 | cinema icon 8 |
9 |

10 | {props.movie.name} 11 |

12 | 13 | {props.movie.lang} • {props.movie.duration}m • Animated 14 | 15 |
16 |
17 | ) 18 | } 19 | 20 | export default CondensedMovieDetails 21 | 22 | const Container = styled.div` 23 | padding: 30px 0px 0px; 24 | border-radius: 10px; 25 | overflow: hidden; 26 | display: flex; 27 | flex: 1; 28 | align-items: center; 29 | 30 | img { 31 | padding: 0px 20px 0px 5px; 32 | } 33 | ` 34 | 35 | const Details = styled.div` 36 | line-height: 3px; 37 | padding: 10px; 38 | text-align: left; 39 | 40 | @media (max-width: 900px) { 41 | h1 { 42 | font-size: 22px; 43 | } 44 | } 45 | ` 46 | 47 | const SubTitle = styled.div` 48 | color: rgb(249, 249, 249, 0.6); 49 | font-size: 15px; 50 | min-height: 20px; 51 | margin-top: 26px; 52 | ` 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/components/booking/screening_details/screening_details.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import { Link } from "react-router-dom"; 4 | import moment from "moment"; 5 | 6 | function screening_details() { 7 | return ( 8 | 9 |

SELECT SUITABLE SCREENING

10 | 11 | 12 | 13 | 10 AM {moment().add(1,'days').format('DD MMM')} 14 | 15 | 16 | 17 | 18 | 8 PM {moment().add(1,'days').format('DD MMM')} 19 | 20 | 21 | 22 | 23 | 10 AM {moment().add(2,'days').format('DD MMM')} 24 | 25 | 26 | 27 | 28 | 8 PM {moment().add(2,'days').format('DD MMM')} 29 | 30 | 31 | 32 |
33 | ) 34 | } 35 | 36 | export default screening_details 37 | 38 | const Container = styled.div` 39 | padding: 30px 0px 26px; 40 | @media (max-width: 900px) { 41 | margin-bottom: 30px; 42 | } 43 | ` 44 | 45 | const Content = styled.div` 46 | display: flex; 47 | grid-gap: 25px; 48 | overflow-X:auto; 49 | padding: 10px 5px; 50 | @media (max-width: 900px) { 51 | font-size: 12px; 52 | } 53 | 54 | ::-webkit-scrollbar { 55 | display: none; 56 | } 57 | ` 58 | const Screening = styled.div`` 59 | 60 | const Wrap = styled.div` 61 | border-radius: 10px; 62 | cursor: pointer; 63 | border: 3px solid rgba(249, 249, 249, 0.1); 64 | transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s; 65 | text-align: center; 66 | padding: 20px 10px 20px; 67 | @media (max-width: 900px) { 68 | width: 150px; 69 | } 70 | 71 | &:hover { 72 | transform: scale(1.05); 73 | box-shadow: rgba(0 0 0 / 80%) 0px 40px 58px -16px, 74 | rgba(0 0 0 / 72%) 0px 30px 22px -10px; 75 | border-color: rgba(249, 249, 249, 0.8); 76 | } 77 | 78 | span { 79 | font-size: 15px; 80 | letter-spacing: 1.42px; 81 | color: rgb(249, 249, 249, 0.8); 82 | } 83 | ` -------------------------------------------------------------------------------- /src/components/booking/seat_chart/seat_chart.css: -------------------------------------------------------------------------------- 1 | .container { 2 | width: 100%; 3 | margin: auto; 4 | } 5 | 6 | @media (max-width: 900px) { 7 | 8 | .grid { 9 | width: 100%; 10 | } 11 | 12 | .grid td { 13 | height: 35px; 14 | width: 35px; 15 | padding: 5px 5px; 16 | } 17 | } 18 | 19 | .grid td { 20 | height: 50px; 21 | width: 50px; 22 | padding: 15px 10px; 23 | border: 2px solid rgb(249, 249, 249, 0.5); 24 | text-align: center; 25 | float: left; 26 | margin: 5px; 27 | } 28 | 29 | .grid td:hover { 30 | opacity: .7; 31 | cursor: pointer; 32 | } 33 | 34 | .unavailable { 35 | display: inline-block; 36 | background-color: #cd5c5c; 37 | pointer-events: none; 38 | } 39 | 40 | .reserved { 41 | border-color: #1ea83c !important; 42 | color: #fff; 43 | background-color: #1ea83c!important; 44 | display: inline-block; 45 | } 46 | 47 | .available { 48 | color: white; 49 | } 50 | 51 | li { 52 | list-style: none; 53 | } -------------------------------------------------------------------------------- /src/components/booking/seat_chart/seat_chart.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './seat_chart.css'; 3 | 4 | class seat_chart extends React.Component { 5 | 6 | constructor() { 7 | super(); 8 | this.state = { 9 | seat: [ 10 | ['1','2','3', '4', '5', '6', '7', '8', '9', '10'], 11 | ['11','12','13', '14', '15', '16', '17', '18', '19', '20'], 12 | ['21','22','23', '24', '25', '26', '27', '28', '29', '30'], 13 | ['31','32','33', '34', '35', '36', '37', '38', '39', '40'], 14 | ['41','42','43', '44', '45', '46', '47', '48', '49', '50'] 15 | ], 16 | seatAvailable: [ 17 | ['1','2','3', '4', '5', '6', '7', '8', '9', '10'], 18 | ['11','12','13', '14', '15', '16', '17', '18', '19', '20'], 19 | ['21','22','23', '24', '25', '26', '27', '28', '29', '30'], 20 | ['31','32','33', '34', '35', '36', '37', '38', '39', '40'], 21 | ['41','42','43', '44', '45', '46', '47', '48', '49', '50'] 22 | ], 23 | seatReserved: [], 24 | seatUnavailable: ['12', '13', '14'], 25 | } 26 | } 27 | 28 | onClickData(seat) { 29 | if(this.state.seatReserved.indexOf(seat) > -1 ) { 30 | this.setState({ 31 | seatAvailable: this.state.seatAvailable.concat(seat), 32 | seatReserved: this.state.seatReserved.filter(res => res !== seat) 33 | }) 34 | } else { 35 | this.setState({ 36 | seatReserved: this.state.seatReserved.concat(seat), 37 | seatAvailable: this.state.seatAvailable.filter(res => res !== seat) 38 | }) 39 | } 40 | } 41 | 42 | render() { 43 | return ( 44 |
45 |

PICK YOUR SEATS

46 | 53 |
54 | ) 55 | } 56 | } 57 | 58 | export default seat_chart 59 | 60 | class DrawGrid extends React.Component { 61 | render() { 62 | return ( 63 |
64 | 65 | 66 | { this.props.seat.map((numList,i) => ( 67 | 68 | { numList.map ( seat_no => 69 | 73 | )} 74 | 75 | )) 76 | } 77 | 78 |
-1? 'unavailable': this.props.reserved.indexOf(seat_no) > -1? 'reserved': 'available'} 71 | key={seat_no} onClick = {e => this.onClickSeat(seat_no)}>{seat_no} 72 |
79 | 80 | {/* 81 | */} 82 |
83 | ) 84 | } 85 | 86 | onClickSeat(seat) { 87 | this.props.onClickData(seat); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/components/footer/footer.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | function header() { 5 | return ( 6 | 15 | ) 16 | } 17 | 18 | export default header 19 | 20 | const Nav = styled.nav` 21 | height: 70px; 22 | background: #090b13; 23 | display: flex; 24 | align-items: center; 25 | padding: 0 36px; 26 | overflow-x: hidden; 27 | ` 28 | 29 | const FooterLeft = styled.div` 30 | display: flex; 31 | width:50%; 32 | 33 | span { 34 | text-align: center; 35 | } 36 | ` 37 | 38 | const FooterRight = styled.div` 39 | display: flex; 40 | justify-content: flex-end; 41 | width:50%; 42 | 43 | a { 44 | padding-right: 20px; 45 | } 46 | 47 | img { 48 | height: 30px; 49 | } 50 | ` -------------------------------------------------------------------------------- /src/components/header/header.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | import { 5 | Link 6 | } from "react-router-dom"; 7 | 8 | function header() { 9 | return ( 10 | 36 | ) 37 | } 38 | 39 | export default header 40 | 41 | const Nav = styled.nav` 42 | height: 70px; 43 | background: #090b13; 44 | display: flex; 45 | align-items: center; 46 | padding: 0 36px; 47 | overflow-x: hidden; 48 | 49 | @media (max-width: 900px) { 50 | flex:1; 51 | display: flex; 52 | justify-content: space-between; 53 | } 54 | ` 55 | const Logo = styled.img` 56 | width: 80px; 57 | ` 58 | 59 | const NavMenu = styled.div` 60 | display: flex; 61 | flex: 1; 62 | margin-left: 25px; 63 | align-items: center; 64 | 65 | a { 66 | text-decoration: none; 67 | color: white; 68 | display: flex; 69 | align-items: center; 70 | padding: 0 12px; 71 | cursor: pointer; 72 | 73 | img { 74 | height: 20px; 75 | } 76 | 77 | span { 78 | font-size: 13px; 79 | letter-spacing: 1.42px; 80 | position: relative; 81 | 82 | &:after { 83 | content: ""; 84 | height: 2px; 85 | background: white; 86 | position: absolute; 87 | left:0; 88 | right:0; 89 | bottom: -6px; 90 | opacity: 0; 91 | transform-origin: left center; 92 | transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s; 93 | transform: scaleX(0.5); 94 | } 95 | } 96 | 97 | &:hover { 98 | span:after { 99 | transform: scaleX(1); 100 | opacity: 1; 101 | } 102 | } 103 | } 104 | 105 | @media (max-width: 900px) { 106 | display: none; 107 | } 108 | ` 109 | 110 | const UserImg = styled.img` 111 | width: 50px; 112 | height: 50px; 113 | border-radius: 50%; 114 | cursor: pointer; 115 | ` 116 | -------------------------------------------------------------------------------- /src/components/home/home.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import Slider from './slider/slider' 4 | import MoviesList from './movies_list/movies_list' 5 | 6 | function home() { 7 | return ( 8 | 9 | 10 | 11 | 12 | ) 13 | } 14 | 15 | export default home 16 | 17 | const Container = styled.main` 18 | min-height: calc(100vh - 70px); 19 | padding: 0 calc(3.5vw + 5px); 20 | position: relative; 21 | overflow-x: hidden; 22 | 23 | &:before { 24 | background: url("/images/home-background.png") center center / cover 25 | no-repeat fixed; 26 | content: ""; 27 | position: absolute; 28 | top: 0; 29 | bottom: 0; 30 | left: 0; 31 | right: 0; 32 | z-index: -1; 33 | } 34 | ` -------------------------------------------------------------------------------- /src/components/home/movies_list/movies_list.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import { Link } from "react-router-dom"; 4 | import { movieData } from "./../../../data/data.js"; 5 | 6 | function movies_list() { 7 | return ( 8 | 9 |

Now Showing

10 | 11 | {movieData.map((movie, key) => { 12 | return ( 13 | 14 | 15 | {movie.name} 16 | 17 | 18 | ); 19 | })} 20 | 21 |
22 | ) 23 | } 24 | 25 | export default movies_list 26 | 27 | 28 | const Container = styled.div` 29 | margin-top: 10px; 30 | padding: 30px 0px 26px; 31 | ` 32 | 33 | const Content = styled.div` 34 | display: grid; 35 | grid-gap: 25px; 36 | grid-template-columns: repeat(4, minmax(0, 1fr)); 37 | ` 38 | 39 | const Wrap = styled.div` 40 | border-radius: 10px; 41 | cursor: pointer; 42 | overflow: hidden; 43 | border: 3px solid rgba(249, 249, 249, 0.1); 44 | box-shadow: rgba(0 0 0 / 69%) 0px 26px 30px -10px, 45 | rgba(0 0 0 / 73%) 0px 16px 10px -10px; 46 | transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s; 47 | 48 | img { 49 | width: 100%; 50 | height: 100%; 51 | object-fit: cover; 52 | } 53 | 54 | &:hover { 55 | transform: scale(1.05); 56 | box-shadow: rgba(0 0 0 / 80%) 0px 40px 58px -16px, 57 | rgba(0 0 0 / 72%) 0px 30px 22px -10px; 58 | border-color: rgba(249, 249, 249, 0.8); 59 | } 60 | ` -------------------------------------------------------------------------------- /src/components/home/slider/slider.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components'; 3 | import Slider from 'react-slick'; 4 | import "slick-carousel/slick/slick.css"; 5 | import "slick-carousel/slick/slick-theme.css"; 6 | import { Link } from "react-router-dom"; 7 | import { movieData } from "./../../../data/data.js"; 8 | 9 | function slider() { 10 | let settings = { 11 | dots: true, 12 | infinite: true, 13 | speed: 500, 14 | slidesToShow: 1, 15 | slidesToScroll: 1, 16 | autoplay: true, 17 | } 18 | 19 | return ( 20 | 21 | 22 | 23 | {movieData[0]["name"]} 24 | 25 | 26 | 27 | 28 | {movieData[1]["name"]} 29 | 30 | 31 | 32 | 33 | {movieData[2]["name"]} 34 | 35 | 36 | 37 | ) 38 | } 39 | 40 | export default slider 41 | 42 | const Carousel = styled(Slider)` 43 | margin-top: 20px; 44 | 45 | ul li button { 46 | &:before { 47 | font-size: 10px; 48 | color: rgb(150, 158, 171); 49 | } 50 | } 51 | li.slick-active button:before { 52 | color: white; 53 | } 54 | 55 | .slick-list { 56 | overflow: visible; 57 | } 58 | 59 | button { 60 | z-index: 1; 61 | } 62 | 63 | 64 | ` 65 | 66 | const Wrap = styled.div` 67 | border-radius: 4px; 68 | cursor: pointer; 69 | position: relative; 70 | 71 | img { 72 | border-radius: 4px; 73 | box-shadow: rgb(0 0 0 / 69%) 0px 26px 30px -10px, 74 | rgb(0 0 0 / 73%) 0px 16px 10px -10px; 75 | cursor: pointer; 76 | display: block; 77 | position: relative; 78 | padding: 4px; 79 | width: 100%; 80 | height: 100%; 81 | } 82 | 83 | &:hover { 84 | padding: 0; 85 | border: 4px solid rgba(249, 249, 249, 0.8); 86 | transition-duration: 300ms; 87 | } 88 | ` 89 | -------------------------------------------------------------------------------- /src/components/login/login.js: -------------------------------------------------------------------------------- 1 | import React, {useState} from 'react' 2 | import styled from 'styled-components' 3 | import 'font-awesome/css/font-awesome.min.css'; 4 | import { 5 | Link 6 | } from "react-router-dom"; 7 | 8 | function Login() { 9 | const [mode, toggleMode] = useState(true); 10 | 11 | return ( 12 | 13 | 14 |
15 |

{mode ? 'Welcome back!' : 'Hey There!'}

16 | 17 | {mode ? 'Don\'t' : 'Already'} have an account? 18 | toggleMode(!mode)} /> 19 | 20 | 21 |
22 | 23 |
24 |
25 | ) 26 | } 27 | 28 | export default Login 29 | 30 | function LoginForm({mode}) { 31 | 32 | return ( 33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
63 |
64 | 65 | 66 | 67 | 68 | ) 69 | 70 | } 71 | 72 | const Container = styled.div` 73 | position: relative; 74 | height: calc(100vh - 140px); 75 | display:flex; 76 | align-items: center; 77 | justify-content: center; 78 | 79 | &:before { 80 | background-position: top; 81 | background-size: cover; 82 | background-repeat: no-repeat; 83 | background-image: url("/images/login-bg.jpg"); 84 | position: absolute; 85 | content: ""; 86 | top:0; 87 | bottom:0; 88 | left:0; 89 | right:0; 90 | z-index:-1; 91 | } 92 | ` 93 | 94 | const Content = styled.div` 95 | max-width: 650px; 96 | padding: 50px 40px; 97 | width: 80%; 98 | display: flex; 99 | flex-direction: column; 100 | background: rgba(0,0,0,0.8); 101 | border-radius: 10px; 102 | overflow: hidden; 103 | 104 | @media (max-width: 900px) { 105 | width: 90%; 106 | } 107 | ` 108 | 109 | const InputIcon = styled.div` 110 | i { 111 | position:absolute; 112 | padding: 15px 10px; 113 | text-align: center; 114 | color: rgb(249,249,249,0.8); 115 | } 116 | ` 117 | 118 | const Input = styled.input` 119 | width: 100%; 120 | color: white; 121 | margin-bottom: 15px; 122 | font-size: 16px; 123 | padding: 15px 0; 124 | padding-right: 15px; 125 | padding-left: 45px; 126 | background: #333; 127 | border: 1px solid rgba(255,255,255,.1); 128 | border-radius: $borderRadius; 129 | &:focus { 130 | color: white; 131 | outline: white; 132 | border: 1px solid #fff; 133 | } 134 | ` 135 | 136 | const Button = styled.button` 137 | width: 100%; 138 | color: #f9f9f9; 139 | background-color: #1f80e0; 140 | font-weight: bold; 141 | padding: 17px 0; 142 | border: none; 143 | border-radius: 4px; 144 | text-align: center; 145 | font-size: 18px; 146 | cursor: pointer; 147 | transition: all 250ms; 148 | // letter-spacing: 1.5px; 149 | margin-top: 8px; 150 | margin-bottom: 12px; 151 | 152 | &:hover { 153 | background: #0483ee; 154 | } 155 | ` 156 | 157 | const Switch = styled.div` 158 | position: relative; 159 | 160 | label { 161 | cursor: pointer; 162 | position: absolute; 163 | background-color: white; 164 | border-radius: 50px; 165 | width :55px; 166 | height: 23px; 167 | top: 0; 168 | right: 0; 169 | } 170 | 171 | label:after { 172 | content : ''; 173 | width : 21px; 174 | height: 21px; 175 | border-radius: 50px; 176 | position: absolute; 177 | background-color: #1f80e0; 178 | transition: all 0.2s; 179 | top :1px; 180 | left: 1px; 181 | } 182 | 183 | input[type="checkbox"] { 184 | visibility: hidden; 185 | } 186 | 187 | input[type="checkbox"]:checked + label { 188 | background-color: white; 189 | } 190 | 191 | input[type="checkbox"]:checked + label:after { 192 | left: 33px; 193 | } 194 | ` 195 | 196 | const Form = styled.form` 197 | margin-top: 30px; 198 | ` -------------------------------------------------------------------------------- /src/components/movie/movie.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import MovieDetails from './movie_details/movie_details' 4 | import ScreeningDetails from './screening_details/screening_details' 5 | import { useParams } from 'react-router-dom'; 6 | import { movieData } from "./../../data/data.js"; 7 | 8 | function setZoom() { 9 | if (navigator.appVersion.indexOf("Win") !== -1) 10 | { 11 | document.body.style.zoom = "90%"; 12 | } 13 | } 14 | 15 | const Movie = () => { 16 | const { movie_id } = useParams(); 17 | setZoom() 18 | return ( 19 | 20 | 21 | 22 | 23 | ) 24 | } 25 | 26 | export default Movie 27 | 28 | const Container = styled.div` 29 | min-height: calc(100vh - 160px); 30 | padding: 0 calc(3.5vw + 5px); 31 | ` -------------------------------------------------------------------------------- /src/components/movie/movie_details/movie_details.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import styled from 'styled-components' 3 | import ReactPlayer from 'react-player' 4 | import 'font-awesome/css/font-awesome.min.css' 5 | import { Link } from "react-router-dom"; 6 | 7 | const MovieDetails = (props) => { 8 | const [mute, setMute] = useState(true); 9 | 10 | return ( 11 | 12 |
13 |

14 | {props.movie.name} 15 |

16 | 17 | {props.movie.lang} • {props.movie.duration}m • Animated 18 | 19 | 20 | {props.movie.desc} 21 | 22 | 23 | 24 | 25 | BOOK TICKETS 26 | 27 | 28 |
29 | 30 | 31 | 32 | setMute(!mute)}> 33 | Unmute 34 | 35 | 36 | 37 |
38 | ) 39 | } 40 | 41 | export default MovieDetails 42 | 43 | const Container = styled.div` 44 | display: flex; 45 | margin-top: 20px; 46 | height: 100%; 47 | width: 100%; 48 | background: #0c111b; 49 | border-radius: 10px; 50 | overflow: hidden; 51 | 52 | @media (max-width: 900px) { 53 | flex-direction: column-reverse; 54 | } 55 | ` 56 | 57 | const Details = styled.div` 58 | width: 40%; 59 | padding: 0px 36px 0px; 60 | 61 | @media (max-width: 900px) { 62 | width: 100%; 63 | } 64 | ` 65 | 66 | const SubTitle = styled.div` 67 | color: rgb(249, 249, 249, 0.6); 68 | font-size: 15px; 69 | min-height: 20px; 70 | margin-top: 26px; 71 | ` 72 | 73 | const Description = styled.div` 74 | width: 80%; 75 | line-height: 1.4; 76 | font-size: 20px; 77 | margin-top: 16px; 78 | color: rgb(249, 249, 249, 0.8); 79 | 80 | @media (max-width: 900px) { 81 | width: 100%; 82 | } 83 | ` 84 | 85 | const BookTicket = styled.button` 86 | margin-top: 30px; 87 | margin-bottom: 30px; 88 | border-radius: 4px; 89 | font-size: 15px; 90 | padding: 0px 24px; 91 | display: flex; 92 | align-items: center; 93 | height: 56px; 94 | background: rgb(249, 249, 249, 0.8); 95 | border: none; 96 | letter-spacing: 1.8px; 97 | cursor: pointer; 98 | 99 | &:hover { 100 | background: rgb(249, 249, 249); 101 | } 102 | ` 103 | 104 | const Trailer = styled.div` 105 | width: 60%; 106 | 107 | @media (max-width: 900px) { 108 | width: 100%; 109 | } 110 | ` 111 | 112 | const MovieTrailerPlayer = styled.div` 113 | 114 | position: relative; 115 | padding-top: 56.25%; 116 | 117 | #MovieTrailer { 118 | position: absolute; 119 | top: 0; 120 | left: 0; 121 | pointer-events: none; 122 | } 123 | ` 124 | 125 | const UnMute = styled.button` 126 | border-radius: 50%; 127 | padding: 8px 8px; 128 | background: rgb(249, 249, 249, 0.6); 129 | position: absolute; 130 | left:5px; 131 | bottom:5px; 132 | 133 | &: hover { 134 | background: rgb(249, 249, 249); 135 | } 136 | ` -------------------------------------------------------------------------------- /src/components/movie/screening_details/screening_details.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import { Link } from "react-router-dom"; 4 | import moment from "moment"; 5 | 6 | const ScreeningDetails = (props) => { 7 | return ( 8 | 9 |

SCREENING DETAILS

10 | 11 | 12 | 13 | 10 AM {moment().add(1,'days').format('DD MMM')} 14 | 15 | 16 | 17 | 18 | 8 PM {moment().add(1,'days').format('DD MMM')} 19 | 20 | 21 | 22 | 23 | 10 AM {moment().add(2,'days').format('DD MMM')} 24 | 25 | 26 | 27 | 28 | 8 PM {moment().add(2,'days').format('DD MMM')} 29 | 30 | 31 | 32 |
33 | ) 34 | } 35 | 36 | export default ScreeningDetails 37 | 38 | const Container = styled.div` 39 | margin-top: 30px; 40 | padding: 30px 0px 26px; 41 | @media (max-width: 900px) { 42 | margin-bottom: 30px; 43 | } 44 | ` 45 | 46 | const Content = styled.div` 47 | display: flex; 48 | grid-gap: 25px; 49 | overflow-X:auto; 50 | padding-left:5px; 51 | @media (max-width: 900px) { 52 | font-size: 12px; 53 | } 54 | 55 | ::-webkit-scrollbar { 56 | display: none; 57 | } 58 | ` 59 | 60 | const Wrap = styled.div` 61 | border-radius: 10px; 62 | cursor: pointer; 63 | border: 3px solid rgba(249, 249, 249, 0.1); 64 | box-shadow: rgba(0 0 0 / 69%) 0px 26px 30px -10px, 65 | rgba(0 0 0 / 73%) 0px 16px 10px -10px; 66 | transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s; 67 | text-align: center; 68 | padding: 20px 20px 20px; 69 | @media (max-width: 900px) { 70 | width: 150px; 71 | } 72 | 73 | &:hover { 74 | transform: scale(1.05); 75 | box-shadow: rgba(0 0 0 / 80%) 0px 40px 58px -16px, 76 | rgba(0 0 0 / 72%) 0px 30px 22px -10px; 77 | border-color: rgba(249, 249, 249, 0.8); 78 | } 79 | 80 | span { 81 | letter-spacing: 1.42px; 82 | color: rgb(249, 249, 249, 0.8); 83 | } 84 | ` -------------------------------------------------------------------------------- /src/components/ticket/ticket.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | function ticket() { 5 | return ( 6 | 7 | 8 | 9 |

10 | celebration 11 |   \( ゚ヮ゚)/ 12 |

13 |

14 | Your show ticket has been successfully booked. 15 | We hope to see you soon. 🍿 16 |

17 |
18 | 19 | 20 | 21 | Ticket 22 | DOWNLOAD TICKETS 23 | 24 | 25 | 26 |
27 |
28 | ) 29 | } 30 | 31 | export default ticket 32 | 33 | const Container = styled.main` 34 | min-height: calc(100vh - 140px); 35 | padding: 0 calc(3.5vw + 5px); 36 | position: relative; 37 | overflow-x: hidden; 38 | ` 39 | const TicketSection = styled.div` 40 | margin-top: 40px; 41 | background: #0c111b; 42 | border-radius: 10px; 43 | padding: 30px 30px; 44 | ` 45 | 46 | const TicketMessage = styled.div` 47 | h1 { 48 | position: relative; 49 | img { 50 | vertical-align: middle; 51 | height: 60px; 52 | } 53 | } 54 | ` 55 | 56 | const DownloadTicket = styled.div` 57 | margin: 20px 0px; 58 | ` 59 | 60 | const Download = styled.button` 61 | border-radius: 4px; 62 | font-size: 15px; 63 | padding: 10px 20px; 64 | display: flex; 65 | align-items: center; 66 | background: rgb(249, 249, 249); 67 | border: none; 68 | letter-spacing: 1.8px; 69 | cursor: pointer; 70 | 71 | img { 72 | height: 40px; 73 | } 74 | ` -------------------------------------------------------------------------------- /src/data/data.js: -------------------------------------------------------------------------------- 1 | export const movieData = [ 2 | { 3 | id:1, 4 | name:"Weathering With You", 5 | lang: "English", 6 | duration: 114, 7 | desc: "Set during a period of exceptionally rainy weather, high-school boy Hodaka Morishima runs away from his troubled rural home to Tokyo and befriends an orphan girl who can manipulate the weather.", 8 | poster: "https://m.media-amazon.com/images/M/MV5BNzE4ZDEzOGUtYWFjNC00ODczLTljOGQtZGNjNzhjNjdjNjgzXkEyXkFqcGdeQXVyNzE5ODMwNzI@._V1_FMjpg_UX1000_.jpg", 9 | trailer: "https://www.youtube.com/watch?v=ps8qwWG8Uio", 10 | }, 11 | { 12 | id: 2, 13 | name: "Your Name", 14 | lang: "English", 15 | duration: 112, 16 | desc: "Two teenagers share a profound, magical connection upon discovering they are swapping bodies. Things manage to become even more complicated when the boy and girl decide to meet in person.", 17 | poster: "https://m.media-amazon.com/images/M/MV5BNGYyNmI3M2YtNzYzZS00OTViLTkxYjAtZDIyZmE1Y2U1ZmQ2XkEyXkFqcGdeQXVyMTA4NjE0NjEy._V1_.jpg", 18 | trailer: "https://www.youtube.com/watch?v=3KR8_igDs1Y", 19 | }, 20 | { 21 | id: 3, 22 | name: "A Silent Voice", 23 | lang: "English", 24 | duration: 129, 25 | desc: "When a grade school student with impaired hearing is bullied mercilessly, she transfers to another school. Years later, one of her former tormentors sets out to make amends.", 26 | poster: "https://m.media-amazon.com/images/M/MV5BZGRkOGMxYTUtZTBhYS00NzI3LWEzMDQtOWRhMmNjNjJjMzM4XkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_.jpg", 27 | trailer: "https://www.youtube.com/watch?v=nfK6UgLra7g", 28 | }, 29 | { 30 | id: 4, 31 | name: "How to Train Your Dragon 2", 32 | lang: "English", 33 | duration: 102, 34 | desc: "Hiccup and Toothless are faced with the threat of Drago, a dragon trapper, bent on capturing and dominating over all dragons. However, they are determined to defeat him and restore peace on Berk.", 35 | poster: "https://m.media-amazon.com/images/M/MV5BMzMwMTAwODczN15BMl5BanBnXkFtZTgwMDk2NDA4MTE@._V1_.jpg", 36 | trailer: "https://www.youtube.com/watch?v=wyZOaBxgYTo", 37 | }, 38 | { 39 | id: 5, 40 | name: "Death Note", 41 | lang: "English", 42 | duration: "NA", 43 | desc: "An intelligent high school student goes on a secret crusade to eliminate criminals from the world after discovering a notebook capable of killing anyone whose name is written into it.", 44 | poster: "https://m.media-amazon.com/images/M/MV5BODkzMjhjYTQtYmQyOS00NmZlLTg3Y2UtYjkzN2JkNmRjY2FhXkEyXkFqcGdeQXVyNTM4MDQ5MDc@._V1_FMjpg_UX1000_.jpg", 45 | trailer: "https://www.youtube.com/watch?v=NlJZ-YgAt-c", 46 | }, 47 | { 48 | id: 6, 49 | name: "Coco", 50 | lang: "English", 51 | duration: 105, 52 | desc: "Miguel pursues his love for singing in spite of his family's ban on music. He stumbles into the Land of the Dead, where he learns about his great-great-grandfather who was a legendary singer.", 53 | poster: "https://m.media-amazon.com/images/M/MV5BYjQ5NjM0Y2YtNjZkNC00ZDhkLWJjMWItN2QyNzFkMDE3ZjAxXkEyXkFqcGdeQXVyODIxMzk5NjA@._V1_.jpg", 54 | trailer: "https://www.youtube.com/watch?v=Rvr68u6k5sI", 55 | }, 56 | { 57 | id: 7, 58 | name: "A Whisker Away", 59 | lang: "English", 60 | duration: 104, 61 | desc: "Secretly in love with her classmate Kento, Miyo takes the help of a mysterious mask and transforms into a cat to get closer to him. However, trouble ensues when she begins to lose herself.", 62 | poster: "https://m.media-amazon.com/images/M/MV5BNDI5ODBhYzMtNDc4Yi00NjEwLWJiZWUtMGE2Mzc4MGVjN2E0XkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_.jpg", 63 | trailer: "https://www.youtube.com/watch?v=nZ3SUUtymJw", 64 | }, 65 | { 66 | id: 8, 67 | name: "Rio", 68 | lang: "English", 69 | duration: 96, 70 | desc: "When Blu, a domesticated macaw from small-town Minnesota, meets the fiercely independent Jewel, he takes off on an adventure to Rio de Janeiro with the bird of his dreams.", 71 | poster: "https://m.media-amazon.com/images/M/MV5BMTU2MDY3MzAzMl5BMl5BanBnXkFtZTcwMTg0NjM5NA@@._V1_FMjpg_UX1000_.jpg", 72 | trailer: "https://www.youtube.com/watch?v=P1GRO31ve5Q", 73 | }, 74 | ]; -------------------------------------------------------------------------------- /src/features/counter/Counter.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { useSelector, useDispatch } from 'react-redux'; 3 | import { 4 | decrement, 5 | increment, 6 | incrementByAmount, 7 | incrementAsync, 8 | incrementIfOdd, 9 | selectCount, 10 | } from './counterSlice'; 11 | import styles from './Counter.module.css'; 12 | 13 | export function Counter() { 14 | const count = useSelector(selectCount); 15 | const dispatch = useDispatch(); 16 | const [incrementAmount, setIncrementAmount] = useState('2'); 17 | 18 | const incrementValue = Number(incrementAmount) || 0; 19 | 20 | return ( 21 |
22 |
23 | 30 | {count} 31 | 38 |
39 |
40 | setIncrementAmount(e.target.value)} 45 | /> 46 | 52 | 58 | 64 |
65 |
66 | ); 67 | } 68 | -------------------------------------------------------------------------------- /src/features/counter/Counter.module.css: -------------------------------------------------------------------------------- 1 | .row { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | } 6 | 7 | .row > button { 8 | margin-left: 4px; 9 | margin-right: 8px; 10 | } 11 | .row:not(:last-child) { 12 | margin-bottom: 16px; 13 | } 14 | 15 | .value { 16 | font-size: 78px; 17 | padding-left: 16px; 18 | padding-right: 16px; 19 | margin-top: 2px; 20 | font-family: 'Courier New', Courier, monospace; 21 | } 22 | 23 | .button { 24 | appearance: none; 25 | background: none; 26 | font-size: 32px; 27 | padding-left: 12px; 28 | padding-right: 12px; 29 | outline: none; 30 | border: 2px solid transparent; 31 | color: rgb(112, 76, 182); 32 | padding-bottom: 4px; 33 | cursor: pointer; 34 | background-color: rgba(112, 76, 182, 0.1); 35 | border-radius: 2px; 36 | transition: all 0.15s; 37 | } 38 | 39 | .textbox { 40 | font-size: 32px; 41 | padding: 2px; 42 | width: 64px; 43 | text-align: center; 44 | margin-right: 4px; 45 | } 46 | 47 | .button:hover, 48 | .button:focus { 49 | border: 2px solid rgba(112, 76, 182, 0.4); 50 | } 51 | 52 | .button:active { 53 | background-color: rgba(112, 76, 182, 0.2); 54 | } 55 | 56 | .asyncButton { 57 | composes: button; 58 | position: relative; 59 | } 60 | 61 | .asyncButton:after { 62 | content: ''; 63 | background-color: rgba(112, 76, 182, 0.15); 64 | display: block; 65 | position: absolute; 66 | width: 100%; 67 | height: 100%; 68 | left: 0; 69 | top: 0; 70 | opacity: 0; 71 | transition: width 1s linear, opacity 0.5s ease 1s; 72 | } 73 | 74 | .asyncButton:active:after { 75 | width: 0%; 76 | opacity: 1; 77 | transition: 0s; 78 | } 79 | -------------------------------------------------------------------------------- /src/features/counter/counterAPI.js: -------------------------------------------------------------------------------- 1 | // A mock function to mimic making an async request for data 2 | export function fetchCount(amount = 1) { 3 | return new Promise((resolve) => 4 | setTimeout(() => resolve({ data: amount }), 500) 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /src/features/counter/counterSlice.js: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; 2 | import { fetchCount } from './counterAPI'; 3 | 4 | const initialState = { 5 | value: 0, 6 | status: 'idle', 7 | }; 8 | 9 | // The function below is called a thunk and allows us to perform async logic. It 10 | // can be dispatched like a regular action: `dispatch(incrementAsync(10))`. This 11 | // will call the thunk with the `dispatch` function as the first argument. Async 12 | // code can then be executed and other actions can be dispatched. Thunks are 13 | // typically used to make async requests. 14 | export const incrementAsync = createAsyncThunk( 15 | 'counter/fetchCount', 16 | async (amount) => { 17 | const response = await fetchCount(amount); 18 | // The value we return becomes the `fulfilled` action payload 19 | return response.data; 20 | } 21 | ); 22 | 23 | export const counterSlice = createSlice({ 24 | name: 'counter', 25 | initialState, 26 | // The `reducers` field lets us define reducers and generate associated actions 27 | reducers: { 28 | increment: (state) => { 29 | // Redux Toolkit allows us to write "mutating" logic in reducers. It 30 | // doesn't actually mutate the state because it uses the Immer library, 31 | // which detects changes to a "draft state" and produces a brand new 32 | // immutable state based off those changes 33 | state.value += 1; 34 | }, 35 | decrement: (state) => { 36 | state.value -= 1; 37 | }, 38 | // Use the PayloadAction type to declare the contents of `action.payload` 39 | incrementByAmount: (state, action) => { 40 | state.value += action.payload; 41 | }, 42 | }, 43 | // The `extraReducers` field lets the slice handle actions defined elsewhere, 44 | // including actions generated by createAsyncThunk or in other slices. 45 | extraReducers: (builder) => { 46 | builder 47 | .addCase(incrementAsync.pending, (state) => { 48 | state.status = 'loading'; 49 | }) 50 | .addCase(incrementAsync.fulfilled, (state, action) => { 51 | state.status = 'idle'; 52 | state.value += action.payload; 53 | }); 54 | }, 55 | }); 56 | 57 | export const { increment, decrement, incrementByAmount } = counterSlice.actions; 58 | 59 | // The function below is called a selector and allows us to select a value from 60 | // the state. Selectors can also be defined inline where they're used instead of 61 | // in the slice file. For example: `useSelector((state: RootState) => state.counter.value)` 62 | export const selectCount = (state) => state.counter.value; 63 | 64 | // We can also write thunks by hand, which may contain both sync and async logic. 65 | // Here's an example of conditionally dispatching actions based on current state. 66 | export const incrementIfOdd = (amount) => (dispatch, getState) => { 67 | const currentValue = selectCount(getState()); 68 | if (currentValue % 2 === 1) { 69 | dispatch(incrementByAmount(amount)); 70 | } 71 | }; 72 | 73 | export default counterSlice.reducer; 74 | -------------------------------------------------------------------------------- /src/features/counter/counterSlice.spec.js: -------------------------------------------------------------------------------- 1 | import counterReducer, { 2 | increment, 3 | decrement, 4 | incrementByAmount, 5 | } from './counterSlice'; 6 | 7 | describe('counter reducer', () => { 8 | const initialState = { 9 | value: 3, 10 | status: 'idle', 11 | }; 12 | it('should handle initial state', () => { 13 | expect(counterReducer(undefined, { type: 'unknown' })).toEqual({ 14 | value: 0, 15 | status: 'idle', 16 | }); 17 | }); 18 | 19 | it('should handle increment', () => { 20 | const actual = counterReducer(initialState, increment()); 21 | expect(actual.value).toEqual(4); 22 | }); 23 | 24 | it('should handle decrement', () => { 25 | const actual = counterReducer(initialState, decrement()); 26 | expect(actual.value).toEqual(2); 27 | }); 28 | 29 | it('should handle incrementByAmount', () => { 30 | const actual = counterReducer(initialState, incrementByAmount(2)); 31 | expect(actual.value).toEqual(5); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | color: white; 4 | background-color: #040714; 5 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 6 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 7 | sans-serif; 8 | -webkit-font-smoothing: antialiased; 9 | -moz-osx-font-smoothing: grayscale; 10 | } 11 | 12 | code { 13 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 14 | monospace; 15 | } 16 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import { store } from './app/store'; 6 | import { Provider } from 'react-redux'; 7 | import * as serviceWorker from './serviceWorker'; 8 | 9 | ReactDOM.render( 10 | 11 | 12 | 13 | 14 | , 15 | document.getElementById('root') 16 | ); 17 | 18 | // If you want your app to work offline and load faster, you can change 19 | // unregister() to register() below. Note this comes with some pitfalls. 20 | // Learn more about service workers: https://bit.ly/CRA-PWA 21 | serviceWorker.unregister(); 22 | -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then((registration) => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch((error) => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' }, 105 | }) 106 | .then((response) => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then((registration) => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready.then((registration) => { 134 | registration.unregister(); 135 | }); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | --------------------------------------------------------------------------------