-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EvaSjoholm/Project-movies #328
Open
EvaSjoholm
wants to merge
55
commits into
Technigo:master
Choose a base branch
from
EvaSjoholm:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
5a55319
addin components and API url
EvaSjoholm f83600c
components details and some css
EvaSjoholm a22b7a0
added react-router in app.js
EvaSjoholm 0a5e5b7
added useEffect and trying the API, some css
EvaSjoholm 2eed33e
clean up error and erased components tryouts
EvaSjoholm fdb49ae
components fix
EvaSjoholm f4161a9
changed components and cleaned up error
EvaSjoholm 7a033fe
added css and cleaned up app.js
EvaSjoholm 1135606
changed API for cinema and edit code in component
EvaSjoholm 0d8ca20
changes componenets
EvaSjoholm 2b8b710
fixing errors from consol
EvaSjoholm cc87b76
uppdated components and url fix
EvaSjoholm c84eb62
fix to components
EvaSjoholm 761f7b9
adding code and image tryouts
EvaSjoholm 2731952
fix
EvaSjoholm 6ec120a
cleaned up and changed code
EvaSjoholm e82ee4a
tvshow component editing
EvaSjoholm e6d1779
tvshow componenet error fix
EvaSjoholm ffff6f2
added component and css
EvaSjoholm 8ac9649
erased code
EvaSjoholm b2f2fae
css design and adding in componenets fix
EvaSjoholm 22af8d1
code clean up
EvaSjoholm c8074de
css to icon
EvaSjoholm d8bb537
component test and css
EvaSjoholm a9aa18d
css design
EvaSjoholm 2c2b90c
css fix
EvaSjoholm 07c6858
css fixing
EvaSjoholm 15f80ae
edited header and css design
EvaSjoholm ad793ba
text edit
EvaSjoholm 8579ab9
adding componenets tvSeries
EvaSjoholm 1c73c7a
adding componenets tvSeries
EvaSjoholm 6393318
fixing component tvseries
EvaSjoholm 40718b6
component fix
EvaSjoholm 94111b1
component fix tvseries
EvaSjoholm b113e70
erased tv component again
EvaSjoholm 45bd57d
edited header and some css fix
EvaSjoholm 42eb044
edited media query and css
EvaSjoholm 0e9a62c
fixed api
EvaSjoholm 1c166ac
fix
EvaSjoholm f5c68db
readme
EvaSjoholm 4064777
back button and css add
EvaSjoholm 9ce94b2
media query fix
EvaSjoholm 0c910c5
css fix
EvaSjoholm 2cfb71c
icon fix and css
EvaSjoholm 3bcc801
Update README.md
EvaSjoholm 58b1efd
tvdetail component with api fix to it
EvaSjoholm af682d7
tvdetail component add and fix to api
EvaSjoholm 8edc23d
fixing tv components
EvaSjoholm a2c8904
fixing error
EvaSjoholm 1eb6e10
fixed errors in componenets tvseries
EvaSjoholm a6f0544
Merge branch 'master' of https://github.com/EvaSjoholm/project-movies
EvaSjoholm 57befc4
added fix to tvseries
EvaSjoholm 6e666b6
css fix
EvaSjoholm 78ca89a
css fix to tv page
EvaSjoholm 6a4ee80
css fix to tv detail page
EvaSjoholm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# Project Movies | ||
|
||
Replace this readme with your own information about your project. | ||
How to build multi-page application using React Router. Pass information such as product ids, blog post titles in the URL and pick this up in React router (dynamic content). Practice using APIs in React combining useState and useEffect. | ||
|
||
Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. | ||
This project was ment for pair-programming but I did this solo due to time schedule conflicts. | ||
|
||
## The problem | ||
|
||
Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? | ||
My main problem with this project was actually understanding API and how to change it to be able to interract and use the URL with React. I spent hours just trying to figure out the details of that,combining it with all the steps required for React Router and multi-pages that is asked for the app. | ||
I needed a lot of help which former students was able to provide. I redid my code and saved a lot of tryouts in external platforms, but my knowledge is not due just yet in this level of React. I find it stimulating to work with but I need more given time to actually unerstand earlier works with props, map and useEffect. Adding API fetch and many componenets with Routes was way to difficult I felt doing solo. | ||
I worked a lot with turtorials from Technigo, tried the Example project steps but found it very time consuming not sure if it's the best way. Then I booked session with technigo-coach and external help through friends, and former students work to be able to focus on understanding the steps and learning about React Routers wonders. | ||
|
||
## View it live | ||
|
||
Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about. | ||
https://lighthearted-dolphin-81e027.netlify.app/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
import React from 'react'; | ||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom' | ||
import { NotFound } from 'components/NotFound' | ||
import { MovieList } from 'components/MovieList' | ||
import { Header } from 'components/Header' | ||
import { Details } from 'components/Details' | ||
import { TVSeriesList } from 'components/TVseriesList' | ||
import { TVseriesDetails } from 'components/TVseriesDetails' | ||
|
||
export const App = () => { | ||
return ( | ||
<div> | ||
Find me in src/app.js! | ||
</div> | ||
<BrowserRouter> | ||
<main> | ||
<Header /> | ||
<Routes> | ||
<Route path="/" element={<MovieList />} /> | ||
<Route path="/movies/:id" element={<Details />} /> | ||
<Route path="/tvseries" element={<TVSeriesList />} /> | ||
<Route path="/tvseries/:id" element={<TVseriesDetails />} /> | ||
<Route path="/404" element={<NotFound />} /> | ||
<Route path="*" element={<Navigate to="/404" />} /> | ||
</Routes> | ||
</main> | ||
</BrowserRouter> | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useParams, Link } from 'react-router-dom'; | ||
import { NotFound } from './NotFound'; | ||
|
||
export const Details = () => { | ||
const [movieDetails, setMovieDetails] = useState([]) | ||
const { id } = useParams() | ||
|
||
const FetchDetails = () => { | ||
fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=7f5b30559b3d85aec06d3d1a010f4a39&language=en-US`) | ||
.then((response) => response.json()) | ||
.then((data) => setMovieDetails(data)) | ||
.catch((error) => { | ||
console.log(error) | ||
if (error) { | ||
return (<NotFound /> | ||
|
||
) | ||
} | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
FetchDetails() | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []) | ||
|
||
return ( | ||
<div | ||
className="background" | ||
style={{ backgroundImage: `url(http://image.tmdb.org/t/p/original${movieDetails.backdrop_path})` }}> | ||
<Link to="/" className="back-button"> | ||
<img src="./back-button.png" alt="back button" /> | ||
<p>Home</p> | ||
</Link> | ||
<div className="movie-detail"> | ||
<img src={`http://image.tmdb.org/t/p/w342${movieDetails.poster_path}`} alt="movie" /> | ||
<div className="details"> | ||
<h1>{movieDetails.title}</h1> | ||
</div> | ||
<p>{movieDetails.overview}</p> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import { NavLink } from 'react-router-dom' | ||
|
||
export const Header = () => { | ||
return ( | ||
<header> | ||
|
||
<img className="movienation" src="./red.png" alt="movie-icon" width="112" height="25" /> | ||
|
||
<ul className="navlink-container"> | ||
<li className="navlink"> | ||
<NavLink to="/TVseries"><span role="img" className="emoji" aria-label="popcorn">🍿</span></NavLink> | ||
</li> | ||
</ul> | ||
</header> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useState } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Movie = ({ title, releaseDate, movieID, poster }) => { | ||
const [isHover, setIsHover] = useState(false) | ||
|
||
const handleMouseEnter = () => { | ||
setIsHover(true); | ||
}; | ||
const handleMouseLeave = () => { | ||
setIsHover(false); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the hover effect its a nice touch |
||
|
||
return ( | ||
<div | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave}> | ||
|
||
<Link to={`/movies/${movieID}`}> | ||
<img src={`http://image.tmdb.org/t/p/w342${poster}`} alt="movie" /> | ||
<div className={isHover ? 'description' : 'hidden-description'}> | ||
<h1>{title}</h1> | ||
<p>Released {releaseDate}</p> | ||
</div> | ||
</Link> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { MOVIES_URL } from 'utils/Urls' | ||
import { Movie } from 'components/Movie' | ||
|
||
export const MovieList = () => { | ||
const [list, setList] = useState([]) | ||
|
||
const FetchMovies = () => { | ||
fetch(MOVIES_URL) | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
console.log(data.results) | ||
setList(data.results) | ||
}) | ||
} | ||
useEffect(() => { | ||
FetchMovies() | ||
}, []) | ||
|
||
return ( | ||
<main> | ||
{list.map((movie) => ( | ||
<div | ||
className="movie-card" | ||
key={movie.id}> | ||
<Movie | ||
title={movie.title} | ||
releaseDate={movie.release_date} | ||
movieID={movie.id} | ||
poster={movie.poster_path} /> | ||
</div> | ||
))} | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
export const NotFound = () => { | ||
const navigate = useNavigate(); | ||
const returnToHomePage = () => { | ||
navigate('/'); | ||
} | ||
|
||
return ( | ||
<div className="not-found"> | ||
<img id="not-found" src="../not-found.png" alt="not-found" /> | ||
<p>Ooh noo.... Page not found </p> | ||
<button type="button" onClick={returnToHomePage}>Return here</button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useState } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const TVSeries = ({ singleTvAirDate, singleTvID, originalName, poster }) => { | ||
const [isHover, setIsHover] = useState(false) | ||
|
||
const handleMouseEnter = () => { | ||
setIsHover(true); | ||
}; | ||
const handleMouseLeave = () => { | ||
setIsHover(false); | ||
}; | ||
|
||
return ( | ||
<div | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave}> | ||
|
||
<Link to={`/TVseries/${singleTvID}`}> | ||
<img src={`https://image.tmdb.org/t/p/w342${poster}`} alt="TVseries" /> | ||
<div className={isHover ? 'description' : 'hidden-description'}> | ||
<h1>{originalName}</h1> | ||
<p>First aired {singleTvAirDate.first_air_date}</p> | ||
</div> | ||
</Link> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { useParams, Link } from 'react-router-dom'; | ||
import { NotFound } from './NotFound'; | ||
|
||
export const TVseriesDetails = () => { | ||
const [details, setDetails] = useState([]) | ||
const { id } = useParams() | ||
|
||
const fetchTvDetails = () => { | ||
fetch(`https://api.themoviedb.org/3/tv/${id}?api_key=7f5b30559b3d85aec06d3d1a010f4a39&language=en-US`) | ||
.then((response) => response.json()) | ||
.then((data) => setDetails(data)) | ||
.catch((error) => { | ||
console.log(error) | ||
if (error) { | ||
return (<NotFound /> | ||
|
||
) | ||
} | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
fetchTvDetails() | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []) | ||
|
||
return ( | ||
<div | ||
className="tv-background" | ||
style={{ backgroundImage: `url(https://image.tmdb.org/t/p/w1280${details.backdrop_path})` }}> | ||
<Link to="/" className="back-button"> | ||
<img src="./back-button.png" alt="back button" /> | ||
<p>Home</p> | ||
</Link> | ||
<div className="tv-detail"> | ||
<img src={`https://image.tmdb.org/t/p/w300${details.poster_path}`} alt="profile" /> | ||
|
||
<div className="tv-detail"> | ||
<h1>{details.title}</h1> | ||
</div> | ||
<p>{details.overview}</p> | ||
</div> | ||
</div> | ||
) | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on a hard project to do alone! I mentioned a few comments below one other is just the background on the tv shows could be the same setup as the background of the movies for consistency. Other than that, great job on this project!