MCPcopy Create free account
hub / github.com/dailydotdev/apps / useLayoutVariant

Function useLayoutVariant

packages/shared/src/hooks/layout/useLayoutVariant.ts:11–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9}
10
11export const useLayoutVariant = (): UseLayoutVariant => {
12 const { isAuthReady } = useAuthContext();
13 // v2 chrome (rail, page-header strip, floating card) only renders at
14 // laptop+ — on tablet we still serve the legacy SidebarTablet and the
15 // legacy header. Gate evaluation on the same breakpoint so consumers
16 // can treat `isV2` as the single source of truth (no separate
17 // `useViewSize(ViewSize.Laptop)` check needed at the call site).
18 const isLaptop = useViewSize(ViewSize.Laptop);
19 const shouldEvaluate = isAuthReady && isLaptop;
20 const { value, isLoading } = useConditionalFeature({
21 feature: featureLayoutV2,
22 shouldEvaluate,
23 });
24
25 return {
26 isV2: shouldEvaluate && value === true,
27 isLoading,
28 };
29};

Callers 15

MainLayoutComponentFunction · 0.90
CustomFeedEmptyScreenFunction · 0.90
BookmarkFeedLayoutFunction · 0.90
FeedFunction · 0.90
MainFeedLayoutFunction · 0.90
ToggleClickbaitShieldFunction · 0.90
SearchControlHeaderFunction · 0.90
ReadingStreakButtonFunction · 0.90
useSquadDirectoryLayoutFunction · 0.90
SquadDirectoryLayoutFunction · 0.90
SidebarItemFunction · 0.90
SidebarFunction · 0.90

Calls 3

useAuthContextFunction · 0.90
useViewSizeFunction · 0.90
useConditionalFeatureFunction · 0.90

Tested by

no test coverage detected