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

Function SidebarTablet

packages/shared/src/components/sidebar/SidebarTablet.tsx:46–255  ·  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

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected