Remove <Loader/> from app setup pages and team user availability view (#4931)

* remove loader from setup screens + zapier loading

* remove loader from team user availability

* create skeleton loader

* code clean up

* code clean up

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-10-10 17:31:16 -06:00
1 parent 0289e727ad
commit 47e496fded
6 files changed
+29 -18

No files matched your search

@@ -0,0 +1,15 @@
import { SkeletonContainer, SkeletonText } from "@calcom/ui";
function SkeletonLoader() {
return (
<SkeletonContainer>
<div className="mr-3">
<SkeletonText className="h-4 w-28" />
<SkeletonText className="mt-3 h-11 w-full" />
<SkeletonText className="mt-2 h-11 w-full" />
</div>
</SkeletonContainer>
);
}
export default SkeletonLoader;
@@ -3,9 +3,11 @@ import React from "react";
import { ITimezone } from "react-timezone-select";
import { Dayjs } from "@calcom/dayjs";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import getSlots from "@calcom/lib/slots";
import { trpc } from "@calcom/trpc/react";
import { Loader } from "@calcom/ui/v2";
import SkeletonLoader from "./SkeletonLoaderAvailabilityTimes";
interface Props {
teamId: number;
@@ -18,6 +20,8 @@ interface Props {
}
export default function TeamAvailabilityTimes(props: Props) {
const { t } = useLocale();
const { data, isLoading } = trpc.useQuery(
[
"viewer.teams.getMemberAvailability",
@@ -47,13 +51,13 @@ export default function TeamAvailabilityTimes(props: Props) {
return (
<div className={classNames("min-w-60 flex-grow pl-0", props.className)}>
{props.HeaderComponent}
{isLoading && times.length === 0 && <Loader />}
{isLoading && times.length === 0 && <SkeletonLoader />}
{!isLoading && times.length === 0 ? (
<div className="flex flex-col items-center justify-center pt-4">
<span className="text-sm text-gray-500">No Available slots</span>
<span className="text-sm text-gray-500">{t("no_available_slots")}</span>
</div>
) : (
<>{!isLoading && <p className="mb-3 text-sm text-gray-600">Time available</p>}</>
<>{!isLoading && <p className="mb-3 text-sm text-gray-600">{t("time_available")}</p>}</>
)}
<div className="max-h-[390px] overflow-scroll">
{times.map((time) => (
@@ -1,5 +1,4 @@
import { SkeletonAvatar, SkeletonContainer, SkeletonText } from "@calcom/ui";
import { Icon } from "@calcom/ui/Icon";
import { SkeletonContainer, SkeletonText } from "@calcom/ui";
function SkeletonLoader() {
return (