All files / src/features/Events/EventDetail TabErrorState.tsx

81.81% Statements 9/11
50% Branches 2/4
100% Functions 3/3
100% Lines 8/8

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                                  5x 4x       4x 4x 4x 4x     4x                         5x              
import { ReactNode } from "react";
import { Stack } from "@mui/material";
import TechnicalErrorState from "componentsV2/Table/components/TechnicalErrorState";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { styled } from "@theme/v2/Provider";
 
type Props = {
  /** The shared banner head (breadcrumb offset, header, cards, tabs). */
  head?: ReactNode;
};
 
/**
 * A tab's list failed: the error takes the table's place, and nothing else's.
 * The page chrome (banner head, (…) menu, tabs) stays mounted so the other tab
 * remains reachable — Transactions and Tickets are different endpoints, and one
 * failing must not take down the other, or the page.
 */
const TabErrorState = ({ head }: Props) => {
  const { isMobileView, isLargeView } = useCustomThemeV2();
 
  // The V2 table supplies these gutters itself; without it they are ours to
  // draw. Same values as EventDetailPage's breadcrumb overlay.
  const getPadding = () => {
    Iif (isMobileView) return "0px 20px";
    Iif (isLargeView) return "0px 64px";
    return "0px 40px";
  };
 
  return (
    <Container
      sx={{ padding: getPadding() }}
      data-testid="event-detail-tab-error"
    >
      {head}
      <TechnicalErrorState />
    </Container>
  );
};
 
export default TabErrorState;
 
const Container = styled(Stack)(() => ({
  width: "100%",
  maxWidth: "1920px",
  margin: "0 auto",
  height: "100%",
  overflowY: "auto",
}));