import React, { Component } from "react";
import { Loader, Icon, Item, Segment } from "semantic-ui-react";
import { Link } from "@reach/router";
import Moment from "react-moment";
import "moment/locale/es";
class ThreadList extends Component {
constructor(props) {
super(props);
this.state = { isLoading: true, threadList: [] };
}
componentDidMount() {
const { dir } = this.props;
fetch(
`https://bienvenidoainternet.org/cgi/api/list?dir=${dir}&replies=0&limit=30&nohtml=1`
)
.then(response => {
return response.json();
})
.then(resource => {
this.setState({ threadList: resource.threads, isLoading: false });
});
}
render() {
const { dir, boardList, nightMode } = this.props;
const { threadList, isLoading } = this.state;
const currentBoard = boardList.find(board => {
return board.dir === dir;
});
if (isLoading) {
return (
Cargando lista de hilos ...
);
}
const stripHtml = RegExp(
/(