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

View File

@ -2,6 +2,10 @@ import * as React from "react";
import { LogoWhiteText } from "../Icons"; import { LogoWhiteText } from "../Icons";
import Link from "../Link"; 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 = () => { const Footer = () => {
return ( return (
<div className="bg-palette-600 px-8 py-12"> <div className="bg-palette-600 px-8 py-12">
@ -14,12 +18,19 @@ const Footer = () => {
</span> </span>
</div> </div>
{emails.length > 0 && (
<div className="flex flex-col text-right space-y-2">
{emails.map((email) => (
<Link <Link
href="mailto:hello@siasky.net" key={email}
href={`mailto:${email}`}
className="font-content text-palette-300 text-base underline-primary hover:text-primary transition-colors duration-200" className="font-content text-palette-300 text-base underline-primary hover:text-primary transition-colors duration-200"
> >
hello@siasky.net {email}
</Link> </Link>
))}
</div>
)}
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@ -1,7 +1,20 @@
import useSWR from "swr"; import useSWR from "swr";
import skynetClient from "./skynetClient";
const prefix = process.env.GATSBY_API_URL ?? ""; const fetcher = async (url) => {
const fetcher = (url) => fetch(`${prefix}${url}`).then((response) => response.json()); 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() { export default function useAccounts() {
return useSWR("/__internal/do/not/use/accounts", fetcher); return useSWR("/__internal/do/not/use/accounts", fetcher);