From a77a15056a10abda23a3b33c43bae83670aa5e64 Mon Sep 17 00:00:00 2001 From: Alex Johansson Date: Mon, 23 Aug 2021 14:45:25 +0200 Subject: [PATCH] ` + {EndIcon && } + ); -} + return props.href ? ( + + {element} + + ) : ( + element + ); +}; diff --git a/lib/classNames.ts b/lib/classNames.ts index 5cf822d5..fa17f266 100644 --- a/lib/classNames.ts +++ b/lib/classNames.ts @@ -1,3 +1,3 @@ -export default function classNames(...classes) { +export default function classNames(...classes: unknown[]) { return classes.filter(Boolean).join(" "); } diff --git a/package.json b/package.json index 141e0926..80c540a9 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "lodash.debounce": "^4.0.8", "lodash.merge": "^4.6.2", "lodash.throttle": "^4.1.1", - "next": "^10.2.0", + "next": "^10.2.3", "next-auth": "^3.28.0", "next-transpile-modules": "^8.0.0", "nodemailer": "^6.6.3", diff --git a/pages/event-types/index.tsx b/pages/event-types/index.tsx index 2553040a..97d33db3 100644 --- a/pages/event-types/index.tsx +++ b/pages/event-types/index.tsx @@ -1,6 +1,7 @@ -import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@components/Dialog"; -import { Tooltip } from "@components/Tooltip"; +import { Dialog, DialogClose, DialogContent } from "@components/Dialog"; import Loader from "@components/Loader"; +import { Tooltip } from "@components/Tooltip"; +import { Button } from "@components/ui/Button"; import { Menu, Transition } from "@headlessui/react"; import { ClockIcon, @@ -12,6 +13,7 @@ import { UserIcon, } from "@heroicons/react/solid"; import classNames from "@lib/classNames"; +import showToast from "@lib/notification"; import { getSession, useSession } from "next-auth/client"; import Head from "next/head"; import Link from "next/link"; @@ -19,7 +21,6 @@ import { useRouter } from "next/router"; import React, { Fragment, useRef } from "react"; import Shell from "../../components/Shell"; import prisma from "../../lib/prisma"; -import showToast from "@lib/notification"; export default function Availability({ user, types }) { const [session, loading] = useSession(); @@ -30,6 +31,8 @@ export default function Availability({ user, types }) { const descriptionRef = useRef(); const lengthRef = useRef(); + const dialogOpen = router.query.new === "1"; + async function createEventTypeHandler(event) { event.preventDefault(); @@ -69,14 +72,23 @@ export default function Availability({ user, types }) { } const CreateNewEventDialog = () => ( - - - + { + const newQuery = { + ...router.query, + }; + delete newQuery["new"]; + if (!isOpen) { + router.push({ pathname: router.pathname, query: newQuery }); + } + }}> +
-
@@ -97,7 +109,7 @@ export default function Availability({ user, types }) { name="title" id="title" required - className="shadow-sm focus:ring-neutral-900 focus:border-neutral-900 block w-full sm:text-sm border-gray-300 rounded-sm" + className="block w-full border-gray-300 rounded-sm shadow-sm focus:border-neutral-900 focus:ring-neutral-900 sm:text-sm" placeholder="Quick Chat" />
@@ -108,7 +120,7 @@ export default function Availability({ user, types }) {
- + {location.hostname}/{user.username}/
@@ -131,7 +143,7 @@ export default function Availability({ user, types }) { ref={descriptionRef} name="description" id="description" - className="shadow-sm focus:ring-neutral-900 focus:border-neutral-900 block w-full sm:text-sm border-gray-300 rounded-sm" + className="block w-full border-gray-300 rounded-sm shadow-sm focus:border-neutral-900 focus:ring-neutral-900 sm:text-sm" placeholder="A quick video meeting.">
@@ -139,17 +151,17 @@ export default function Availability({ user, types }) { -
+
-
+
minutes
@@ -159,7 +171,7 @@ export default function Availability({ user, types }) { - + Cancel
@@ -178,44 +190,44 @@ export default function Availability({ user, types }) { heading="Event Types" subtitle="Create events to share for people to book on your calendar." CTA={types.length !== 0 && }> -
+
    {types.map((type) => (
  • -
    +
    - - + +
    -

    {type.title}

    +

    {type.title}

    {type.hidden && ( - + Hidden )}
    -
    +
    -
    -
    +
    +
    - + className="p-2 border border-transparent cursor-pointer group text-neutral-400 hover:border-gray-200"> + @@ -244,20 +256,20 @@ export default function Availability({ user, types }) { window.location.hostname + "/" + session.user.username + "/" + type.slug ); }} - className="group text-neutral-400 p-2 border border-transparent hover:border-gray-200"> - + className="p-2 border border-transparent group text-neutral-400 hover:border-gray-200"> +
    -
    +
    {({ open }) => ( <>
    - + Open options -
    @@ -272,7 +284,7 @@ export default function Availability({ user, types }) { leaveTo="transform opacity-0 scale-95"> + className="absolute right-0 w-56 mt-2 origin-top-right bg-white divide-y rounded-sm shadow-lg focus:outline-none divide-neutral-100 ring-1 ring-black ring-opacity-5">
    {({ active }) => ( @@ -285,7 +297,7 @@ export default function Availability({ user, types }) { "group flex items-center px-4 py-2 text-sm font-medium" )}>