MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / AppShell

Function AppShell

app/src/components/nav/AppShell.tsx:181–249  ·  view source on GitHub ↗
({
  children,
  title,
  requireAuth,
  requireBeta,
  containerProps,
}: {
  children: React.ReactNode;
  title?: string;
  requireAuth?: boolean;
  requireBeta?: boolean;
  containerProps?: BoxProps;
})

Source from the content-addressed store, hash-verified

179};
180
181export default function AppShell({
182 children,
183 title,
184 requireAuth,
185 requireBeta,
186 containerProps,
187}: {
188 children: React.ReactNode;
189 title?: string;
190 requireAuth?: boolean;
191 requireBeta?: boolean;
192 containerProps?: BoxProps;
193}) {
194 const [vh, setVh] = useState("100vh"); // Default height to prevent flicker on initial render
195 const router = useRouter();
196
197 useEffect(() => {
198 const setHeight = () => {
199 const vh = window.innerHeight * 0.01;
200 document.documentElement.style.setProperty("--vh", `${vh}px`);
201 setVh(`calc(var(--vh, 1vh) * 100)`);
202 };
203 setHeight(); // Set the height at the start
204
205 window.addEventListener("resize", setHeight);
206 window.addEventListener("orientationchange", setHeight);
207
208 return () => {
209 window.removeEventListener("resize", setHeight);
210 window.removeEventListener("orientationchange", setHeight);
211 };
212 }, []);
213
214 const user = useSession().data;
215 const authLoading = useSession().status === "loading";
216
217 useEffect(() => {
218 if (requireAuth && user === null && !authLoading) {
219 signIn("github").catch(console.error);
220 }
221 }, [requireAuth, user, authLoading]);
222
223 const isMissingBetaAccess = useIsMissingBetaAccess();
224
225 return (
226 <>
227 <Flex h={vh} w="100vw">
228 <Head>
229 <title>{title ? `${title} | OpenPipe` : "OpenPipe"}</title>
230 </Head>
231
232 <NavSidebar />
233 <Box
234 position="relative"
235 h="100%"
236 flex={1}
237 overflowY="auto"
238 bgColor="gray.50"

Callers

nothing calls this directly

Calls 4

useIsMissingBetaAccessFunction · 0.90
setHeightFunction · 0.85
signInFunction · 0.85
catchMethod · 0.45

Tested by

no test coverage detected