-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final deployment published on netlify
- Loading branch information
1 parent
e940bba
commit f6eefd6
Showing
24 changed files
with
210 additions
and
283 deletions.
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,2 +1,4 @@ | ||
ESLINT_NO_DEV_ERRORS=true | ||
key=<put your key here> | ||
REACT_APP_ALAN_KEY=<put your key here> | ||
ESLINT_NO_DEV_ERRORS=true | ||
DISABLE_ESLINT_PLUGIN=true |
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 @@ | ||
DISABLE_ESLINT_PLUGIN=true |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { useEffect, useContext } from 'react'; | ||
import alanBtn from '@alan-ai/alan-sdk-web'; | ||
import { ColorModeContext } from '../utils/ToggleColorMode' | ||
import { fetchToken } from '../utils'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { selectGenreOrCategory, searchMovie } from '../features/createGenreOrCategory'; | ||
import { useDispatch } from 'react-redux'; | ||
|
||
const useAlan = () => { | ||
const { setMode } = useContext(ColorModeContext); | ||
const navigate = useNavigate(); | ||
const dispatch = useDispatch() | ||
useEffect(() => { | ||
alanBtn({ | ||
key: process.env.REACT_APP_ALAN_KEY, | ||
onCommand: ({ command, mode, genres, genreOrCategory, query }) => { | ||
if (command === 'chooseGenre' || command === 'recommendMovie') { | ||
|
||
const foundGenre = genres.find((g) => g.name.toLowerCase() === genreOrCategory.toLowerCase()); | ||
if (foundGenre) { | ||
navigate('/') | ||
dispatch(selectGenreOrCategory(foundGenre.id)) | ||
} else if (genreOrCategory) { | ||
const category = genreOrCategory.startsWith('top') ? 'top_rated' : genreOrCategory; | ||
navigate('/') | ||
dispatch(selectGenreOrCategory(category)) | ||
} | ||
console.log(command, genreOrCategory) | ||
} else if (command === 'changeMode') { | ||
if (mode === 'light') { | ||
setMode('light') | ||
} else { | ||
setMode('dark') | ||
} | ||
} else if (command === 'login') { | ||
fetchToken(); | ||
} else if (command === 'logout') { | ||
localStorage.clear(); | ||
window.location.href = '/'; | ||
} else if (command === 'search') { | ||
navigate('/') | ||
dispatch(searchMovie(query)); | ||
} | ||
} | ||
}); | ||
}, []); | ||
} | ||
|
||
export default useAlan; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import { Box, Typography, Card, CardContent, CardMedia } from '@mui/material' | ||
import '../global.css'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
const FeaturedMovie = ({ movie }) => { | ||
if (!movie) return null; | ||
|
||
return ( | ||
<Box component={Link} to={`/movie/${movie.id}`} className='featured--movie--container' > | ||
<Card className='featured--movie--card' > | ||
<CardMedia | ||
media='picture' | ||
alt={movie.title} | ||
image={`https://image.tmdb.org/t/p/original/${movie?.backdrop_path}`} | ||
title={movie.title} | ||
className='featured--movie--cardmedia' | ||
/> | ||
<Box padding='20px'> | ||
<CardContent className='featured--movie--cardcontent'> | ||
<Typography variant='h5' gutterBottom>{movie.title}</Typography> | ||
<Typography variant='body2'>{movie.overview}</Typography> | ||
</CardContent> | ||
</Box> | ||
|
||
</Card> | ||
|
||
</Box> | ||
) | ||
} | ||
|
||
export default FeaturedMovie |
This file was deleted.
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
This file was deleted.
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
Oops, something went wrong.