-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideo.js
executable file
·84 lines (71 loc) · 2.24 KB
/
Video.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import React from 'react'
//import { connect } from 'react-redux'
import Player from '../components/Player'
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
import styles from '../css/Video'
const Video = ({feedQuery, slug, title, youtubeId, category, by, color, tip}) => {
/* if (feedQuery && feedQuery.loading) {
return <div>Loading</div>
}
if (feedQuery && feedQuery.error) {
return <div>Error</div>
}*/
console.log(feedQuery)
return (
<div className={styles.video}>
<Player slug={slug} youtubeId={youtubeId} color={color}/>
<div className={styles.infoContainer}>
<span className={styles.title}>{title}</span>
<div className={styles.infoRow}>
<div className={styles.category} style={{backgroundColor: color}}>
<span>{category}</span>
</div>
<span className={styles.byText}>by: {by}</span>
</div>
<div className={styles.separator}/>
<span className={styles.tipTitle}>Tip</span>
<div className={styles.tip}>
{slug
? tip
: <span style={{color: 'orange'}}>
YOU FOUND A MISSING FEATURE!
There is no data because you Refreshed the video page,
whose data is fetched on the previous page. Try adding a thunk
to this route in
<span style={{color: 'white'}}> configureStore.js </span>
to insure when
visited directly this page has its data as well. Use the
<span style={{color: 'white'}}> findVideo(slug) </span>
method in
<span style={{color: 'white'}}>../api/index.js:</span>
</span>}
</div>
</div>
</div>)
}
const mapState = state => state.videosHash[state.slug] || {}
const FEED_QUERY = gql`
query FeedQuery {
state @client {
language @client {
locale
}
}
feed {
links {
id
createdAt
url
description
}
}
}`;
//export default connect(mapState)(
export default graphql(FEED_QUERY,
{
props: ({data: {loading, error, state,...other}}) => {
console.log("FEED_QUERY",state,other)
return {
}}
})(Video)