From e26f941892b63b4356c2bd53a6a9699fc30c881c Mon Sep 17 00:00:00 2001 From: James Acklin Date: Tue, 8 Aug 2023 14:40:31 -0400 Subject: [PATCH] landscape: add tlon hosting linkback --- ui/src/logic/utils.ts | 3 +++ ui/src/nav/Hosting.tsx | 26 ++++++++++++++++++++++++ ui/src/nav/Nav.tsx | 19 ++++++++++++++++- ui/src/preferences/SystemPreferences.tsx | 13 +++++++++++- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 ui/src/nav/Hosting.tsx diff --git a/ui/src/logic/utils.ts b/ui/src/logic/utils.ts index c8e352d..865139f 100644 --- a/ui/src/logic/utils.ts +++ b/ui/src/logic/utils.ts @@ -13,6 +13,9 @@ import { differenceInDays, endOfToday, format } from 'date-fns'; export const useMockData = import.meta.env.MODE === 'mock'; +export const isHosted = + import.meta.env.DEV || window.location.hostname.endsWith('.tlon.network'); + export async function fakeRequest(data: T, time = 300): Promise { return new Promise((resolve) => { setTimeout(() => { diff --git a/ui/src/nav/Hosting.tsx b/ui/src/nav/Hosting.tsx new file mode 100644 index 0000000..3d10723 --- /dev/null +++ b/ui/src/nav/Hosting.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import { Button } from '../components/Button'; + +export const Hosting = () => { + return ( +
+
+

Tlon Hosting

+
+

Service Account Dashboard

+

+ View your hosted urbits, their current status, and account info. +

+
+ +
+
+ ); +}; diff --git a/ui/src/nav/Nav.tsx b/ui/src/nav/Nav.tsx index 9ae72c0..566f18e 100644 --- a/ui/src/nav/Nav.tsx +++ b/ui/src/nav/Nav.tsx @@ -33,6 +33,8 @@ import { Cross } from '../components/icons/Cross'; import GetApps from './GetApps'; import LandscapeWayfinding from '../components/LandscapeWayfinding'; import { useCalm } from '../state/settings'; +import { isHosted } from '@/logic/utils'; +import TlonIcon from '@/components/icons/TlonIcon'; export interface MatchItem { url: string; @@ -112,11 +114,25 @@ export const SystemPrefsLink = ({ ); }; +export const HostingLink = () => { + if (isHosted) { + return ( + + + + ); + } + return <>; +}; + export const GetAppsLink = () => { return ( Get Urbit Apps @@ -169,6 +185,7 @@ export const Nav: FunctionComponent = () => { navOpen={isOpen} notificationsOpen={menu === 'notifications'} /> + {!disableWayfinding && } diff --git a/ui/src/preferences/SystemPreferences.tsx b/ui/src/preferences/SystemPreferences.tsx index 44baf65..b46d812 100644 --- a/ui/src/preferences/SystemPreferences.tsx +++ b/ui/src/preferences/SystemPreferences.tsx @@ -23,8 +23,9 @@ import { DocketImage } from '../components/DocketImage'; import { ErrorAlert } from '../components/ErrorAlert'; import { useIsMobile, useMedia } from '../logic/useMedia'; import { LeftArrow } from '../components/icons/LeftArrow'; -import { getAppName } from '@/logic/utils'; +import { getAppName, isHosted } from '@/logic/utils'; import { Help } from '../nav/Help'; +import { Hosting } from '../nav/Hosting'; import TlonIcon from '../components/icons/TlonIcon'; import HelpIcon from '../components/icons/HelpIcon'; import LogoutIcon from '../components/icons/LogoutIcon'; @@ -123,6 +124,15 @@ export const SystemPreferences = () => { )} + {isHosted && ( + + + Tlon Hosting + + )} Help and Support @@ -217,6 +227,7 @@ export const SystemPreferences = () => {
} /> + } /> } /> } /> } />