From 2501974a730cab2646bcd6bdef6d6c0b10e26a7a Mon Sep 17 00:00:00 2001 From: gdbroman <99gustaf@gmail.com> Date: Tue, 27 Jun 2023 19:14:01 +0200 Subject: [PATCH] hosting.holium.com: Contact Support sidebar link --- .../src/pages/account/custom-domain.tsx | 8 +++++++- .../src/pages/account/download-realm.tsx | 10 +++++++--- .../src/pages/account/get-realm.tsx | 6 ++++-- hosting-holium-com/src/pages/account/index.tsx | 8 +++++++- .../src/pages/account/storage.tsx | 9 ++++++++- hosting-holium-com/src/util/constants.ts | 5 +++++ .../src/onboarding/components/AccountDialog.tsx | 17 ++++++++++++++--- 7 files changed, 52 insertions(+), 11 deletions(-) diff --git a/hosting-holium-com/src/pages/account/custom-domain.tsx b/hosting-holium-com/src/pages/account/custom-domain.tsx index eb1a938252..37fe6d941b 100644 --- a/hosting-holium-com/src/pages/account/custom-domain.tsx +++ b/hosting-holium-com/src/pages/account/custom-domain.tsx @@ -8,6 +8,8 @@ import { useUser, } from '@holium/shared'; +import { getSupportEmail } from 'util/constants'; + import { Page } from '../../components/Page'; import { thirdEarthApi } from '../../util/thirdEarthApi'; import { accountPageUrl, useNavigation } from '../../util/useNavigation'; @@ -61,7 +63,11 @@ const CustomDomainPresenter = () => { }; const onClickSidebarSection = (section: string) => { - goToPage(accountPageUrl[section]); + if (section === 'Contact Support') { + window.open(getSupportEmail(ship?.patp), '_blank'); + } else { + goToPage(accountPageUrl[section]); + } }; const onClickUploadId = () => { diff --git a/hosting-holium-com/src/pages/account/download-realm.tsx b/hosting-holium-com/src/pages/account/download-realm.tsx index 77cfa689cb..090e2a02b1 100644 --- a/hosting-holium-com/src/pages/account/download-realm.tsx +++ b/hosting-holium-com/src/pages/account/download-realm.tsx @@ -6,7 +6,7 @@ import { } from '@holium/shared'; import { Page } from '../../components/Page'; -import { downloadLinks } from '../../util/constants'; +import { downloadLinks, getSupportEmail } from '../../util/constants'; import { thirdEarthApi } from '../../util/thirdEarthApi'; import { accountPageUrl, useNavigation } from '../../util/useNavigation'; @@ -15,12 +15,16 @@ const DownloadRealmPresenter = () => { const { ships, selectedShipId, setSelectedShipId } = useUser(); const onClickSidebarSection = (section: string) => { - if (section === 'Get Hosting') { + if (section === 'Contact Support') { + const ship = ships.find((ship) => ship.id === selectedShipId); + window.open(getSupportEmail(ship?.patp ?? ''), '_blank'); + } else if (section === 'Get Hosting') { goToPage(accountPageUrl[section], { back_url: '/account/download-realm', }); + } else { + goToPage(accountPageUrl[section]); } - goToPage(accountPageUrl[section]); }; const onClickUploadId = () => { diff --git a/hosting-holium-com/src/pages/account/get-realm.tsx b/hosting-holium-com/src/pages/account/get-realm.tsx index 7f3653e8da..94ae3d239a 100644 --- a/hosting-holium-com/src/pages/account/get-realm.tsx +++ b/hosting-holium-com/src/pages/account/get-realm.tsx @@ -7,7 +7,7 @@ import { import { thirdEarthApi } from 'util/thirdEarthApi'; import { Page } from '../../components/Page'; -import { constants } from '../../util/constants'; +import { constants, getSupportEmail } from '../../util/constants'; import { accountPageUrl, useNavigation } from '../../util/useNavigation'; export const joinWaitlist = async (email: string) => { @@ -48,7 +48,9 @@ const GetRealmPresenter = () => { }; const onClickSidebarSection = (section: string) => { - if (section === 'Get Hosting') { + if (section === 'Contact Support') { + window.open(getSupportEmail(), '_blank'); + } else if (section === 'Get Hosting') { onClickPurchaseId(); } else { goToPage(accountPageUrl[section]); diff --git a/hosting-holium-com/src/pages/account/index.tsx b/hosting-holium-com/src/pages/account/index.tsx index 76013e3a65..b278771b4b 100644 --- a/hosting-holium-com/src/pages/account/index.tsx +++ b/hosting-holium-com/src/pages/account/index.tsx @@ -15,6 +15,8 @@ import { VerifyEmailModal, } from '@holium/shared'; +import { getSupportEmail } from 'util/constants'; + import { Page } from '../../components/Page'; import { thirdEarthApi } from '../../util/thirdEarthApi'; import { accountPageUrl, useNavigation } from '../../util/useNavigation'; @@ -49,7 +51,11 @@ const HostingPresenter = () => { }, [selectedShip]); const onClickSidebarSection = (section: string) => { - goToPage(accountPageUrl[section]); + if (section === 'Contact Support') { + window.open(getSupportEmail(selectedShip.patp), '_blank'); + } else { + goToPage(accountPageUrl[section]); + } }; const onSubmitNewEmail = async (email: string) => { diff --git a/hosting-holium-com/src/pages/account/storage.tsx b/hosting-holium-com/src/pages/account/storage.tsx index 8d236d7321..2a9530f518 100644 --- a/hosting-holium-com/src/pages/account/storage.tsx +++ b/hosting-holium-com/src/pages/account/storage.tsx @@ -7,6 +7,8 @@ import { useUser, } from '@holium/shared'; +import { getSupportEmail } from 'util/constants'; + import { Page } from '../../components/Page'; import { thirdEarthApi } from '../../util/thirdEarthApi'; import { accountPageUrl, useNavigation } from '../../util/useNavigation'; @@ -24,7 +26,12 @@ const S3StoragePresenter = () => { const [minioUsage, setMinioUsage] = useState(0); const onClickSidebarSection = (section: string) => { - goToPage(accountPageUrl[section]); + if (section === 'Contact Support') { + const ship = ships.find((ship) => ship.id === selectedShipId); + window.open(getSupportEmail(ship?.patp), '_blank'); + } else { + goToPage(accountPageUrl[section]); + } }; const onClickUploadId = () => { diff --git a/hosting-holium-com/src/util/constants.ts b/hosting-holium-com/src/util/constants.ts index 367a9e0de9..1960075a0f 100644 --- a/hosting-holium-com/src/util/constants.ts +++ b/hosting-holium-com/src/util/constants.ts @@ -17,3 +17,8 @@ export const downloadLinks = { windows: 'https://download.holium.com/latest/windows', linux: 'https://download.holium.com/latest/linux', }; + +export const getSupportEmail = (patp?: string) => + `mailto:support@holium.com?subject=Hosting Support${ + patp ? ` for ${patp}` : '' + }&body=A picture is worth a thousand words. Please attach any screenshots that may help us understand your issue.`; diff --git a/shared/src/onboarding/components/AccountDialog.tsx b/shared/src/onboarding/components/AccountDialog.tsx index 22038f3f32..eacaa27c67 100644 --- a/shared/src/onboarding/components/AccountDialog.tsx +++ b/shared/src/onboarding/components/AccountDialog.tsx @@ -30,6 +30,7 @@ export enum SidebarSection { DownloadRealm = 'Download Realm', GetHosting = 'Get Hosting', GetRealm = 'Get Realm', + ContactSupport = 'Contact Support', } type Props = { @@ -77,9 +78,10 @@ export const AccountDialog = ({ SidebarSection.Hosting, SidebarSection.CustomDomain, SidebarSection.DownloadRealm, + SidebarSection.ContactSupport, ]; } else { - sidebarItems = [SidebarSection.Hosting]; + sidebarItems = [SidebarSection.Hosting, SidebarSection.ContactSupport]; } } else { sidebarItems = [ @@ -87,12 +89,21 @@ export const AccountDialog = ({ SidebarSection.Storage, SidebarSection.CustomDomain, SidebarSection.DownloadRealm, + SidebarSection.ContactSupport, ]; } } else if (hasCSEK.isOn) { - sidebarItems = [SidebarSection.DownloadRealm, SidebarSection.GetHosting]; + sidebarItems = [ + SidebarSection.DownloadRealm, + SidebarSection.GetHosting, + SidebarSection.ContactSupport, + ]; } else { - sidebarItems = [SidebarSection.GetRealm, SidebarSection.GetHosting]; + sidebarItems = [ + SidebarSection.GetRealm, + SidebarSection.GetHosting, + SidebarSection.ContactSupport, + ]; } useEffect(() => {