From ef6ed6050be7048bb18901b675f52aa86fff6116 Mon Sep 17 00:00:00 2001 From: Nafees Nazik <84864519+G3root@users.noreply.github.com> Date: Tue, 26 Jul 2022 13:57:57 +0530 Subject: [PATCH] Feat: Add next-themes for theme handling (#3263) * chore: add next-themes * feat: add next theme provider * fix: modify useTheme hook to use next-themes * fix: use the new hook for theming * remove conditional rendering with isReady boolean flag * remove Theme component returned from useTheme hook * Update missing useTheme usage * Fix theme switching as per system. Also, ensure that booking and non booking pages can maintain their own requirements of theme simulatenously Co-authored-by: Peer Richelsen Co-authored-by: zomars Co-authored-by: Alex van Andel Co-authored-by: Hariom Balhara --- apps/web/components/Shell.tsx | 6 +- apps/web/components/booking/CancelBooking.tsx | 156 ++-- .../booking/pages/AvailabilityPage.tsx | 3 +- .../components/booking/pages/BookingPage.tsx | 773 ++++++++-------- apps/web/ee/components/stripe/PaymentPage.tsx | 7 +- apps/web/lib/app-providers.tsx | 2 +- apps/web/lib/hooks/useTheme.tsx | 54 +- apps/web/package.json | 1 + apps/web/pages/[user].tsx | 4 +- apps/web/pages/[user]/[type].tsx | 2 + apps/web/pages/[user]/book.tsx | 2 + apps/web/pages/_app.tsx | 19 +- apps/web/pages/apps/[slug]/[...pages].tsx | 2 + apps/web/pages/d/[link]/[slug].tsx | 1 + apps/web/pages/d/[link]/book.tsx | 2 + apps/web/pages/success.tsx | 624 +++++++------ apps/web/pages/team/[slug].tsx | 82 +- apps/web/pages/team/[slug]/[type].tsx | 1 + apps/web/pages/team/[slug]/book.tsx | 2 + .../pages/routing-link/[...appPages].tsx | 2 + packages/ee/server/checkLicense.ts | 1 + yarn.lock | 870 +++++++++--------- 22 files changed, 1310 insertions(+), 1306 deletions(-) diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx index 1670320a0f..3e32ced9b4 100644 --- a/apps/web/components/Shell.tsx +++ b/apps/web/components/Shell.tsx @@ -1,18 +1,18 @@ import { SelectorIcon } from "@heroicons/react/outline"; -import { CollectionIcon } from "@heroicons/react/solid"; import { ArrowLeftIcon, CalendarIcon, ClockIcon, CogIcon, + CollectionIcon, ExternalLinkIcon, + LightningBoltIcon, LinkIcon, LogoutIcon, MapIcon, MoonIcon, - ViewGridIcon, QuestionMarkCircleIcon, - LightningBoltIcon, + ViewGridIcon, } from "@heroicons/react/solid"; import { UserPlan } from "@prisma/client"; import { SessionContextValue, signOut, useSession } from "next-auth/react"; diff --git a/apps/web/components/booking/CancelBooking.tsx b/apps/web/components/booking/CancelBooking.tsx index 1b26e67ca1..6e4cd6d99f 100644 --- a/apps/web/components/booking/CancelBooking.tsx +++ b/apps/web/components/booking/CancelBooking.tsx @@ -32,90 +32,86 @@ export default function CancelBooking(props: Props) { const [loading, setLoading] = useState(false); const telemetry = useTelemetry(); const [error, setError] = useState(booking ? null : t("booking_already_cancelled")); - const { isReady, Theme } = useTheme(props.theme); + useTheme(props.theme); - if (isReady) { - return ( - <> - - {error && ( -
-
- -
-
- -
+ return ( + <> + {error && ( +
+
+
- )} - {!error && ( -
- -