All files / src/pages/Settings Settings.tsx

84.61% Statements 11/13
57.14% Branches 4/7
100% Functions 4/4
91.66% Lines 11/12

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                    1x 1x   1x 1x 1x     1x         1x     1x     1x 1x   1x                      
import { SettingsLayout } from "@components/Settings/Shared/SettingsLayout";
import {
  SpecialRenderArgs,
  RedirectLogicArgs,
  SkipLayoutArgs,
} from "@components/Settings/Shared/SettingsLayout.types";
import WelcomePage from "@pages/Welcome/WelcomePage";
import { MERCHANT_PATHS } from "@routes/paths";
import { useBannerOffset } from "@hooks/common/useBannerOffset";
 
export const SettingsPage = () => {
  const bannerOffset = useBannerOffset();
 
  const specialRender = ({ state }: SpecialRenderArgs) => {
    Iif (state?.wasWelcomeMessageSeen === false) return <WelcomePage />;
    return null;
  };
 
  const redirectLogic = ({
    isSettingsBasePage,
    isPermissions,
    isTabletOrMobile,
  }: RedirectLogicArgs) => {
    Iif (!isTabletOrMobile && isSettingsBasePage && !isPermissions) {
      return { path: MERCHANT_PATHS.BUSINESS };
    }
    return null;
  };
 
  const skipLayoutCondition = ({ isPermissions }: SkipLayoutArgs) =>
    isPermissions;
 
  return (
    <SettingsLayout
      base="merchant"
      specialRender={specialRender}
      redirectLogic={redirectLogic}
      skipLayoutCondition={skipLayoutCondition}
      bannerOffset={bannerOffset}
      excludeSegments={["manage-team", "media-library"]}
    />
  );
};