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

Function SidebarTablet

packages/shared/src/components/sidebar/SidebarTablet.tsx:47–259  ·  view source on GitHub ↗
({
  activePage,
  featureTheme,
  onLogoClick,
}: {
  activePage: string;
  featureTheme?: {
    logo?: string;
    logoText?: string;
  };
  onLogoClick?: (e: React.MouseEvent) => unknown;
})

Source from the content-addressed store, hash-verified

45import { useJobsFeature } from '../../hooks/useJobsFeature';
46
47export const SidebarTablet = ({
48 activePage,
49 featureTheme,
50 onLogoClick,
51}: {
52 activePage: string;
53 featureTheme?: {
54 logo?: string;
55 logoText?: string;
56 };
57 onLogoClick?: (e: React.MouseEvent) => unknown;
58}): ReactElement => {
59 const { alerts } = useAlertsContext();
60 const { user, isLoggedIn, squads } = useAuthContext();
61 const { unreadCount } = useNotificationContext();
62 const buttonProps: ButtonProps<'a' | 'button'> = {
63 variant: ButtonVariant.Tertiary,
64 size: ButtonSize.Large,
65 className:
66 'w-full !bg-transparent active:bg-transparent aria-pressed:bg-transparent typo-caption1',
67 };
68 const feedName = getFeedName(activePage, {
69 hasUser: !!user,
70 hasFiltered: !alerts?.filter,
71 });
72 const hasSquads = (squads?.length ?? 0) > 0;
73 const squadsUrl = hasSquads
74 ? `${webappUrl}${squadCategoriesPaths['My Squads'].substring(1)}`
75 : `${webappUrl}${squadCategoriesPaths.discover.substring(1)}`;
76 const activeNav = useActiveNav(feedName);
77 const hasOpportunityAlert = !!alerts.opportunityId;
78 const { checkHasCompleted } = useActions();
79 const hasNotClickedOpportunity = !checkHasCompleted(
80 ActionType.ClickedOpportunityNavigation,
81 );
82 const logOpportunityNudgeClick = useLogOpportunityNudgeClick(
83 TargetId.Sidebar,
84 );
85 const { isJobsEnabled } = useJobsFeature();
86
87 return (
88 <SidebarAside
89 data-testid="sidebar-aside"
90 className={classNames(
91 'w-16 items-center gap-4',
92 featureTheme && 'bg-transparent',
93 )}
94 >
95 <HeaderLogo
96 compact
97 position={LogoPosition.Relative}
98 onLogoClick={onLogoClick}
99 className={classNames('h-10 pt-4')}
100 />
101 <Link href={`${webappUrl}`} prefetch={false} passHref>
102 <Button
103 {...buttonProps}
104 tag="a"

Callers

nothing calls this directly

Calls 9

useAlertsContextFunction · 0.90
useAuthContextFunction · 0.90
useNotificationContextFunction · 0.90
getFeedNameFunction · 0.90
useActionsFunction · 0.90
useJobsFeatureFunction · 0.90
getUnreadTextFunction · 0.90
useActiveNavFunction · 0.85

Tested by

no test coverage detected