fix providers page

This commit is contained in:
Chew committed 2023-11-07 21:13:48 -06:00
1 parent da519a868a
commit 04e774a111
5 files changed
+92 -55

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import type {Providers, HostingProvider, ProviderType} from "@site/src/types/providers";
import ReactMarkdown from "react-markdown";
export const noP = (props: { children: any; }) => {
const { children } = props;
return children;
}
export const Provider = ({type}) => {
const data: Providers = require('@site/_data/providers.json')
const providers: HostingProvider[] = data[type as ProviderType]
console.log(data, type, providers)
return (
<div>
<ul>{providers.map((provider: HostingProvider) => (
<li>
<a href={provider.url}>{provider.name}</a>
{provider.description != null || provider.description_template != null ? (
<ReactMarkdown children={`&nbsp;&hyphen; ${data.description_templates[provider.description_template] || ''} ${provider.description || ''}`} components={{p: noP}} />
) : (
''
)}
</li>
))}</ul>
</div>
)
}
+20
View File
@@ -0,0 +1,20 @@
export type HostingProvider = {
name: string;
url: string;
description?: string;
description_template?: "default" | "ip_and_port" | "forwarding_option" | "java_ip";
}
export type ProviderType = "built_in" | "support" | "no_support";
export type Providers = {
description_templates: {
default: string;
ip_and_port: string;
forwarding_option: string;
java_ip: string;
},
built_in: HostingProvider[];
support: HostingProvider[];
no_support: HostingProvider[];
}