@@ -14,6 +14,7 @@ import Box from '@material-ui/core/Box';
14
14
// Custom Components
15
15
import Post from './Post' ;
16
16
import HeadingCard from './HeadingCard' ;
17
+ import TweetPagination from './TweetPagination' ;
17
18
// Custom Styling
18
19
import '../styles/components/ProfileTweets.css'
19
20
@@ -111,7 +112,12 @@ const AntTab = withStyles((theme) => ({
111
112
selected : { } ,
112
113
} ) ) ( ( props ) => < NavLink className = "profileTweets__tab__link" to = { props . to } > < Tab className = "profileTweets__tab" { ...props } /> </ NavLink > ) ;
113
114
114
- export default function ProfileTweets ( { currentUser, profileUser, loadUserProfile } ) {
115
+ export default function ProfileTweets ( {
116
+ currentUser, profileUser, loadUserProfile,
117
+ tweets_currentPage, tweets_setCurrentPage,
118
+ media_currentPage, media_setCurrentPage,
119
+ likes_currentPage, likes_setCurrentPage,
120
+ } ) {
115
121
const classes = useStyles ( ) ;
116
122
const theme = useTheme ( ) ;
117
123
const [ value , setValue ] = useState ( 0 ) ;
@@ -125,7 +131,7 @@ export default function ProfileTweets({ currentUser, profileUser, loadUserProfil
125
131
} else {
126
132
setValue ( 0 )
127
133
}
128
- } )
134
+ } ) ;
129
135
130
136
const handleChange = ( event , newValue ) => {
131
137
setValue ( newValue ) ;
@@ -177,11 +183,17 @@ export default function ProfileTweets({ currentUser, profileUser, loadUserProfil
177
183
< HeadingCard line_1 = { `@${ profileUser . username } hasn't Tweeted anything yet` } line_2 = "When they do, their tweets will show up here." />
178
184
: null
179
185
}
186
+ { /* Pagination */ }
187
+ < TweetPagination
188
+ pageCount = { profileUser . tweets_pages }
189
+ currentPage = { tweets_currentPage }
190
+ setCurrentPage = { tweets_setCurrentPage }
191
+ />
180
192
</ TabPanel >
181
193
< TabPanel className = "profileTweets__tweetsTabPanel" value = { value } index = { 1 } dir = { theme . direction } >
182
194
{ /* User's Tweets with Media */ }
183
195
< FlipMove >
184
- { profileUser . tweets . filter ( post => post . image ) . map ( post => (
196
+ { profileUser . media . map ( post => (
185
197
< Post
186
198
key = { post . id }
187
199
tweet = { post . id }
@@ -200,10 +212,16 @@ export default function ProfileTweets({ currentUser, profileUser, loadUserProfil
200
212
/>
201
213
) ) }
202
214
</ FlipMove >
203
- { profileUser . tweets . filter ( post => post . image ) . length === 0 ?
215
+ { profileUser . media . length === 0 ?
204
216
< HeadingCard line_1 = { `@${ profileUser . username } hasn't Tweeted any photos` } line_2 = "When they do, their media will show up here." />
205
217
: null
206
218
}
219
+ { /* Pagination */ }
220
+ < TweetPagination
221
+ pageCount = { profileUser . media_pages }
222
+ currentPage = { media_currentPage }
223
+ setCurrentPage = { media_setCurrentPage }
224
+ />
207
225
</ TabPanel >
208
226
< TabPanel className = "profileTweets__tweetsTabPanel" value = { value } index = { 2 } dir = { theme . direction } >
209
227
{ /* User's LikedTweets */ }
@@ -233,6 +251,12 @@ export default function ProfileTweets({ currentUser, profileUser, loadUserProfil
233
251
< HeadingCard line_1 = { `@${ profileUser . username } hasn't Liked any Tweets` } line_2 = "When they do, their liked tweets will show up here." />
234
252
: null
235
253
}
254
+ { /* Pagination */ }
255
+ < TweetPagination
256
+ pageCount = { profileUser . likes_pages }
257
+ currentPage = { likes_currentPage }
258
+ setCurrentPage = { likes_setCurrentPage }
259
+ />
236
260
</ TabPanel >
237
261
</ SwipeableViews >
238
262
</ div >
0 commit comments