refactor: Show 404 page for new booker when event is not found. (#8946)
* CAL-1653: Show 404 page for new booker when event is not found. * Fixed slack icon color on 404 page --------- Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
8 files changed
+70
-71
No files matched your search
@@ -11,13 +11,13 @@ import { ToggleGroup } from "@calcom/ui";
|
||||
import { Calendar, Columns, Grid } from "@calcom/ui/components/icon";
|
||||
|
||||
import { AvailableTimeSlots } from "./components/AvailableTimeSlots";
|
||||
import { Away } from "./components/Away";
|
||||
import { BookEventForm } from "./components/BookEventForm";
|
||||
import { BookFormAsModal } from "./components/BookEventForm/BookFormAsModal";
|
||||
import { EventMeta } from "./components/EventMeta";
|
||||
import { LargeCalendar } from "./components/LargeCalendar";
|
||||
import { LargeViewHeader } from "./components/LargeViewHeader";
|
||||
import { BookerSection } from "./components/Section";
|
||||
import { Away, NotFound } from "./components/Unavailable";
|
||||
import { fadeInLeft, getBookerSizeClassNames, useBookerResizeAnimation } from "./config";
|
||||
import { useBookerStore, useInitializeBookerStore } from "./store";
|
||||
import type { BookerLayout, BookerProps } from "./types";
|
||||
@@ -92,6 +92,10 @@ const BookerComponent = ({
|
||||
}
|
||||
}, [layout]);
|
||||
|
||||
if (event.isSuccess && !event.data) {
|
||||
return <NotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{/*
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
export const Away = () => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<div className="h-screen">
|
||||
<main className="mx-auto max-w-3xl px-4 py-24">
|
||||
<div className="space-y-6" data-testid="event-types">
|
||||
<div className="border-brand overflow-hidden rounded-sm border">
|
||||
<div className="text-subtle p-8 text-center">
|
||||
<h2 className="font-cal text-subtle mb-2 text-3xl">😴{" " + t("user_away")}</h2>
|
||||
<p className="mx-auto max-w-md">{t("user_away_description")}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
const UnAvailableMessage = ({ children, title }: { children: React.ReactNode; title: string }) => (
|
||||
<div className="mx-auto w-full max-w-2xl">
|
||||
<div className="bg-muted border-subtle overflow-hidden rounded-lg border p-10">
|
||||
<h2 className="font-cal mb-4 text-3xl">{title}</h2>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const Away = () => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<UnAvailableMessage title={`😴 ${t("user_away")}`}>
|
||||
<p className="max-w-[50ch]">{t("user_away_description")}</p>
|
||||
</UnAvailableMessage>
|
||||
);
|
||||
};
|
||||
|
||||
export const NotFound = () => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<UnAvailableMessage title={t("404_page_not_found")}>
|
||||
<p className="max-w-[50ch]">{t("booker_event_not_found")}</p>
|
||||
</UnAvailableMessage>
|
||||
);
|
||||
};
|
||||
@@ -124,6 +124,8 @@ export const useBookerResizeAnimation = (layout: BookerLayout, state: BookerStat
|
||||
useEffect(() => {
|
||||
const animationConfig = resizeAnimationConfig[layout][state] || resizeAnimationConfig[layout].default;
|
||||
|
||||
if (!animationScope.current) return;
|
||||
|
||||
const animatedProperties = {
|
||||
height: animationConfig?.height || "auto",
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user