Fix flash of untranslated content by adding inline Skeleton Loaders on EventType (#4519)

* Add support for easy use of inline skeleton

* Fix user being taken to /v2 path

* Fixes

* Fix TS

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Hariom BalharaandPeer Richelsen authored and GitHub committed 2022-09-21 16:01:47 +00:00
1 parent 42c128b790
commit 631e974769
6 files changed
+112 -30

No files matched your search

@@ -19,6 +19,7 @@ import {
DialogContent,
Label,
showToast,
Skeleton,
Switch,
TextField,
Tooltip,
@@ -37,7 +38,6 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
const connectedCalendarsQuery = trpc.useQuery(["viewer.connectedCalendars"]);
const formMethods = useFormContext<FormValues>();
const { t } = useLocale();
const utils = trpc.useContext();
const [showEventNameTip, setShowEventNameTip] = useState(false);
const [hashedLinkVisible, setHashedLinkVisible] = useState(!!eventType.hashedLink);
const [hashedUrl, setHashedUrl] = useState(eventType.hashedLink?.link);
@@ -138,8 +138,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
}}
/>
<div className="flex flex-col">
<Label className="text-sm font-semibold leading-none text-black">{t("additional_inputs")}</Label>
<p className="-mt-2 text-sm leading-normal text-gray-600">{t("additional_input_description")}</p>
<Skeleton as={Label} className="text-sm font-semibold leading-none text-black">
{t("additional_inputs")}
</Skeleton>
<Skeleton as="p" className="-mt-2 text-sm leading-normal text-gray-600">
{t("additional_input_description")}
</Skeleton>
</div>
</div>
<ul className="my-4" ref={animationRef}>
@@ -184,12 +188,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
fitToHeight={true}
/>
<div className="flex flex-col">
<Label className="text-sm font-semibold leading-none text-black">
<Skeleton as={Label} className="text-sm font-semibold leading-none text-black">
{t("requires_confirmation")}
</Label>
<p className="-mt-2 text-sm leading-normal text-gray-600">
</Skeleton>
<Skeleton as="p" className="-mt-2 text-sm leading-normal text-gray-600">
{t("requires_confirmation_description")}
</p>
</Skeleton>
</div>
</div>
)}
@@ -209,8 +213,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
disabled={seatsEnabled}
/>
<div className="flex flex-col">
<Label className="text-sm font-semibold leading-none text-black">{t("disable_guests")}</Label>
<p className="-mt-2 text-sm leading-normal text-gray-600">{t("disable_guests_description")}</p>
<Skeleton as={Label} className="text-sm font-semibold leading-none text-black">
{t("disable_guests")}
</Skeleton>
<Skeleton as="p" className="-mt-2 text-sm leading-normal text-gray-600">
{t("disable_guests_description")}
</Skeleton>
</div>
</div>
)}
@@ -230,8 +238,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
onCheckedChange={(e) => onChange(e)}
/>
<div className="flex flex-col">
<Label className="text-sm font-semibold leading-none text-black">{t("disable_notes")}</Label>
<p className="-mt-2 text-sm leading-normal text-gray-600">{t("disable_notes_description")}</p>
<Skeleton as={Label} className="text-sm font-semibold leading-none text-black">
{t("disable_notes")}
</Skeleton>
<Skeleton as="p" className="-mt-2 text-sm leading-normal text-gray-600">
{t("disable_notes_description")}
</Skeleton>
</div>
</div>
)}
@@ -255,8 +267,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
}}
/>
<div className="flex flex-col">
<Label className="text-sm font-semibold leading-none text-black">{t("private_link")}</Label>
<p className="-mt-2 text-sm leading-normal text-gray-600">{t("private_link_description")}</p>
<Skeleton as={Label} className="text-sm font-semibold leading-none text-black">
{t("private_link")}
</Skeleton>
<Skeleton as="p" className="-mt-2 text-sm leading-normal text-gray-600">
{t("private_link_description")}
</Skeleton>
</div>
</div>
@@ -10,7 +10,7 @@ import { getEventLocationType, EventLocationType } from "@calcom/app-store/locat
import { CAL_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Icon } from "@calcom/ui/Icon";
import { Select, Label, TextField, Button } from "@calcom/ui/v2";
import { Select, Label, TextField, Button, Skeleton } from "@calcom/ui/v2";
import { slugify } from "@lib/slugify";
@@ -222,7 +222,9 @@ export const EventSetupTab = (
}}
/>
<div>
<Label>{t("location")}</Label>
<Skeleton as={Label} loadingClassName="w-16">
{t("location")}
</Skeleton>
<Controller
name="locations"
control={formMethods.control}
@@ -29,6 +29,7 @@ import Dropdown, {
} from "@calcom/ui/v2/core/Dropdown";
import Shell from "@calcom/ui/v2/core/Shell";
import VerticalDivider from "@calcom/ui/v2/core/VerticalDivider";
import { Skeleton } from "@calcom/ui/v2/core/skeleton";
import { ClientSuspense } from "@components/ClientSuspense";
import { EmbedButton, EmbedDialog } from "@components/Embed";
@@ -159,9 +160,12 @@ function EventTypeSingleLayout({
CTA={
<div className="flex items-center justify-end">
<div className="flex items-center rounded-md px-2 sm:hover:bg-gray-100">
<Label htmlFor="hiddenSwitch" className="mt-2 hidden cursor-pointer self-center pr-2 sm:inline">
<Skeleton
as={Label}
htmlFor="hiddenSwitch"
className="mt-2 hidden cursor-pointer self-center pr-2 sm:inline">
{t("hide_from_profile")}
</Label>
</Skeleton>
<Switch
id="hiddenSwitch"
defaultChecked={formMethods.getValues("hidden")}