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-H19
Teams
Team 10
Prosjekt 4
Commits
47b27404
Commit
47b27404
authored
Nov 12, 2019
by
Hedda Mathilde Sæther Langvik
Browse files
Merge branch 'detailed-card' into 'master'
#13
all good in the hood with backend and sorting See merge request
!13
parents
e59a41de
45972fb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/api/fetchers.js
View file @
47b27404
...
...
@@ -8,13 +8,15 @@ const createURL = (input, sorting) => {
return
API_URL
+
"
getData/
"
+
sorting
}
if
(
typeof
input
==
'
string
'
){
var
hasNumber
=
/
\d
/
;
if
(
hasNumber
.
test
(
input
)){
return
API_URL
+
"
getFrom/
"
+
input
}
return
API_URL
+
"
search/
"
+
input
+
"
/
"
+
sorting
}
if
(
typeof
input
==
'
number
'
){
return
API_URL
+
"
fiveMostPopular
"
}
console
.
log
(
"
hentet ingenting
"
)
}
// The only method that fetches data from database.
...
...
frontend/components/Card.js
View file @
47b27404
...
...
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import
{
StyleSheet
,
Text
,
View
,
Alert
,
TouchableHighlight
,
Image
,
FlatList
}
from
'
react-native
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
GetData
,
UpdatePopulatiry
}
from
'
../api/fetchers
'
import
{
ScrollView
}
from
'
react-native-gesture-handler
'
;
import
{
showDestination
}
from
'
../actions/DestinationAction
'
;
import
MaterialDialog
from
'
./DetailedCard
'
;
...
...
@@ -26,15 +25,12 @@ class Card extends Component {
/* if(this.props.page === "Home"){
this.setData(5)
if(this.props.page === "Explore"){*/
console
.
log
(
this
.
props
.
word
)
if
(
this
.
props
.
word
===
"
all
"
){
if
(
this
.
props
.
continent
===
'
all
'
){
console
.
log
(
"
Henter alt
"
)
this
.
setData
(
""
)
}
else
{
this
.
setData
(
this
.
props
.
continent
)}
}
else
if
(
this
.
props
.
continent
===
'
all
'
){
console
.
log
(
"
Henter etter søkeord:
"
,
this
.
props
.
word
)
this
.
setData
(
this
.
props
.
word
)
}
else
{
this
.
setData
(
this
.
props
.
continent
+
"
/
"
+
this
.
props
.
word
)}
}
...
...
@@ -94,30 +90,34 @@ class Card extends Component {
return
(
<
FlatList
contentContainerStyle
=
{{
width
:
350
}}
data
=
{
data
}
renderItem
=
{
({
item
})
=>
(
<
TouchableHighlight
key
=
{
item
.
_id
}
underlayColor
=
'
white
'
onPress
=
{()
=>
Alert
.
alert
(
item
.
description
)}
>
<
View
style
=
{
styles
.
container
}
>
<
View
><
Image
style
=
{
styles
.
Image
}
source
=
{{
uri
:
item
.
img
}}
/></
View
>
<
View
><
Text
style
=
{
styles
.
name
}
>
{
item
.
name
}
<
/Text></
View
>
<
View
>
<
FlatList
contentContainerStyle
=
{{
width
:
350
}}
data
=
{
data
}
renderItem
=
{
({
item
})
=>
(
<
TouchableHighlight
key
=
{
item
.
_id
}
underlayColor
=
'
white
'
onPress
=
{()
=>
this
.
openDetailedCard
(
item
.
_id
,
item
.
popularity
)}
>
<
View
style
=
{
styles
.
container
}
>
<
View
><
Image
style
=
{
styles
.
Image
}
source
=
{{
uri
:
item
.
img
}}
/></
View
>
<
View
><
Text
style
=
{
styles
.
name
}
>
{
item
.
name
}
<
/Text></
View
>
<
/View
>
<
/TouchableHighlight>
)
}
initialNumToRender
=
{
5
}
maxToRenderPerBatch
=
{
10
}
windowSize
=
{
5
}
//updateCellsBatchingPeriod = {10}
/
>
<
MaterialDialog
title
=
{
dataElement
.
name
}
visible
=
{
this
.
state
.
visible
}
onOk
=
{()
=>
console
.
log
(
"
OK was pressed
"
)}
onCancel
=
{()
=>
console
.
log
(
"
Cancel was pressed
"
)}
>
>
<
Text
>
heiheiehi
<
/Text
>
<
/MaterialDialog
>
<
/View
>
<
/TouchableHighlight>
)
}
initialNumToRender
=
{
5
}
maxToRenderPerBatch
=
{
10
}
windowSize
=
{
5
}
//updateCellsBatchingPeriod = {10}
/
>
/*<MaterialDialog
title={dataElement.name}
visible={this.state.visible}
onOk={() => console.log("OK was pressed")}
onCancel={() => console.log("Cancel was pressed")}>
>
<Text>heiheiehi</Text>
</MaterialDialog> */
)}
}
...
...
package-lock.json
View file @
47b27404
...
...
@@ -6138,8 +6138,8 @@
},
"prop-types"
:
{
"version"
:
"15.7.2"
,
"resolved"
:
"https://
artifactory.palantir.build/artifactory/api/npm/all-npm
/prop-types/-/prop-types-15.7.2.tgz"
,
"integrity"
:
"sha
1-UsQedbjIfnK52TYOAga5ncv/psU
="
,
"resolved"
:
"https://
registry.npmjs.org
/prop-types/-/prop-types-15.7.2.tgz"
,
"integrity"
:
"sha
512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ=
="
,
"requires"
:
{
"loose-envify"
:
"^1.4.0"
,
"object-assign"
:
"^4.1.1"
,
...
...
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