From 00c9df7602d40e96fa87fca39926252b0fd7ee6d Mon Sep 17 00:00:00 2001 From: GitStart <1501599+gitstart@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:49:52 +0530 Subject: [PATCH] There is lot of hardcoding links in application (#3130) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * There is lot of hardcoding links in application * Apply suggestions from code review Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: gitstart Co-authored-by: Omar López Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> --- apps/docs/theme.config.js | 8 +++++--- apps/web/components/Logo.tsx | 11 ++++------ apps/web/components/Shell.tsx | 6 +++--- apps/web/components/ui/AuthContainer.tsx | 4 +++- apps/web/components/ui/PoweredByCal.tsx | 3 ++- apps/web/ee/components/stripe/PaymentPage.tsx | 3 ++- apps/web/lib/config/next-seo.config.ts | 6 ++++-- apps/web/pages/404.tsx | 20 ++++++++++--------- apps/web/pages/500.tsx | 3 ++- apps/web/pages/apps/installed.tsx | 3 ++- apps/web/pages/auth/logout.tsx | 3 ++- apps/web/pages/getting-started.tsx | 3 ++- apps/web/pages/success.tsx | 1 + apps/web/pages/video/[uid].tsx | 11 +++++----- packages/ee/lib/core/checkPremiumUsername.ts | 3 ++- packages/lib/constants.ts | 9 +++++++++ 16 files changed, 60 insertions(+), 37 deletions(-) diff --git a/apps/docs/theme.config.js b/apps/docs/theme.config.js index 935c26a76c..25857c7491 100644 --- a/apps/docs/theme.config.js +++ b/apps/docs/theme.config.js @@ -1,3 +1,5 @@ +import { SEO_IMG_DEFAULT, DOCS_URL } from "@calcom/lib/constants"; + const themeConfig = { github: "https://github.com/calcom/cal.com", docsRepositoryBase: "https://github.com/calcom/cal.com/blob/main/apps/docs/pages", @@ -18,11 +20,11 @@ const themeConfig = { content="Explore advice and explanations for all of our features, and discover new tips and tricks to get the most out of your subscription." /> - + - + - + diff --git a/apps/web/components/Logo.tsx b/apps/web/components/Logo.tsx index 08bc6632b2..1e4b31672a 100644 --- a/apps/web/components/Logo.tsx +++ b/apps/web/components/Logo.tsx @@ -1,18 +1,15 @@ +import { LOGO_ICON, LOGO } from "@calcom/lib/constants"; + export default function Logo({ small, icon }: { small?: boolean; icon?: boolean }) { return (

{icon ? ( // eslint-disable-next-line @next/next/no-img-element - Cal + Cal ) : ( // eslint-disable-next-line @next/next/no-img-element - Cal + Cal )}

diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx index 535b52f449..91cf7af903 100644 --- a/apps/web/components/Shell.tsx +++ b/apps/web/components/Shell.tsx @@ -20,6 +20,7 @@ import React, { Fragment, ReactNode, useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; import { useIsEmbed } from "@calcom/embed-core/embed-iframe"; +import { WEBAPP_URL, JOIN_SLACK, ROADMAP } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import Button from "@calcom/ui/Button"; import Dropdown, { @@ -34,7 +35,6 @@ import HelpMenuItem from "@ee/components/support/HelpMenuItem"; import ErrorBoundary from "@lib/ErrorBoundary"; import classNames from "@lib/classNames"; -import { WEBAPP_URL } from "@lib/config/constants"; import { shouldShowOnboarding } from "@lib/getting-started"; import useMeQuery from "@lib/hooks/useMeQuery"; import useTheme from "@lib/hooks/useTheme"; @@ -555,7 +555,7 @@ function UserDropdown({ small }: { small?: boolean }) { @@ -588,7 +588,7 @@ function UserDropdown({ small }: { small?: boolean }) { {t("visit_roadmap")} diff --git a/apps/web/components/ui/AuthContainer.tsx b/apps/web/components/ui/AuthContainer.tsx index d43f8048a9..d7baf8155f 100644 --- a/apps/web/components/ui/AuthContainer.tsx +++ b/apps/web/components/ui/AuthContainer.tsx @@ -1,6 +1,8 @@ import classNames from "classnames"; import React from "react"; +import { LOGO } from "@calcom/lib/constants"; + import Loader from "@components/Loader"; import { HeadSeo } from "@components/seo/head-seo"; @@ -20,7 +22,7 @@ export default function AuthContainer(props: React.PropsWithChildren) {
{props.showLogo && ( // eslint-disable-next-line @next/next/no-img-element - Cal.com Logo + Cal.com Logo )} {props.heading && (

{props.heading}

diff --git a/apps/web/components/ui/PoweredByCal.tsx b/apps/web/components/ui/PoweredByCal.tsx index dfaae3913f..0eeee55125 100644 --- a/apps/web/components/ui/PoweredByCal.tsx +++ b/apps/web/components/ui/PoweredByCal.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import { useIsEmbed } from "@calcom/embed-core/embed-iframe"; +import { POWERED_BY_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; const PoweredByCal = () => { @@ -8,7 +9,7 @@ const PoweredByCal = () => { const isEmbed = useIsEmbed(); return ( {!props.profile.hideBranding && ( )}
diff --git a/apps/web/lib/config/next-seo.config.ts b/apps/web/lib/config/next-seo.config.ts index 72b2cb7cd9..24f1167d5b 100644 --- a/apps/web/lib/config/next-seo.config.ts +++ b/apps/web/lib/config/next-seo.config.ts @@ -1,10 +1,12 @@ import { DefaultSeoProps } from "next-seo"; +import { SEO_IMG_DEFAULT, SEO_IMG_OGIMG } from "@calcom/lib/constants"; + import { HeadSeoProps } from "@components/seo/head-seo"; const seoImages = { - default: "https://cal.com/og-image.png", - ogImage: "https://og-image-one-pi.vercel.app/", + default: SEO_IMG_DEFAULT, + ogImage: SEO_IMG_OGIMG, }; export const getSeoImage = (key: keyof typeof seoImages): string => { diff --git a/apps/web/pages/404.tsx b/apps/web/pages/404.tsx index 8a4aa260c3..cfc4eaae02 100644 --- a/apps/web/pages/404.tsx +++ b/apps/web/pages/404.tsx @@ -5,6 +5,8 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; +import { DOCS_URL, JOIN_SLACK, WEBSITE_URL } from "@calcom/lib/constants"; + import { useLocale } from "@lib/hooks/useLocale"; import { HeadSeo } from "@components/seo/head-seo"; @@ -22,19 +24,19 @@ export default function Custom404() { title: t("documentation"), description: t("documentation_description"), icon: DocumentTextIcon, - href: "https://docs.cal.com", + href: DOCS_URL, }, { title: t("blog"), description: t("blog_description"), icon: BookOpenIcon, - href: "https://cal.com/blog", + href: `${WEBSITE_URL}/blog`, }, ]; - const [url, setUrl] = useState("https://cal.com/signup?username="); + const [url, setUrl] = useState(`${WEBSITE_URL}/signup?username=`); useEffect(() => { - setUrl(`https://cal.com/signup?username=${username.replace("/", "")}`); + setUrl(`${WEBSITE_URL}/signup?username=${username.replace("/", "")}`); }, [username]); const isSuccessPage = router.asPath.startsWith("/success"); @@ -72,7 +74,7 @@ export default function Custom404() {