/** @jsx h */ import { Component, h } from "preact"; import { AddIcon } from "./icons/add-icon.tsx"; import { CenterClass, NoOutlineClass } from "./components/tw.ts"; import { DividerBackgroundColor, ErrorColor, HoverButtonBackgroundColor, PrimaryTextColor, } from "./style/colors.ts"; import { emitFunc } from "../event-bus.ts"; import { RelayConfig } from "./relay-config.ts"; import { HidePopOver } from "./components/popover.tsx"; export type func_GetRelayRecommendations = () => Set; type RelayRecommendListProps = { relayConfig: RelayConfig; emit: emitFunc; getRelayRecommendations: func_GetRelayRecommendations; }; export class RelayRecommendList extends Component { handleAddRelay = async (relayUrl: string) => { const p = this.props.relayConfig.add(relayUrl); this.props.emit({ type: "HidePopOver", }); const relay = await p; if (relay instanceof Error) { console.error(relay); return; } this.forceUpdate(); }; render() { return (
Recommend Relays
    {Array.from( this.props.getRelayRecommendations().difference( this.props.relayConfig.getRelayURLs(), ), ).map((r) => { return (
  • {r}
  • ); })}
); } }