clean up welcome page
This commit is contained in:
parent
58b36250e2
commit
e1237fba01
|
@ -2,8 +2,7 @@ import * as React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Dispatch } from 'redux';
|
import { Dispatch } from 'redux';
|
||||||
|
|
||||||
import { Button, Intent, NonIdealState, Spinner } from '@blueprintjs/core';
|
import { NonIdealState, Spinner } from '@blueprintjs/core';
|
||||||
import { IconNames } from '@blueprintjs/icons';
|
|
||||||
|
|
||||||
import { Graph } from './components/Graph';
|
import { Graph } from './components/Graph';
|
||||||
import { Nav } from './components/Nav';
|
import { Nav } from './components/Nav';
|
||||||
|
@ -21,11 +20,9 @@ interface IAppProps {
|
||||||
}
|
}
|
||||||
class AppImpl extends React.Component<IAppProps> {
|
class AppImpl extends React.Component<IAppProps> {
|
||||||
public render() {
|
public render() {
|
||||||
let body = this.welcomeState();
|
let body = <div />;
|
||||||
if (this.props.isLoadingInstances) {
|
if (this.props.isLoadingInstances || this.props.isLoadingGraph) {
|
||||||
body = this.loadingState("Loading instances...");
|
body = this.loadingState("Loading...");
|
||||||
} else if (this.props.isLoadingGraph) {
|
|
||||||
body = this.loadingState("Loading graph...");
|
|
||||||
} else if (!!this.props.graph) {
|
} else if (!!this.props.graph) {
|
||||||
body = this.graphState();
|
body = this.graphState();
|
||||||
}
|
}
|
||||||
|
@ -38,8 +35,21 @@ class AppImpl extends React.Component<IAppProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
|
this.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidUpdate() {
|
||||||
|
this.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private load = () => {
|
||||||
|
if (!this.props.instances && !this.props.isLoadingInstances) {
|
||||||
this.props.fetchInstances();
|
this.props.fetchInstances();
|
||||||
}
|
}
|
||||||
|
if (!this.props.graph && !this.props.isLoadingGraph) {
|
||||||
|
this.props.fetchGraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private graphState = () => {
|
private graphState = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -50,19 +60,6 @@ class AppImpl extends React.Component<IAppProps> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private welcomeState = () => {
|
|
||||||
const numInstances = this.props.instances ? this.props.instances.length : "lots of";
|
|
||||||
const description = `There are ${numInstances} known instances, so loading the graph might take a little while. Ready?`
|
|
||||||
return (
|
|
||||||
<NonIdealState
|
|
||||||
icon={IconNames.GLOBE_NETWORK}
|
|
||||||
title="Welcome to fediverse.space!"
|
|
||||||
description={description}
|
|
||||||
action={<Button intent={Intent.PRIMARY} text={"Let's go"} onClick={this.props.fetchGraph} />}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadingState = (title?: string) => {
|
private loadingState = (title?: string) => {
|
||||||
return (
|
return (
|
||||||
<NonIdealState
|
<NonIdealState
|
||||||
|
|
|
@ -31,7 +31,7 @@ from scraper.management.commands._util import require_lock, InvalidResponseExcep
|
||||||
|
|
||||||
SEED = 'mastodon.social'
|
SEED = 'mastodon.social'
|
||||||
TIMEOUT = 20 # seconds
|
TIMEOUT = 20 # seconds
|
||||||
NUM_THREADS = 64 # roughly 40MB each
|
NUM_THREADS = 16 # roughly 40MB each
|
||||||
PERSONAL_INSTANCE_THRESHOLD = 5 # instances with <= this many users won't be scraped
|
PERSONAL_INSTANCE_THRESHOLD = 5 # instances with <= this many users won't be scraped
|
||||||
STATUS_SCRAPE_LIMIT = 5000
|
STATUS_SCRAPE_LIMIT = 5000
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue