Scheduling infrastructure for absolutely everyone.
Make cal.com version available on all pages, even on login page. (#6221)
Hariom Balhara33530ad8c85f
diff --git a/apps/web/components/ui/AuthContainer.tsx b/apps/web/components/ui/AuthContainer.tsxindex b3e257efd5f..241f77946a3 100644--- a/apps/web/components/ui/AuthContainer.tsx+++ b/apps/web/components/ui/AuthContainer.tsx@@ -1,7 +1,7 @@import classNames from "classnames";import React from "react";-import { APP_NAME, LOGO } from "@calcom/lib/constants";+import { APP_NAME, LOGO, COMPANY_NAME, CalComVersion } from "@calcom/lib/constants";import Loader from "@components/Loader";import { HeadSeo } from "@components/seo/head-seo";@@ -23,6 +23,7 @@ export default function AuthContainer(props: React.PropsWithChildren<Props>) {// eslint-disable-next-line @next/next/no-img-element<img className="mb-auto h-4" src={LOGO} alt={`${APP_NAME} Logo`} />)}+<div className={classNames(props.showLogo ? "text-center" : "", "sm:mx-auto sm:w-full sm:max-w-md")}>{props.heading && <h2 className="font-cal text-center text-3xl text-neutral-900">{props.heading}</h2>}</div>@@ -35,7 +36,12 @@ export default function AuthContainer(props: React.PropsWithChildren<Props>) {<div className="border-1 mx-2 rounded-md border-gray-200 bg-white px-4 py-10 sm:px-10">{props.children}</div>- <div className="mt-8 text-center text-sm text-neutral-600">{props.footerText}</div>+ <div className="mt-8 text-center text-sm text-neutral-600">+ {props.footerText}+ <small className="mx-3 mt-1 mb-2 hidden text-[0.5rem] opacity-50 lg:block">+ © {new Date().getFullYear()} {COMPANY_NAME} {CalComVersion}+ </small>+ </div></div></div>);diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsxindex d1dbe671ca7..07ef01a5b54 100644--- a/apps/web/pages/_app.tsx+++ b/apps/web/pages/_app.tsx@@ -5,6 +5,7 @@ import superjson from "superjson";import "@calcom/embed-core/src/embed-iframe";import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";+import { CalComVersion } from "@calcom/lib/constants";import { httpBatchLink } from "@calcom/trpc/client/links/httpBatchLink";import { httpLink } from "@calcom/trpc/client/links/httpLink";import { loggerLink } from "@calcom/trpc/client/links/loggerLink";@@ -32,7 +33,6 @@ function MyApp(props: AppProps) {}// Use the layout defined at the page level, if availableconst getLayout = Component.getLayout ?? ((page) => page);-return (<AppProviders {...props}><DefaultSeo {...seoConfig.defaultNextSeo} />@@ -44,6 +44,10 @@ function MyApp(props: AppProps) {<Head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /></Head>+ <Script+ id="calcom-version"+ dangerouslySetInnerHTML={{ __html: `window.CalComVersion = '${CalComVersion}'` }}+ />{getLayout(Component.requiresLicense ? (<LicenseRequired>diff --git a/packages/lib/constants.ts b/packages/lib/constants.tsindex 7a1fced0cb4..d9983ae5c7a 100644--- a/packages/lib/constants.ts+++ b/packages/lib/constants.ts@@ -1,3 +1,6 @@+/* TODO: Get this from endpoint */+import pkg from "@calcom/web/package.json";+const VERCEL_URL = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "";const RAILWAY_STATIC_URL = process.env.RAILWAY_STATIC_URL ? `https://${process.env.RAILWAY_STATIC_URL}` : "";const HEROKU_URL = process.env.HEROKU_APP_NAME ? `https://${process.env.HEROKU_APP_NAME}.herokuapp.com` : "";@@ -53,3 +56,7 @@ export const IS_STRIPE_ENABLED = !!();/** Self hosted shouldn't checkout when creating teams unless required */export const IS_TEAM_BILLING_ENABLED = IS_STRIPE_ENABLED && (!IS_SELF_HOSTED || HOSTED_CAL_FEATURES);++export const CalComVersion = `v.${pkg.version}-${+ process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? "h" : "sh"+}-${process.env.CALCOM_LICENSE_KEY === "" ? "ee" : "ce"}`;diff --git a/packages/lib/tsconfig.json b/packages/lib/tsconfig.jsonindex c35e0c6de3b..5f9a2362882 100644--- a/packages/lib/tsconfig.json+++ b/packages/lib/tsconfig.json@@ -1,7 +1,8 @@{"extends": "@calcom/tsconfig/base.json","compilerOptions": {- "target": "es5"+ "target": "es5",+ "resolveJsonModule": true},"include": [".", "../types/next-auth.d.ts"],"exclude": ["dist", "build", "node_modules"]diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsxindex b4cc27a26d9..8d188915cb0 100644--- a/packages/ui/v2/core/Shell.tsx+++ b/packages/ui/v2/core/Shell.tsx@@ -1,5 +1,4 @@import type { User } from "@prisma/client";-import noop from "lodash/noop";import { signOut, useSession } from "next-auth/react";import Link from "next/link";import { NextRouter, useRouter } from "next/router";@@ -19,15 +18,15 @@ import CustomBranding from "@calcom/lib/CustomBranding";import classNames from "@calcom/lib/classNames";import {APP_NAME,- COMPANY_NAME,DESKTOP_APP_LINK,JOIN_SLACK,ROADMAP,WEBAPP_URL,+ COMPANY_NAME,+ CalComVersion,} from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import useTheme from "@calcom/lib/hooks/useTheme";-import isCalcom from "@calcom/lib/isCalcom";import { trpc } from "@calcom/trpc/react";import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";import { SVGComponent } from "@calcom/types/SVGComponent";@@ -44,9 +43,6 @@ import {showToast,TimezoneChangeDialog,} from "../..";--/* TODO: Get this from endpoint */-import pkg from "../../../../apps/web/package.json";import ErrorBoundary from "../../ErrorBoundary";import { KBarContent, KBarRoot, KBarTrigger } from "../../Kbar";import Logo from "../../Logo";@@ -720,19 +716,6 @@ const MobileNavigationMoreItem: React.FC<{);};-function DeploymentInfo() {- return (- <small- style={{- fontSize: "0.5rem",- }}- className="mx-3 mt-1 mb-2 hidden opacity-50 lg:block">- © {new Date().getFullYear()} {COMPANY_NAME} v.{pkg.version + "-"}- {process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? "h" : "sh"}- </small>- );-}-function SideBarContainer() {const { status } = useSession();const router = useRouter();@@ -796,7 +779,9 @@ function SideBar() {<UserDropdown small /></span></div>- <DeploymentInfo />+ <small className="mx-3 mt-1 mb-2 hidden text-[0.5rem] opacity-50 lg:block">+ © {new Date().getFullYear()} {COMPANY_NAME} {CalComVersion}+ </small></div></aside></div>