Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | 61x 61x 352x 352x 352x 352x 49x 303x 278x 229x 229x 7x 222x 2x 220x 220x 220x 160x 54x 61x 2x 61x 61x 61x 7x 61x 49x 61x 54x 61x 61x 61x 61x 60x 61x 106x 530x 1060x | import TransactionFeeSkeleton from "@features/TransactionPanel/components/TransactionFeeSkeleton";
import TransactionHistorySkeleton from "@features/TransactionPanel/components/TransactionHistorySkeleton";
import { Skeleton, SkeletonOwnProps, Stack } from "@mui/material";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import TransactionSkeleton from "features/TransactionPanel/components/TransactionSkeleton";
const skeletonDefaultProps: SkeletonOwnProps = {
sx: { borderRadius: "16px" },
variant: "rectangular",
};
export interface IPanelLoadingSkeletonProps {
variant?:
| "default"
| "underwriting"
| "invite_sent"
| "merchant_file"
| "transaction"
| "transaction_fee"
| "transaction_history"
| "customer"
| "provider"
| "export"
| "dispute"
| "title"
| "card";
}
interface TypeComponentsProps {
isMobileView: boolean;
}
const PanelLoadingSkeleton = ({
variant = "default",
}: IPanelLoadingSkeletonProps) => {
const { isMobileView } = useCustomThemeV2();
Iif (variant === "invite_sent")
return <InviteSentSkeletonVariant isMobileView={isMobileView} />;
Iif (variant === "merchant_file") return <MerchantFileSkeleton />;
if (variant === "underwriting")
return <UnderwritingSkeleton isMobileView={isMobileView} />;
if (variant === "transaction") return <TransactionSkeleton />;
if (variant === "transaction_history") return <TransactionHistorySkeleton />;
Iif (variant === "transaction_fee") return <TransactionFeeSkeleton />;
if (variant === "customer")
return <CustomerSkeleton isMobileView={isMobileView} />;
if (variant === "provider")
return <ProviderSkeleton isMobileView={isMobileView} />;
Iif (variant === "export") return <ExportSkeleton />;
Iif (variant === "dispute") return <DisputePanelSkeleton />;
if (variant === "title") return <TitleSkeleton />;
if (variant === "card") return <CardSkeletonVariant />;
return <BaseSkeletonVariant isMobileView={isMobileView} />;
};
const ProviderSkeleton = ({ isMobileView }: TypeComponentsProps) => {
return (
<Stack gap={4}>
<Skeleton height={250} width="100%" {...skeletonDefaultProps} />
<Stack gap={2}>
<Skeleton height={40} width={283} {...skeletonDefaultProps} />
<Skeleton height={250} width="100%" {...skeletonDefaultProps} />
</Stack>
<Skeleton
height={isMobileView ? 176 : 448}
width="100%"
{...skeletonDefaultProps}
/>
</Stack>
);
};
const ProfileSectionSkeleton = () => {
return (
<Stack direction="row" gap={3}>
<Stack gap={2} flex={1}>
<Skeleton height={25} width="100%" {...skeletonDefaultProps} />
<Stack direction="row" gap={2}>
<Skeleton height={25} width="50%" {...skeletonDefaultProps} />
<Skeleton height={25} width="50%" {...skeletonDefaultProps} />
</Stack>
</Stack>
<Skeleton
height={66}
width="10%"
{...skeletonDefaultProps}
sx={{ ...skeletonDefaultProps.sx, minWidth: "72px" }}
/>
</Stack>
);
};
const MerchantFileSkeleton = () => {
return (
<Stack gap={2} flex={1} padding="40px 20px">
<ProfileSectionSkeleton />
<Skeleton height="40px" width="280px" {...skeletonDefaultProps} />
<Skeleton height="40px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="350px" width="100%" {...skeletonDefaultProps} />
</Stack>
);
};
const CustomerSkeleton = ({ isMobileView }: TypeComponentsProps) => {
return (
<>
<Stack direction="row" gap={3}>
<Stack gap={2} flex={1}>
<Skeleton height={25} width="100%" {...skeletonDefaultProps} />
<Stack
direction={isMobileView ? "column" : "row"}
gap={2}
width="60%"
>
<Skeleton
height={25}
width={isMobileView ? "100%" : "50%"}
{...skeletonDefaultProps}
/>
<Skeleton
height={25}
width={isMobileView ? "100%" : "50%"}
{...skeletonDefaultProps}
/>
</Stack>
</Stack>
<Skeleton
height={66}
width="10%"
{...skeletonDefaultProps}
sx={{
minWidth: "72px",
borderRadius: "50px",
}}
/>
</Stack>
<Skeleton height="420px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="420px" width="100%" {...skeletonDefaultProps} />
</>
);
};
const UnderwritingSkeleton = ({ isMobileView }: TypeComponentsProps) => {
return (
<Stack gap={4} flex={1}>
<Skeleton
height={isMobileView ? "350px" : "250px"}
width="100%"
{...skeletonDefaultProps}
/>
<Stack gap={2}>
<Skeleton
height="40px"
width={isMobileView ? "80%" : "50%"}
{...skeletonDefaultProps}
/>
<Skeleton
height={isMobileView ? "350px" : "250px"}
width="100%"
{...skeletonDefaultProps}
/>
</Stack>
<Skeleton
height={isMobileView ? "72px" : "176px"}
width="100%"
{...skeletonDefaultProps}
/>
</Stack>
);
};
const BaseSkeletonVariant = ({ isMobileView }: TypeComponentsProps) => {
return (
<Stack gap={4} flex={1}>
<Skeleton
height={isMobileView ? "422px" : "362px"}
width="100%"
{...skeletonDefaultProps}
/>
<Stack gap={2}>
<Skeleton
height="40px"
width={isMobileView ? "80%" : "50%"}
{...skeletonDefaultProps}
/>
<Skeleton
height={isMobileView ? "286px" : "296px"}
width="100%"
{...skeletonDefaultProps}
/>
</Stack>
</Stack>
);
};
const InviteSentSkeletonVariant = ({ isMobileView }: TypeComponentsProps) => {
return (
<Stack gap={4} flex={1}>
<Skeleton
height={isMobileView ? "300px" : "212px"}
width="100%"
{...skeletonDefaultProps}
/>
<Stack gap={2}>
<Skeleton
height="40px"
width={isMobileView ? "80%" : "50%"}
{...skeletonDefaultProps}
/>
<Skeleton height="126px" width="100%" {...skeletonDefaultProps} />
</Stack>
</Stack>
);
};
const ExportSkeleton = () => {
return (
<Stack p="32px 20px" gap="24px">
<Skeleton height="88px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="288px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="88px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="88px" width="100%" {...skeletonDefaultProps} />
<Skeleton height="88px" width="100%" {...skeletonDefaultProps} />
</Stack>
);
};
const DisputePanelSkeleton = () => {
return (
<Stack p="20px" gap="20px">
{[...Array(7)].map((_, i) => (
<Skeleton
key={i}
height="200px"
width="100%"
{...skeletonDefaultProps}
/>
))}
</Stack>
);
};
const TitleSkeleton = () => {
return (
<Stack
flexDirection="row"
justifyContent="space-between"
alignItems="start"
maxWidth="100%"
gap={1}
>
<Stack flexShrink={1} overflow="hidden" gap="16px">
<Stack display="flex" flexDirection="row" gap="16px">
<Skeleton
variant="rectangular"
width={240}
height={24}
sx={{ borderRadius: "50px" }}
/>
<Skeleton
variant="rectangular"
width={60}
height={24}
sx={{ borderRadius: "50px" }}
/>
</Stack>
<Skeleton
variant="rectangular"
width={160}
height={20}
sx={{ borderRadius: "8px" }}
/>
</Stack>
<Skeleton
variant="rectangular"
width={72}
height={72}
sx={{ borderRadius: "16px" }}
/>
</Stack>
);
};
const CardSkeletonVariant = () => {
return (
<Stack
sx={{
display: "flex",
flexDirection: "column",
gap: "16px",
}}
data-testid="card-skeleton"
>
{Array.from({ length: 5 }).map((_, rowIndex) => (
<Stack
key={rowIndex}
sx={{
display: "grid",
gridTemplateColumns: "repeat(2, 1fr)",
gap: "16px",
}}
>
{Array.from({ length: 2 }).map((_, colIndex) => (
<Skeleton
key={colIndex}
variant="rectangular"
height={20}
sx={{
borderRadius: "8px",
width: "100%",
}}
/>
))}
</Stack>
))}
</Stack>
);
};
export default PanelLoadingSkeleton;
|