Updated url for ceddit links

This commit is contained in:
Jesper Wrang 2019-12-05 10:41:21 +01:00
parent 2a7d4a23c2
commit 67803e2c0a
4 changed files with 10 additions and 14 deletions

4
TODO
View file

@ -1,7 +1,3 @@
update header links active (NavLinks)
make sort/filter state local
old.removeddit.com
take utc from thread and limit pushshift comments

View file

@ -27,7 +27,7 @@ export default (props) => {
return (
<div className={`thread ${props.removed && 'removed'} ${props.deleted && 'deleted'}`}>
{props.position &&
<span className='post-rank'>{props.position}</span>}
<span className='post-rank'>{props.position}</span>}
<div className='thread-score-box'>
<div className='vote upvote' />
<div className='thread-score'>{prettyScore(props.score)}</div>
@ -47,11 +47,11 @@ export default (props) => {
&nbsp;to <Link className='subreddit-link author' to={`/r/${props.subreddit}`}>/r/{props.subreddit}</Link>
</div>
{props.selftext &&
<div className='thread-selftext user-text' dangerouslySetInnerHTML={{ __html: parse(props.selftext) }} />}
<div className='thread-selftext user-text' dangerouslySetInnerHTML={{ __html: parse(props.selftext) }} />}
<div className='total-comments'>
<Link className='grey-link' to={props.permalink}><b>{props.num_comments} comments</b></Link>&nbsp;
<a className='grey-link' href={`https://www.reddit.com${props.permalink}`}><b>reddit</b></a>&nbsp;
<a className='grey-link' href={`https://snew.github.io${props.permalink}`}><b>ceddit</b></a>
<a className='grey-link' href={`https://snew.notabug.io${props.permalink}`}><b>ceddit</b></a>
</div>
</div>
</div>

View file

@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'
import { getRemovedThreadIDs } from '../../api/removeddit'
import { getThreads } from '../../api/reddit'
import Post from '../common/Post'
import {connect} from '../../state'
import { connect } from '../../state'
class Subreddit extends React.Component {
state = {
@ -11,13 +11,13 @@ class Subreddit extends React.Component {
loading: true
}
componentDidMount () {
componentDidMount() {
const { subreddit = 'all' } = this.props.match.params
this.getRemovedThreads(subreddit)
}
// Check if the subreddit has changed in the url, and fetch threads accordingly
componentDidUpdate (prevProps) {
componentDidUpdate(prevProps) {
const { subreddit: newSubreddit = 'all' } = this.props.match.params
const { subreddit = 'all' } = prevProps.match.params
@ -27,7 +27,7 @@ class Subreddit extends React.Component {
}
// Download thread IDs from removeddit API, then thread info from reddit API
getRemovedThreads (subreddit) {
getRemovedThreads(subreddit) {
document.title = `/r/${subreddit}`
this.setState({ threads: [], loading: true })
this.props.global.setLoading('Loading removed threads...')
@ -45,7 +45,7 @@ class Subreddit extends React.Component {
.catch(this.props.global.setError)
}
render () {
render() {
const { subreddit = 'all' } = this.props.match.params
const noThreadsFound = this.state.threads.length === 0 && !this.state.loading
@ -56,7 +56,7 @@ class Subreddit extends React.Component {
<span className='space' />
<a href={`https://www.reddit.com/r/${subreddit}`} className='subreddit-title-link'>reddit</a>
<span className='space' />
<a href={`https://snew.github.io/r/${subreddit}`} className='subreddit-title-link'>ceddit</a>
<a href={`https://snew.notabug.io/r/${subreddit}`} className='subreddit-title-link'>ceddit</a>
</div>
{
noThreadsFound

View file

@ -37,7 +37,7 @@ const Comment = (props) => {
<div className='comment-links'>
<Link to={permalink}>permalink</Link>
<a href={`https://www.reddit.com${permalink}`}>reddit</a>
<a href={`https://snew.github.io${permalink}`}>ceddit</a>
<a href={`https://snew.notabug.io${permalink}`}>ceddit</a>
</div>
<div>
{props.replies.map(comment => (