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

Function PostNavigation

packages/shared/src/components/post/PostNavigation.tsx:14–97  ·  view source on GitHub ↗
({
  postPosition,
  onPreviousPost,
  onNextPost,
  className = {},
  leadingContent,
  customActions,
  contextMenuId = 'post-navigation-context',
  post,
  ...props
}: PostNavigationProps)

Source from the content-addressed store, hash-verified

12import { BriefPlusUpgradeCTA } from '../../features/briefing/components/BriefPlusUpgradeCTA';
13
14function PostNavigation({
15 postPosition,
16 onPreviousPost,
17 onNextPost,
18 className = {},
19 leadingContent,
20 customActions,
21 contextMenuId = 'post-navigation-context',
22 post,
23 ...props
24}: PostNavigationProps): ReactElement {
25 const { isFixedNavigation } = props;
26 const { user, isAuthReady } = useAuthContext();
27 const canUserUpgrade = isAuthReady && !user?.isPlus;
28 const isBrief = post?.type === PostType.Brief;
29 const shouldShowUpgrade = canUserUpgrade && isFixedNavigation && isBrief;
30
31 return (
32 <div
33 className={classNames(
34 'flex w-full flex-row items-center gap-2 bg-background-subtle py-1',
35 className?.container,
36 )}
37 role="navigation"
38 >
39 {onPreviousPost && (
40 <Tooltip content="Previous">
41 <Button
42 className="-rotate-90"
43 icon={<ArrowIcon />}
44 size={ButtonSize.Small}
45 variant={ButtonVariant.Tertiary}
46 onClick={onPreviousPost}
47 disabled={
48 !postPosition ||
49 [PostPosition.First, PostPosition.Only].includes(postPosition)
50 }
51 />
52 </Tooltip>
53 )}
54 {onNextPost && (
55 <Tooltip content="Next">
56 <Button
57 className="rotate-90"
58 icon={<ArrowIcon />}
59 size={ButtonSize.Small}
60 variant={ButtonVariant.Tertiary}
61 onClick={onNextPost}
62 disabled={
63 !postPosition ||
64 [PostPosition.Last, PostPosition.Only].includes(postPosition)
65 }
66 />
67 </Tooltip>
68 )}
69 {leadingContent}
70 <div className="ml-auto flex items-center gap-1">
71 {customActions}

Callers

nothing calls this directly

Calls 1

useAuthContextFunction · 0.90

Tested by

no test coverage detected