-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial PR for reddit wrapper in ReactJS + Typescript #1
base: master
Are you sure you want to change the base?
Conversation
…for all current and future pages
); | ||
} | ||
if (media.url.indexOf('youtube') !== -1) { | ||
console.log('SPLIT', media.url.split('watch?v=')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
const extension = media.url.split('.')[media.url.split('.').length - 1]; | ||
if (media.url.indexOf('gfycat') !== -1) { | ||
return( | ||
<iframe src={`https://thumbs.${media.url.split('://')[1]}-mobile.mp4`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<iframe
src ...
scrolling='no'
width='640'
....
</iframe>
return (<img src={media.url} alt=""/>); | ||
} | ||
if (extension === 'gifv') { | ||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nasty. Race condition!
const Markdown = require('react-remarkable'); | ||
|
||
|
||
interface IProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make proper interfaces, reduce usage of any;
} | ||
|
||
public componentDidMount() { | ||
const script = document.createElement('script'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component mound append and on componentWillUnmount should remove that script
src/components/home/layout.tsx
Outdated
@@ -0,0 +1,62 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
src/components/home/welcome.tsx
Outdated
@@ -0,0 +1,72 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
src/components/layout.tsx
Outdated
@@ -0,0 +1,39 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not used remove it
src/components/navbar/login.tsx
Outdated
|
||
const mapDispatchToProps = {authorization}; | ||
|
||
@(connect(null, mapDispatchToProps) as any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there must be better way
src/components/navbar/login.tsx
Outdated
...this.state, | ||
submitted: true, | ||
}; | ||
this.setState(newState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be:
this.setState({
...this.state,
submitted: true,
});
dispatch?: any; | ||
isVisible?: boolean; | ||
quanityOfSavedSubreddits?: number; | ||
whereYouAre?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange naming
}; | ||
|
||
public render() { | ||
const authLink = 'https://www.reddit.com/api/v1/authorize?client_id=YJa94gbugND2ZQ&response_type=code&state=42asdf&redirect_uri=http://localhost:8000/auth&duration=permanent&scope=identity'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be moved into config and set as AUTH_LINK
const imported from constants.
<div className="auth-top col-xs-12"> | ||
<div className="auth-urself"> | ||
<a href={authLink}> | ||
Auth yourself with Leddit account! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo - Reddit
src/components/navbar/searching.tsx
Outdated
public handleChange = (event: any): void => { | ||
const value = event.target.value; | ||
this.setState( | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setState({...this.state, input:value});
} | ||
|
||
interface ISubreddits { | ||
data: Object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not nice interface
}; | ||
|
||
private openSubredditOnClick = (subreddit: any ) => { | ||
// return (e: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't push commented code
return ( | ||
<div className="saved-subreddit-menu-item search-panel-results" key={subreddit.id}> | ||
<Link to={`/${subreddit.display_name_prefixed}/`}> | ||
{/*<span onClick={this.openSubredditOnClick(subreddit)}>*/} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
src/components/not-found.tsx
Outdated
|
||
const NotFound: StatelessComponent<any> = (): any => { | ||
return ( | ||
<div>The page you request is not exist.</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page you requested doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boilerpack default 404 page.
|
||
public render() { | ||
const { thread_replies, original_post } = this.props; | ||
console.log('REPLIES', thread_replies); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
src/constants.ts
Outdated
@@ -0,0 +1,8 @@ | |||
export const TITLES = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or actually have it but remove those constants
@@ -0,0 +1 @@ | |||
export const object: any = Object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing new line at the end
src/prepare.ts
Outdated
const subreddits = require('./reducers/reducer_subreddits_search'); | ||
const nextReducer = combineReducers({ | ||
routing: routerReducer, | ||
titleReducer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...reducers
as above
@@ -0,0 +1,28 @@ | |||
/* Import redcers */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
src/reducers/display_subreddit.ts
Outdated
case FETCH_SUBREDDIT: | ||
return {...state, threads: []}; | ||
case FETCH_THREAD: | ||
return {...state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
...state,
...
}
src/reducers/titles.ts
Outdated
@@ -0,0 +1,25 @@ | |||
import { GET_NEXT_TITLE, TITLES } from '../constants'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
No description provided.