99 Popover ,
1010 useScrollProgress ,
1111} from "@dub/ui" ;
12- import { Book2 , Check2 , Plus } from "@dub/ui/icons" ;
12+ import { Check2 , Gear , Plus , UserPlus } from "@dub/ui/icons" ;
1313import { cn , OG_AVATAR_URL } from "@dub/utils" ;
14- import { ChevronsUpDown , HelpCircle } from "lucide-react" ;
14+ import { ChevronsUpDown } from "lucide-react" ;
1515import { useSession } from "next-auth/react" ;
1616import Link from "next/link" ;
1717import { useParams , usePathname } from "next/navigation" ;
@@ -139,21 +139,6 @@ function WorkspaceDropdownPlaceholder() {
139139 ) ;
140140}
141141
142- const LINKS = [
143- {
144- name : "Help Center" ,
145- icon : HelpCircle ,
146- href : "https://dub.co/help" ,
147- target : "_blank" ,
148- } ,
149- {
150- name : "Documentation" ,
151- icon : Book2 ,
152- href : "https://dub.co/docs" ,
153- target : "_blank" ,
154- } ,
155- ] ;
156-
157142function WorkspaceList ( {
158143 selected,
159144 workspaces,
@@ -180,9 +165,9 @@ function WorkspaceList({
180165
181166 const href = useCallback (
182167 ( slug : string ) => {
183- if ( link || selected . slug === "/" ) {
168+ if ( link ) {
184169 // if we're on a link page, navigate back to the workspace root
185- return `/${ slug } ` ;
170+ return `/${ slug } /links ` ;
186171 } else if ( programId ) {
187172 // if we're on a program page, navigate to the program page
188173 return `/${ slug } /programs` ;
@@ -201,31 +186,59 @@ function WorkspaceList({
201186 onScroll = { updateScrollProgress }
202187 className = "relative max-h-80 w-full space-y-0.5 overflow-auto rounded-lg bg-white text-base sm:w-64 sm:text-sm"
203188 >
204- < div className = "flex flex-col gap-0.5 border-b border-neutral-200 p-2" >
205- { LINKS . map ( ( { name, icon : Icon , href, target } ) => (
206- < Link
207- key = { name }
208- href = { href }
209- target = { target }
210- className = { cn (
211- "flex items-center gap-x-4 rounded-md px-2.5 py-2 transition-all duration-75 hover:bg-neutral-200/50 active:bg-neutral-200/80" ,
212- "outline-none focus-visible:ring-2 focus-visible:ring-black/50" ,
189+ { /* Current workspace section */ }
190+ < div className = "border-b border-neutral-200 p-2" >
191+ < div className = "flex items-center gap-x-2.5 rounded-md p-2" >
192+ < BlurImage
193+ src = { selected . image || `${ OG_AVATAR_URL } ${ selected . name } ` }
194+ width = { 28 }
195+ height = { 28 }
196+ alt = { selected . name }
197+ className = "size-8 shrink-0 overflow-hidden rounded-full"
198+ />
199+ < div className = "min-w-0" >
200+ < div className = "truncate text-sm font-medium leading-5 text-neutral-900" >
201+ { selected . name }
202+ </ div >
203+ { selected . slug !== "/" && (
204+ < div
205+ className = { cn (
206+ "truncate text-xs capitalize leading-tight" ,
207+ getPlanColor ( selected . plan ) ,
208+ ) }
209+ >
210+ { selected . plan }
211+ </ div >
213212 ) }
213+ </ div >
214+ </ div >
215+
216+ { /* Settings and Invite members options */ }
217+ < div className = "mt-2 flex flex-col gap-0.5" >
218+ < Link
219+ href = { `/${ selected . slug } /settings` }
220+ className = "flex w-full items-center gap-x-2 rounded-md px-2 py-1.5 text-neutral-700 outline-none transition-all duration-75 hover:bg-neutral-200/50 focus-visible:ring-2 focus-visible:ring-black/50 active:bg-neutral-200/80"
214221 onClick = { ( ) => setOpenPopover ( false ) }
215222 >
216- < Icon className = "size-4 text-neutral-500" />
217- < span className = "block truncate text-neutral-600" > { name } </ span >
223+ < Gear className = "size-4 text-neutral-500" />
224+ < span className = "block truncate text-sm" > Settings </ span >
218225 </ Link >
219- ) ) }
226+ < Link
227+ href = { `/${ selected . slug } /settings/people` }
228+ className = "flex w-full items-center gap-x-2 rounded-md px-2 py-1.5 text-neutral-700 outline-none transition-all duration-75 hover:bg-neutral-200/50 focus-visible:ring-2 focus-visible:ring-black/50 active:bg-neutral-200/80"
229+ onClick = { ( ) => setOpenPopover ( false ) }
230+ >
231+ < UserPlus className = "size-4 text-neutral-500" />
232+ < span className = "block truncate text-sm" > Invite members</ span >
233+ </ Link >
234+ </ div >
220235 </ div >
236+
237+ { /* Workspaces section */ }
221238 < div className = "p-2" >
222- < div className = "flex items-center justify-between pb-1" >
223- < p className = "px-1 text-xs font-medium text-neutral-500" >
224- Workspaces
225- </ p >
226- </ div >
239+ < p className = "p-1 text-xs font-medium text-neutral-500" > Workspaces</ p >
227240 < div className = "flex flex-col gap-0.5" >
228- { workspaces . map ( ( { id, name, slug, logo, plan } ) => {
241+ { workspaces . map ( ( { id, name, slug, logo } ) => {
229242 const isActive = selected . slug === slug ;
230243 return (
231244 < Link
@@ -245,23 +258,11 @@ function WorkspaceList({
245258 width = { 28 }
246259 height = { 28 }
247260 alt = { id }
248- className = "size-7 shrink-0 overflow-hidden rounded-full"
261+ className = "size-6 shrink-0 overflow-hidden rounded-full"
249262 />
250- < div >
251- < span className = "block truncate text-sm leading-5 text-neutral-900 sm:max-w-[140px]" >
252- { name }
253- </ span >
254- { slug !== "/" && (
255- < div
256- className = { cn (
257- "truncate text-xs capitalize leading-tight" ,
258- getPlanColor ( plan ) ,
259- ) }
260- >
261- { plan }
262- </ div >
263- ) }
264- </ div >
263+ < span className = "block truncate text-sm leading-5 text-neutral-900 sm:max-w-[140px]" >
264+ { name }
265+ </ span >
265266 { selected . slug === slug ? (
266267 < span className = "absolute inset-y-0 right-0 flex items-center pr-3 text-black" >
267268 < Check2 className = "size-4" aria-hidden = "true" />
@@ -278,7 +279,7 @@ function WorkspaceList({
278279 } }
279280 className = "group flex w-full cursor-pointer items-center gap-x-2 rounded-md p-2 text-neutral-700 transition-all duration-75 hover:bg-neutral-200/50 active:bg-neutral-200/80"
280281 >
281- < Plus className = "mx -1.5 size-4 text-neutral-500" />
282+ < Plus className = "ml -1.5 size-4 text-neutral-500" />
282283 < span className = "block truncate" > Create new workspace</ span >
283284 </ button >
284285 </ div >
0 commit comments