add GNU social to frontend

This commit is contained in:
Tao Bror Bojlén 2019-08-09 19:54:44 +03:00
parent 548015d1fd
commit 4440e5e6a1
No known key found for this signature in database
GPG Key ID: C6EC7AAB905F9E6F
6 changed files with 19 additions and 9 deletions

View File

@ -61,7 +61,7 @@ config :backend, :crawler,
status_count_limit: 100,
personal_instance_threshold: 5,
crawl_interval_mins: 60,
crawl_workers: 1,
crawl_workers: 10,
blacklist: [
"gab.best",
"4chan.icu"

View File

@ -266,9 +266,9 @@ defmodule Backend.Crawler do
|> Map.get(:crawl_error_count)
|> Kernel.+(1)
# The crawl interval grows exponentially at first but never goes above 72 hours
# The crawl interval grows exponentially at first but never goes above 24 hours
crawl_interval_mins =
min(get_config(:crawl_interval_mins) * round(:math.pow(2, error_count)), 4320)
min(get_config(:crawl_interval_mins) * round(:math.pow(2, error_count)), 1440)
next_crawl = NaiveDateTime.add(now, crawl_interval_mins * 60, :second)

View File

@ -3,7 +3,7 @@ import { IconNames } from "@blueprintjs/icons";
import React from "react";
import { QUALITATIVE_COLOR_SCHEME } from "../../constants";
import { typeColorScheme } from "../../types";
import { capitalize } from "../../util";
import { getTypeDisplayString } from "../../util";
interface IInstanceTypeProps {
type: string;
@ -15,7 +15,7 @@ interface IInstanceTypeProps {
*/
const InstanceType: React.FC<IInstanceTypeProps> = ({ type, colorAfterName }) => {
const idx = typeColorScheme.values.indexOf(type);
const name = " " + capitalize(type);
const name = " " + getTypeDisplayString(type);
return (
<>
{!!colorAfterName && name}

View File

@ -4,7 +4,7 @@ import React, { MouseEvent } from "react";
import styled from "styled-components";
import { INSTANCE_TYPES } from "../../constants";
import { getSearchFilterDisplayValue, ISearchFilter } from "../../searchFilters";
import { capitalize } from "../../util";
import { getTypeDisplayString } from "../../util";
const SearchFilterContainer = styled.div`
margin: 10px 0 0 0;
@ -30,7 +30,7 @@ const SearchFilters: React.FC<ISearchFiltersProps> = ({ selectedFilters, selectF
const handleSelectInstanceType = (e: MouseEvent<HTMLElement>) => {
const field = "type";
const relation = "eq";
const value = e.currentTarget.innerText.toLowerCase();
const value = e.currentTarget.innerText.toLowerCase().replace(" ", "");
const filter: ISearchFilter = {
displayValue: getSearchFilterDisplayValue(field, relation, value),
field,
@ -43,7 +43,7 @@ const SearchFilters: React.FC<ISearchFiltersProps> = ({ selectedFilters, selectF
<Menu>
<MenuItem icon={IconNames.SYMBOL_CIRCLE} text="Instance type" disabled={hasInstanceTypeFilter}>
{INSTANCE_TYPES.map(t => (
<MenuItem key={t} text={capitalize(t)} onClick={handleSelectInstanceType} />
<MenuItem key={t} text={getTypeDisplayString(t)} onClick={handleSelectInstanceType} />
))}
</MenuItem>
</Menu>

View File

@ -40,4 +40,4 @@ export interface IInstanceDomainPath {
}
// We could also extract the values from the server response, but this would slow things down...
export const INSTANCE_TYPES = ["mastodon", "gab", "pleroma", "misskey"];
export const INSTANCE_TYPES = ["mastodon", "gab", "pleroma", "misskey", "gnusocial"];

View File

@ -68,3 +68,13 @@ export const getBuckets = (min: number, max: number, steps: number, exponential:
return range(min, max, bucketSize);
}
};
const typeToDisplay = {
gnusocial: "GNU Social"
};
export const getTypeDisplayString = (key: string) => {
if (key in typeToDisplay) {
return typeToDisplay[key];
}
return capitalize(key);
};