Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IT2810 H21
Team 29
iWhatToWatch
Commits
90be0025
Commit
90be0025
authored
Nov 22, 2021
by
kavusi98
Browse files
(
#15
) minor changes
parent
3b35dcb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/moviesview/index.tsx
View file @
90be0025
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
useSelector
}
from
"
react-redux
"
;
import
{
selectMovies
,
selectUserIsLoggedIn
,
selectUserName
}
from
"
../../services/selectors
"
;
import
{
searchMovies_getMoviesBySearch
}
from
"
../../services/__generated__/searchMovies
"
import
FavButton
from
"
../favButton
"
;
import
{
Card
,
Title
}
from
"
react-native-paper
"
;
import
{
StyleSheet
,
SafeAreaView
,
FlatList
,
View
}
from
"
react-native
"
;
import
{
StyleSheet
,
SafeAreaView
,
FlatList
,
View
,
Text
}
from
"
react-native
"
;
import
{
useFonts
}
from
"
@expo-google-fonts/inter
"
;
import
AppLoading
from
'
expo-app-loading
'
;
import
MovieModal
from
"
../moviedetail/MovieModal
"
;
import
{
LogBox
}
from
'
react-native
'
;
/**
* This is a component displaying all the movies.
* We are using MUI Card components and rendering
* them based on movies fetched form the database.
* The movies are fetched form the database.
*/
interface
IMovieObject
{
...
...
@@ -52,6 +53,12 @@ const MovieTable: React.FC<MovieTableProps> = ({fetchMore}) => {
return
movie
.
favoritedByUser
.
includes
(
userName
)
}
useEffect
(()
=>
{
//Flatlist needs to be in ScrollView in our case.
LogBox
.
ignoreLogs
([
'
VirtualizedLists should never be nested
'
]);
},
[])
function
handleFavorize
(
newValue
:
boolean
,
id
:
string
)
{
let
alreadyInFavorites
=
favoritedInSession
.
filter
(
favoritedInSession
=>
favoritedInSession
.
id
===
id
)
...
...
@@ -97,6 +104,7 @@ const MovieTable: React.FC<MovieTableProps> = ({fetchMore}) => {
);
};
if
(
!
fontsLoaded
)
{
return
<
AppLoading
/>
}
else
{
...
...
@@ -111,8 +119,9 @@ const MovieTable: React.FC<MovieTableProps> = ({fetchMore}) => {
paddingBottom
:
350
,
}
}
onEndReached
=
{
fetchMore
}
/
>
>
{
modalMovie
?
<
MovieModal
isModalVisible
=
{
modalVisible
}
setIsModalVisible
=
{
setModalVisible
}
movie
=
{
modalMovie
}
/>
:
null
}
</
FlatList
>
</
SafeAreaView
>
)
}
...
...
frontend/src/components/sidebar/SideBar.tsx
View file @
90be0025
import
React
,
{
FunctionComponent
,
useState
}
from
"
react
"
;
import
{
StyleSheet
,
ScrollView
,
SafeAreaView
,
View
}
from
"
react-native
"
;
import
React
,
{
FunctionComponent
,
useEffect
,
useState
}
from
"
react
"
;
import
{
StyleSheet
,
ScrollView
,
SafeAreaView
,
View
,
LogBox
}
from
"
react-native
"
;
import
FilterByYear
from
"
./FilterByYear
"
;
import
FilterGenreComp
from
"
./FilterByGenre
"
;
...
...
@@ -18,6 +18,7 @@ interface SideBarProps {
const
SideBar
:
FunctionComponent
<
SideBarProps
>
=
({
isSideBarVisible
,
closeSideBar
})
=>
{
return
(
<
View
style
=
{
styles
.
animatedBox
}
>
<
ScrollView
contentContainerStyle
=
{
styles
.
scrollContainer
}
>
...
...
@@ -37,7 +38,7 @@ const styles = StyleSheet.create({
display
:
'
flex
'
,
},
scrollContainer
:
{
paddingBottom
:
50
,
paddingBottom
:
4
50
,
}
})
export
default
SideBar
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment