Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve] Add login button to disabled pages #77

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/web/components/booking/pages/AvailabilityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useAutoAnimate } from "@formkit/auto-animate/react";
import { EventType } from "@prisma/client";
import * as Popover from "@radix-ui/react-popover";
import { useSession } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
import type { NextRouter } from "next/router";
import { useReducer, useEffect, useMemo, useState } from "react";
Expand Down Expand Up @@ -33,6 +34,7 @@ import { detectBrowserTimeFormat, setIs24hClockInLocalStorage, TimeFormat } from
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
import { trpc } from "@calcom/trpc/react";
import { HeadSeo } from "@calcom/ui";
import { Button } from "@calcom/ui";
import { FiChevronDown, FiChevronUp, FiCreditCard, FiGlobe, FiRefreshCcw } from "@calcom/ui/components/icon";

import { timeZone as localStorageTimeZone } from "@lib/clock";
Expand Down Expand Up @@ -379,9 +381,11 @@ const AvailabilityPage = ({ profile, eventType, ...restProps }: Props) => {
// Only logged in users can see this page when it's not embedded.
if (!isEmbed && !session?.user?.id) {
return (
<p className="text-center">
{t("disabled")}. {t("contact_support")}.
</p>
<div className="mt-4 text-center">
<Link href="/auth/login" passHref legacyBehavior>
<Button>{t("login")}</Button>
</Link>
</div>
);
}

Expand Down
9 changes: 6 additions & 3 deletions apps/web/components/booking/pages/BookingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import { isValidPhoneNumber } from "libphonenumber-js";
import { useSession } from "next-auth/react";
import Head from "next/head";
import Link from "next/link";
import { useRouter } from "next/router";
import { useEffect, useMemo, useReducer, useState } from "react";
import { useFieldArray, useForm, useWatch, Controller } from "react-hook-form";

Check warning on line 10 in apps/web/components/booking/pages/BookingPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/components/booking/pages/BookingPage.tsx#L10

[@typescript-eslint/no-unused-vars] 'Controller' is defined but never used.
import { FormattedNumber, IntlProvider } from "react-intl";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
Expand Down Expand Up @@ -203,7 +204,7 @@
useTheme(profile.theme);
const date = asStringOrNull(router.query.date);

const [guestToggle, setGuestToggle] = useState(booking && booking.attendees.length > 1);

Check warning on line 207 in apps/web/components/booking/pages/BookingPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/components/booking/pages/BookingPage.tsx#L207

[@typescript-eslint/no-unused-vars] 'guestToggle' is assigned a value but never used.
// it would be nice if Prisma at some point in the future allowed for Json<Location>; as of now this is not the case.
const locations: LocationObject[] = useMemo(
() => (eventType.locations as LocationObject[]) || [],
Expand Down Expand Up @@ -538,9 +539,11 @@
// Only logged in users can see this page when it's not embedded.
if (!isEmbed && !session?.user?.id) {
return (
<p className="text-center">
{t("disabled")}. {t("contact_support")}.
</p>
<div className="mt-4 text-center">
<Link href="/auth/login" passHref legacyBehavior>
<Button>{t("login")}</Button>
</Link>
</div>
);
}

Expand Down
Loading