All files / src/components/CustomSkeletons GiveMerchantInfoTabSkeleton.tsx

80% Statements 12/15
50% Branches 12/24
83.33% Functions 5/6
80% Lines 12/15

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                                  7x 7x 7x 7x   7x 7x           7x 7x                         7x                                                                                                                                                                                                                                     14x                                                               14x                   28x                                                                
import { Box, Skeleton, Stack } from "@mui/material";
import { ArrowLineUpIcon } from "@phosphor-icons/react";
import GiveLink from "@shared/Link/GiveLink";
import GiveTabs from "@shared/Tabs/GiveTabs";
import GiveText from "@shared/Text/GiveText";
import { MERCHANT_FILE_TEXT } from "@constants/stringConstants";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { useAppTheme } from "@theme/v2/Provider";
import { checkPortals } from "@utils/routing";
 
function GiveMerchantInfoTabSkeleton({
  isProvider,
  showWithTabs,
}: {
  isProvider?: boolean;
  showWithTabs?: boolean;
}) {
  const { isDesktopView, isMobileView, isTabletView } = useCustomThemeV2();
  const { palette } = useAppTheme();
  const { isAcquirerPortal, isEnterprisePortal } = checkPortals();
  const isMobileOrTablet = isMobileView || isTabletView;
 
  const tabList = ((): { label: string; value: string }[] => {
    Iif (isAcquirerPortal) {
      return [
        { label: "Acquirer Info", value: "Acquirer Info" },
        { label: "Business Profile", value: "Business Profile" },
      ];
    }
    Eif (isEnterprisePortal) {
      return [
        { label: "Provider Info", value: "Provider Info" },
        { label: "Business Profile", value: "Business Profile" },
        { label: "Documents", value: "Documents" },
      ];
    }
    return [
      { label: MERCHANT_FILE_TEXT, value: MERCHANT_FILE_TEXT },
      { label: "Business Profile", value: "Business Profile" },
      { label: "Documents", value: "Documents" },
    ];
  })();
 
  return (
    <Box
      width="100%"
      display="flex"
      flexDirection={"column"}
      gap={3.75}
    >
      {showWithTabs && (
        <Box sx={{ pointerEvents: "none", opacity: 0.55 }}>
          <GiveTabs
            {...(isMobileOrTablet
              ? {
                  type: "line",
                  variant: "underline",
                }
              : {
                  type: "segmented",
                  variant: undefined,
                })}
            items={tabList}
            selected={tabList[0]?.value}
            onClick={() => undefined}
            containerSx={{
              width: "100%",
              justifyContent: "space-around",
              paddingTop: isMobileOrTablet ? "24px" : undefined,
              overflowX: "auto",
              scrollbarWidth: "none",
            }}
            tabSx={{
              flex: 1,
              justifyContent: "center",
              "& div > div": {
                justifyContent: "center",
              },
            }}
          />
        </Box>
      )}
      {isProvider && (
        <Stack
          mt={4}
          pb={2}
          gap={1}
          borderBottom={`1px solid ${palette.primitive?.neutral[20]}`}
        >
          <Stack gap={2} direction={"row"} alignItems={"center"}>
            <GiveText color="primary" fontSize="18px">
              Account
            </GiveText>
            <Skeleton
              width={"120px"}
              sx={{
                borderRadius: "12px",
              }}
              variant="rounded"
              height="32px"
            />
          </Stack>
        </Stack>
      )}
      <GiveText variant="h6" fontWeight="regular" color="primary">
        General
      </GiveText>
      <Box
        padding={2}
        paddingLeft={0}
        display="flex"
        alignItems="center"
        mb={2}
        gap={2}
      >
        <Skeleton
          width="72px"
          sx={{
            borderRadius: "16px",
          }}
          variant="rounded"
          height="72px"
        />
        <GiveLink
          Icon={ArrowLineUpIcon}
          color="secondary"
          sx={{ alignItems: "center" }}
          link="#"
        >
          Upload Photo
        </GiveLink>
      </Box>
 
      <Skeleton
        width={isDesktopView ? "150px" : "100%"}
        sx={{
          borderRadius: "12px",
        }}
        variant="rounded"
        height="25px"
      />
      <Skeleton
        width="100%"
        sx={{
          borderRadius: "12px",
        }}
        variant="rounded"
        height="48px"
      />
      <Box
        display={"flex"}
        gap={3}
        flexDirection={isDesktopView ? "row" : "column"}
        width="100%"
      >
        {Array(2)
          .fill(null)
          .map((c, idx) => (
            <Box
              display={"flex"}
              key={idx}
              gap={3}
              flexDirection={"column"}
              width="100%"
            >
              <Skeleton
                width={isDesktopView ? "150px" : "100%"}
                sx={{
                  borderRadius: "12px",
                }}
                variant="rounded"
                height="25px"
              />
              <Skeleton
                width="100%"
                sx={{
                  borderRadius: "12px",
                }}
                variant="rounded"
                height="48px"
              />
            </Box>
          ))}
      </Box>
      <GiveText variant="h6" fontWeight="regular" color="primary">
        Primary Account Holder
      </GiveText>
      {Array(2)
        .fill(null)
        .map((c, idx) => (
          <Box
            display={"flex"}
            key={idx}
            gap={3}
            flexDirection={isDesktopView ? "row" : "column"}
            width="100%"
          >
            {Array(2)
              .fill(null)
              .map((c, idx) => (
                <Box
                  display={"flex"}
                  key={idx}
                  gap={3}
                  flexDirection={"column"}
                  width="100%"
                >
                  <Skeleton
                    width={isDesktopView ? "150px" : "100%"}
                    sx={{
                      borderRadius: "12px",
                    }}
                    variant="rounded"
                    height="25px"
                  />
                  <Skeleton
                    width="100%"
                    sx={{
                      borderRadius: "12px",
                    }}
                    variant="rounded"
                    height="48px"
                  />
                </Box>
              ))}
          </Box>
        ))}
    </Box>
  );
}
 
export default GiveMerchantInfoTabSkeleton;