From e9dd628c2aa6ae1cd134b41ff925425c892ddc40 Mon Sep 17 00:00:00 2001
From: Brandon Thomas
Date: Mon, 15 Apr 2024 20:29:35 -0400
Subject: [PATCH] dynamic discord links (fakeyou vs storyteller)
---
packages/components/src/elements/DiscordLink.tsx | 9 ++++++++-
.../components/src/elements/DiscordLink2.tsx | 16 ++++++++++++++--
packages/components/src/env/GetDiscordLink.ts | 11 +++++++++++
.../src/components/layout/SideNav/SideNav.tsx | 3 ++-
.../pages/contest/CommunityCommissionsPage.tsx | 3 ++-
.../pages/landing/fakeyou/FakeYouLandingBody.tsx | 3 ++-
packages/storyteller.io/src/common/Footer.tsx | 3 ++-
7 files changed, 41 insertions(+), 7 deletions(-)
create mode 100644 packages/components/src/env/GetDiscordLink.ts
diff --git a/packages/components/src/elements/DiscordLink.tsx b/packages/components/src/elements/DiscordLink.tsx
index 2c7911cc12..64a7afb43f 100644
--- a/packages/components/src/elements/DiscordLink.tsx
+++ b/packages/components/src/elements/DiscordLink.tsx
@@ -3,6 +3,7 @@ import { faDiscord } from "@fortawesome/free-brands-svg-icons";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { ThirdPartyLinks } from "../constants/ThirdPartyLinks";
+import { GetWebsite, Website } from "../env/GetWebsite";
interface Props {
text?: string;
@@ -10,6 +11,12 @@ interface Props {
}
function DiscordLink(props: Props) {
+ const website = GetWebsite();
+ const discordLink =
+ website.website === Website.FakeYou ?
+ ThirdPartyLinks.FAKEYOU_DISCORD :
+ ThirdPartyLinks.STORYTELLER_DISCORD;
+
const linkText = props.text === undefined ? "Discord" : props.text;
const iconAfterText = props.iconAfterText ? true : false;
const linkBody = iconAfterText ? (
@@ -25,7 +32,7 @@ function DiscordLink(props: Props) {
);
return (
diff --git a/packages/components/src/elements/DiscordLink2.tsx b/packages/components/src/elements/DiscordLink2.tsx
index a825c0483e..719509cea0 100644
--- a/packages/components/src/elements/DiscordLink2.tsx
+++ b/packages/components/src/elements/DiscordLink2.tsx
@@ -3,6 +3,7 @@ import { faDiscord } from "@fortawesome/free-brands-svg-icons";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { ThirdPartyLinks } from "../constants/ThirdPartyLinks";
+import { GetWebsite, Website } from "../env/GetWebsite";
interface Props {
hideIcon?: boolean;
@@ -18,7 +19,18 @@ function DiscordLink2(props: Props) {
const showIcon = !(props.hideIcon ? true : false);
const iconBeforeText = props.iconBeforeText ? true : false;
- const linkTitle = props.title ? props.title : "FakeYou Discord";
+ const website = GetWebsite();
+ const discordLink =
+ website.website === Website.FakeYou ?
+ ThirdPartyLinks.FAKEYOU_DISCORD :
+ ThirdPartyLinks.STORYTELLER_DISCORD;
+
+ const defaultTitle =
+ website.website === Website.FakeYou ?
+ "FakeYou Discord" :
+ "Storyteller Discord" ;
+
+ const linkTitle = props.title ? props.title : defaultTitle;
if (showIcon) {
linkBody = iconBeforeText ? (
@@ -36,7 +48,7 @@ function DiscordLink2(props: Props) {
return (
diff --git a/packages/components/src/env/GetDiscordLink.ts b/packages/components/src/env/GetDiscordLink.ts
new file mode 100644
index 0000000000..ce5073b7cd
--- /dev/null
+++ b/packages/components/src/env/GetDiscordLink.ts
@@ -0,0 +1,11 @@
+import { ThirdPartyLinks } from "../constants/ThirdPartyLinks";
+import { GetWebsite, Website } from "./GetWebsite";
+
+const DISCORD_LINK : string =
+ GetWebsite().website === Website.FakeYou ?
+ ThirdPartyLinks.FAKEYOU_DISCORD :
+ ThirdPartyLinks.STORYTELLER_DISCORD;
+
+export function GetDiscordLink() : string {
+ return DISCORD_LINK;
+}
diff --git a/packages/fakeyou.com/src/components/layout/SideNav/SideNav.tsx b/packages/fakeyou.com/src/components/layout/SideNav/SideNav.tsx
index 64201f0bc4..ecd33c04d0 100644
--- a/packages/fakeyou.com/src/components/layout/SideNav/SideNav.tsx
+++ b/packages/fakeyou.com/src/components/layout/SideNav/SideNav.tsx
@@ -25,6 +25,7 @@ import {
faFilm,
} from "@fortawesome/pro-solid-svg-icons";
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
+import { GetDiscordLink } from "@storyteller/components/src/env/GetDiscordLink";
import { FakeYouFrontendEnvironment } from "@storyteller/components/src/env/FakeYouFrontendEnvironment";
import { useInferenceJobs, useLocalize } from "hooks";
import { Logout } from "@storyteller/components/src/api/session/Logout";
@@ -479,7 +480,7 @@ export default function SideNav({
diff --git a/packages/fakeyou.com/src/v2/view/pages/contest/CommunityCommissionsPage.tsx b/packages/fakeyou.com/src/v2/view/pages/contest/CommunityCommissionsPage.tsx
index 5dfb8f466f..51eb30d35b 100644
--- a/packages/fakeyou.com/src/v2/view/pages/contest/CommunityCommissionsPage.tsx
+++ b/packages/fakeyou.com/src/v2/view/pages/contest/CommunityCommissionsPage.tsx
@@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faWaveformLines } from "@fortawesome/pro-solid-svg-icons";
import { faDiscord } from "@fortawesome/free-brands-svg-icons";
import { PosthogClient } from "@storyteller/components/src/analytics/PosthogClient";
+import { GetDiscordLink } from "@storyteller/components/src/env/GetDiscordLink";
interface Props {}
@@ -51,7 +52,7 @@ function CommunityCommissionsPage(props: Props) {
Upload Voice Model
{t("communityText")}