import * as React from 'react';
import * as _ from 'lodash';
import { suggestions } from './data/suggestions';
import { AppDataStore } from './data/AppDataStore';
import { Talk } from './data/Document';
import { Dropdown } from 'semantic-ui-react';
import {
ResultsLayout,
SearchBox,
PaginationData,
Bound,
GenericSolrQuery,
SearchParams
} from 'solrkit';
import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css';
import Slider from 'react-slick';
const searches: SavedSearch[] = [
{
title: 'Historic Speeches',
search: {
query: 'Economic'
}
},
{
title: 'Economic Justice',
search: {
query: 'Rights'
}
},
{
title: 'Civil Rights Movement',
search: {
query: 'Civil'
}
}
];
interface SearchPageProps {
query: string;
page: number;
facets: { [ key: string ]: string[] };
}
const dataStore = new AppDataStore('topic');
interface SavedSearch {
title: string;
search: GenericSolrQuery;
}
const PlayIcon = ({selected}: {selected: boolean}) => (
);
class CheckmarkIcon extends React.Component<
{value: string, id: string},
{}
> {
constructor() {
super();
}
shouldComponentUpdate() {
return false;
}
render() {
if (!this.props.value) {
// video has not been opened
return null;
}
const mainElementId = this.props.id + '_watchedOverlay';
const animationTrigger = mainElementId + '.mouseover';
const duration = '0.4s';
const hover = (
{this.props.value}
);
return (
{hover}
);
}
}
const Watched = (
{id, selected}: {
id: string,
selected: boolean
}
) => (
);
function thumbnailUrl(url: string) {
return (
'http://img.youtube.com/vi/' +
url.replace(/.*v=/, '') +
'/mqdefault.jpg'
);
}
class VideoThumbnail extends React.Component<{talk: Talk}, {hover: boolean}> {
constructor() {
super();
this.state = {
hover: false
};
this.onMouseEnter = this.onMouseEnter.bind(this);
this.onMouseLeave = this.onMouseLeave.bind(this);
}
onMouseEnter() {
this.setState({hover: true});
}
onMouseLeave() {
this.setState({hover: false});
}
render() {
const talk = this.props.talk;
return (
);
}
}
class Hover extends React.Component<{}, {}> {
constructor() {
super();
}
render() {
return (
{
(_.flatten([this.props.children]) as object[]).map(
(child) => (
child
)
)
}
);
}
}
interface ArrowProps {
left: boolean;
className?: string;
style?: object;
onClick?: () => void;
}
class Arrow extends React.Component {
constructor() {
super();
this.state = {
hover: false
};
this.onMouseEnter = this.onMouseEnter.bind(this);
this.onMouseLeave = this.onMouseLeave.bind(this);
}
onMouseEnter() {
this.setState({hover: true});
}
onMouseLeave() {
this.setState({hover: false});
}
render() {
const { onClick, style } = this.props;
return (
);
}
}
class VideoScroller extends React.Component<{
talks: Talk[],
title: string
}, {}> {
private slider;
private prevArrow;
private nextArrow;
private dragging: boolean;
constructor() {
super();
this.prevArrow = (
);
this.nextArrow = (
);
this.onClickVideo = this.onClickVideo.bind(this);
this.dragging = false;
}
onClickVideo(e: React.MouseEvent) {
if (this.dragging) {
e.preventDefault();
return true;
} else {
return false;
}
}
render() {
const settings = {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 5,
slidesToScroll: 2,
swipeToSlide: true,
variableWidth: false,
prevArrow: this.prevArrow,
nextArrow: this.nextArrow,
beforeChange: () => this.dragging = true,
afterChange: () => this.dragging = false,
};
return (
{this.props.title}
this.slider = slider}
>
{
this.props.talks.map(
(talk: Talk) => (
)
)
}
);
}
}
class TopicPage extends React.Component {
static dataStore = dataStore;
private left: () => JSX.Element;
private right: () => JSX.Element;
private header: () => JSX.Element;
private footer: () => JSX.Element;
private rightRail: () => JSX.Element;
constructor() {
super();
this.right =
() => (
Computer Science
Artificial Intelligence
Cryptocurrency
Javascript
Build Engineering
Project Management
Data Science
Big Data
Databases
Other Topics
Social Justice
Feminism
Liberation Theology
Socialism
Libertarianism
Black History
Order
Status
Cancellations
Social justice is a concept of fair and just relations
between the individual and society.
The lectures below include major themes, influential speakers,
and primary source materials.
{
searches.map(
(savedSearch: SavedSearch, i: number) => (
}
/>
)
)
}
);
this.header = () => (
(window as any).location =
'https://www.findlectures.com/?q=' + params.query.replace(/ /g, '%20')
}
/>
);
}
componentDidMount() {
// this isn't taking url props
dataStore.talks.stateTransition(
{
type: 'QUERY',
query: this.props.query,
page: this.props.page,
facets: this.props.facets
}
);
}
componentWillReceiveProps(newProps: SearchPageProps) {
dataStore.talks.stateTransition(
{
type: 'QUERY',
query: newProps.query,
page: newProps.page,
facets: this.props.facets
}
);
}
render() {
return (
);
}
}
export { TopicPage };