set hello and abuse emails based on current domain

This commit is contained in:
Karol Wypchlo 2022-03-03 18:17:21 +01:00
parent 10ad9aafb0
commit 135c7ff1ca
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
4 changed files with 34 additions and 11 deletions

View File

@ -1,7 +1,7 @@
- header: Skynet Labs
links:
- title: About us
to: https://skynetlabs.com/about
href: https://skynetlabs.com/about
- title: Brand Guidelines
href: https://support.skynetlabs.com/key-concepts/skynet-brand-guidelines
- title: Careers
@ -15,7 +15,7 @@
- title: Developer Guide
href: https://docs.skynetlabs.com
- title: API & SDK Documentation
href: https://siasky.net/docs/
href: https://sdk.skynetlabs.com
- title: Portal Setup
href: https://support.skynetlabs.com/the-technology/running-a-web-portal
- title: Github

View File

@ -2,6 +2,10 @@ import * as React from "react";
import { LogoWhiteText } from "../Icons";
import Link from "../Link";
const hostname = typeof window !== "undefined" ? window.location.hostname : "";
const domain = hostname.substring(hostname.lastIndexOf(".", hostname.lastIndexOf(".") - 1) + 1);
const emails = domain ? [`hello@${domain}`, `abuse@${domain}`] : [];
const Footer = () => {
return (
<div className="bg-palette-600 px-8 py-12">
@ -14,12 +18,19 @@ const Footer = () => {
</span>
</div>
<Link
href="mailto:hello@siasky.net"
className="font-content text-palette-300 text-base underline-primary hover:text-primary transition-colors duration-200"
>
hello@siasky.net
</Link>
{emails.length > 0 && (
<div className="flex flex-col text-right space-y-2">
{emails.map((email) => (
<Link
key={email}
href={`mailto:${email}`}
className="font-content text-palette-300 text-base underline-primary hover:text-primary transition-colors duration-200"
>
{email}
</Link>
))}
</div>
)}
</div>
</div>
</div>

View File

@ -13,7 +13,6 @@ const FooterNavigation = () => {
links {
href
title
to
}
}
}

View File

@ -1,7 +1,20 @@
import useSWR from "swr";
import skynetClient from "./skynetClient";
const prefix = process.env.GATSBY_API_URL ?? "";
const fetcher = (url) => fetch(`${prefix}${url}`).then((response) => response.json());
const fetcher = async (url) => {
try {
const portalUrl = await skynetClient.portalUrl();
const portalUrlObject = new URL(portalUrl);
portalUrlObject.pathname = url;
const absoluteUrl = portalUrlObject.toString();
return fetch(absoluteUrl).then((response) => response.json());
} catch (error) {
return fetch(url).then((response) => response.json());
}
};
export default function useAccounts() {
return useSWR("/__internal/do/not/use/accounts", fetcher);