diff --git a/src/App.js b/src/App.js
index 6248934..9d1e00e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -9,8 +9,8 @@ import { getAuth,
signInWithEmailAndPassword } from "firebase/auth";
import { getFirestore,
collection,
- query,
- where,
+ getDoc,
+ doc,
getDocs } from "firebase/firestore";
import {getStorage} from "firebase/storage"
@@ -130,6 +130,15 @@ const readData = async () => {
}
+ // function to get a single item
+ const getDocument = async ( itemId) => {
+ const docRef = doc( FBdb, "movies", itemId )
+ const docSnap = await getDoc( docRef )
+ let movie = docSnap.data()
+ movie.id = itemId
+ return movie
+ }
+
return (
@@ -143,7 +152,7 @@ const readData = async () => {
} />
} />
} />
- } />
+ } />
diff --git a/src/pages/Detail.js b/src/pages/Detail.js
index 410e8fe..d5ea3cd 100644
--- a/src/pages/Detail.js
+++ b/src/pages/Detail.js
@@ -10,24 +10,20 @@ import Button from 'react-bootstrap/Button';
export function Detail(props) {
const [movieData, setMovieData] = useState()
- let { id } = useParams();
+ let { id } = useParams()
useEffect(() => {
- if (!movieData && typeof props.handler === 'function') {
- const fetchMovieData = async () => {
- const movieData = await props.handler(id);
- setMovieData(movieData);
- };
- fetchMovieData();
+ if (!movieData) {
+ props.handler(id).then((movie) => setMovieData(movie))
}
- }, [id, movieData, props.handler]);
+ }, [id])
if (movieData) {
return (
- {movieData.movie_title}
+ {movieData.title}
@@ -35,19 +31,23 @@ export function Detail(props) {
- More information
- Summary
+ More Information
+ Synopsis
{movieData.synopsis}
- People Who Contributed:
- {movieData.director}
+ Main Actors
{movieData.main_actors}
+ Director
+ {movieData.director}
+ Producer
{movieData.producer}
- Further Information
- IMDB: {movieData.imdb_link}
+ Genre
+ {movieData.genre}
+ IMDB Link
+ {movieData.imdb_link}
- Star
+ Star Rating
@@ -57,12 +57,12 @@ export function Detail(props) {
- Title
-
+ Title
+
Review
-
+
@@ -75,7 +75,7 @@ export function Detail(props) {
)
}
else {
- return null
- }
-
-}
+ return null;
+
+ }
+ }
\ No newline at end of file