Make cal.com version available on all pages, even on login page. (#6221)

* Make cal.com version available on all pages, even on login page.

* Extract out calcom version as a utility

* added version to login screen

* added ee and ce to version

* fixed lint

* Fix import

* removed  version info component

Co-authored-by: Peer Richelsen <peer@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/6233/head^2
Hariom Balhara 2023-01-02 20:24:35 +05:30 committed by GitHub
parent fe14839f1b
commit 33530ad8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 24 deletions

View File

@ -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">
&copy; {new Date().getFullYear()} {COMPANY_NAME} {CalComVersion}
</small>
</div>
</div>
</div>
);

View File

@ -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 available
const 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>

View File

@ -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"}`;

View File

@ -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"]

View File

@ -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">
&copy; {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">
&copy; {new Date().getFullYear()} {COMPANY_NAME} {CalComVersion}
</small>
</div>
</aside>
</div>