From 787d5840d2f59bb6c3a4fcec754d45665f4a03cb Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Mon, 15 Aug 2022 19:32:02 +0200 Subject: [PATCH] chore: hide discovery button if not pointing to Revolt --- external/components | 2 +- external/lang | 2 +- .../navigation/left/ServerListSidebar.tsx | 4 ++ src/pages/login/forms/Form.tsx | 37 +++++++++---------- src/version.ts | 5 +++ 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/external/components b/external/components index 8cdba8de..decc9ab0 160000 --- a/external/components +++ b/external/components @@ -1 +1 @@ -Subproject commit 8cdba8ded56d3c1a84d50330b58d71f74ea698bf +Subproject commit decc9ab0e6522c447195f3221e52e01dd327a98f diff --git a/external/lang b/external/lang index bec6b0be..ab6e4e9a 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit bec6b0be505fdf89f15d0174391914cd73e14dc1 +Subproject commit ab6e4e9a9b6260422265533867f01e58659f1576 diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx index b9189b23..5bf487f2 100644 --- a/src/components/navigation/left/ServerListSidebar.tsx +++ b/src/components/navigation/left/ServerListSidebar.tsx @@ -9,6 +9,7 @@ import { useApplicationState } from "../../../mobx/State"; import { useClient } from "../../../controllers/client/ClientController"; import { modalController } from "../../../controllers/modals/ModalController"; +import { IS_REVOLT } from "../../../version"; /** * Server list sidebar shim component @@ -26,6 +27,8 @@ export default observer(() => { [], ); + console.info("is_revolt", IS_REVOLT); + return ( { home={state.layout.getLastHomePath} servers={state.ordering.orderedServers} reorder={state.ordering.reorderServer} + showDiscovery={IS_REVOLT} /> ); }); diff --git a/src/pages/login/forms/Form.tsx b/src/pages/login/forms/Form.tsx index 630a1155..7b4e7758 100644 --- a/src/pages/login/forms/Form.tsx +++ b/src/pages/login/forms/Form.tsx @@ -14,6 +14,7 @@ import WaveSVG from "../../settings/assets/wave.svg"; import { clientController } from "../../../controllers/client/ClientController"; import { takeError } from "../../../controllers/client/jsx/error"; +import { IS_REVOLT } from "../../../version"; import FormField from "../FormField"; import { CaptchaBlock, CaptchaProps } from "./CaptchaBlock"; import { MailProvider } from "./MailProvider"; @@ -247,25 +248,23 @@ export const Form = observer(({ page, callback }: Props) => { - {import.meta.env.VITE_API_URL && - import.meta.env.VITE_API_URL != - "https://api.revolt.chat" && ( - <> -
- - - {" "} - - - - - - - )} + {!IS_REVOLT && ( + <> +
+ + + {" "} + + + + + + + )} )} {(page === "reset" || diff --git a/src/version.ts b/src/version.ts index 63b6810d..26c08f2f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1,6 @@ export const APP_VERSION = "__APP_VERSION__"; +export const IS_REVOLT = + import.meta.env.VITE_API_URL === "https://api.revolt.chat" || + // future proofing + import.meta.env.VITE_API_URL === "https://app.revolt.chat/api" || + import.meta.env.VITE_API_URL === "https://revolt.chat/api";