({ user, project, organization, organizations }: SideMenuProps)
| 98 | }; |
| 99 | |
| 100 | export function SideMenu({ user, project, organization, organizations }: SideMenuProps) { |
| 101 | const borderRef = useRef<HTMLDivElement>(null); |
| 102 | const [showHeaderDivider, setShowHeaderDivider] = useState(false); |
| 103 | const { isManagedCloud } = useFeatures(); |
| 104 | const currentPlan = useCurrentPlan(); |
| 105 | |
| 106 | useEffect(() => { |
| 107 | const handleScroll = () => { |
| 108 | if (borderRef.current) { |
| 109 | const shouldShowHeaderDivider = borderRef.current.scrollTop > 1; |
| 110 | if (showHeaderDivider !== shouldShowHeaderDivider) { |
| 111 | setShowHeaderDivider(shouldShowHeaderDivider); |
| 112 | } |
| 113 | } |
| 114 | }; |
| 115 | |
| 116 | borderRef.current?.addEventListener("scroll", handleScroll); |
| 117 | return () => borderRef.current?.removeEventListener("scroll", handleScroll); |
| 118 | }, [showHeaderDivider]); |
| 119 | |
| 120 | return ( |
| 121 | <div |
| 122 | className={cn( |
| 123 | "flex h-full flex-col gap-y-8 overflow-hidden border-r border-grid-bright bg-background-bright transition" |
| 124 | )} |
| 125 | > |
| 126 | <div className="flex h-full flex-col"> |
| 127 | <div |
| 128 | className={cn( |
| 129 | "flex items-center justify-between px-1 py-1 transition", |
| 130 | showHeaderDivider ? " border-grid-bright" : "border-transparent" |
| 131 | )} |
| 132 | > |
| 133 | <ProjectSelector organizations={organizations} project={project} /> |
| 134 | <UserMenu user={user} /> |
| 135 | </div> |
| 136 | <div |
| 137 | className="h-full overflow-hidden overflow-y-auto pt-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600" |
| 138 | ref={borderRef} |
| 139 | > |
| 140 | <div className="mb-6 flex flex-col gap-1 px-1"> |
| 141 | {project.version === "V2" ? ( |
| 142 | <V2ProjectSideMenu organization={organization} project={project} /> |
| 143 | ) : ( |
| 144 | <V3ProjectSideMenu organization={organization} project={project} /> |
| 145 | )} |
| 146 | </div> |
| 147 | <div className="mb-1 flex flex-col gap-1 px-1"> |
| 148 | <SideMenuHeader title={"Organization"}> |
| 149 | <PopoverMenuItem to={newProjectPath(organization)} title="New Project" icon="plus" /> |
| 150 | <PopoverMenuItem |
| 151 | to={inviteTeamMemberPath(organization)} |
| 152 | title="Invite team member" |
| 153 | icon={UserPlusIcon} |
| 154 | leadingIconClassName="text-indigo-500" |
| 155 | /> |
| 156 | </SideMenuHeader> |
| 157 | {project.version === "V2" && ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…