({
postPosition,
onPreviousPost,
onNextPost,
className = {},
leadingContent,
customActions,
contextMenuId = 'post-navigation-context',
post,
...props
}: PostNavigationProps)
| 12 | import { BriefPlusUpgradeCTA } from '../../features/briefing/components/BriefPlusUpgradeCTA'; |
| 13 | |
| 14 | function 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} |
nothing calls this directly
no test coverage detected