add GNU social to frontend
This commit is contained in:
parent
548015d1fd
commit
4440e5e6a1
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"];
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue