1- import { createWorkspaceModel , foldersAtom , patchModel } from '@yaakapp-internal/models' ;
1+ import {
2+ createWorkspaceModel ,
3+ foldersAtom ,
4+ patchModel ,
5+ workspacesAtom ,
6+ } from '@yaakapp-internal/models' ;
27import { useAtomValue } from 'jotai' ;
3- import { useMemo , useState } from 'react' ;
8+ import { Fragment , useMemo , useState } from 'react' ;
49import { useAuthTab } from '../hooks/useAuthTab' ;
510import { useEnvironmentsBreakdown } from '../hooks/useEnvironmentsBreakdown' ;
611import { useHeadersTab } from '../hooks/useHeadersTab' ;
712import { useInheritedHeaders } from '../hooks/useInheritedHeaders' ;
13+ import { useParentFolders } from '../hooks/useParentFolders' ;
814import { Button } from './core/Button' ;
915import { CountBadge } from './core/CountBadge' ;
16+ import { Icon } from './core/Icon' ;
1017import { Input } from './core/Input' ;
1118import { Link } from './core/Link' ;
1219import { VStack } from './core/Stacks' ;
@@ -36,7 +43,9 @@ export type FolderSettingsTab =
3643
3744export function FolderSettingsDialog ( { folderId, tab } : Props ) {
3845 const folders = useAtomValue ( foldersAtom ) ;
46+ const workspaces = useAtomValue ( workspacesAtom ) ;
3947 const folder = folders . find ( ( f ) => f . id === folderId ) ?? null ;
48+ const parentFolders = useParentFolders ( folder ) ;
4049 const [ activeTab , setActiveTab ] = useState < string > ( tab ?? TAB_GENERAL ) ;
4150 const authTab = useAuthTab ( TAB_AUTH , folder ) ;
4251 const headersTab = useHeadersTab ( TAB_HEADERS , folder ) ;
@@ -47,6 +56,20 @@ export function FolderSettingsDialog({ folderId, tab }: Props) {
4756 ) ;
4857 const numVars = ( folderEnvironment ?. variables ?? [ ] ) . filter ( ( v ) => v . name ) . length ;
4958
59+ const breadcrumbs = useMemo ( ( ) => {
60+ if ( ! folder ) return [ ] ;
61+
62+ const workspace = workspaces . find ( ( w ) => w . id === folder . workspaceId ) ;
63+
64+ const items = [ ] ;
65+ if ( workspace ) {
66+ items . push ( { id : workspace . id , name : workspace . name } ) ;
67+ }
68+ items . push ( ...parentFolders . reverse ( ) . map ( ( f ) => ( { id : f . id , name : f . name } ) ) ) ;
69+
70+ return items ;
71+ } , [ folder , parentFolders , workspaces ] ) ;
72+
5073 const tabs = useMemo < TabItem [ ] > ( ( ) => {
5174 if ( folder == null ) return [ ] ;
5275
@@ -82,6 +105,23 @@ export function FolderSettingsDialog({ folderId, tab }: Props) {
82105 </ TabContent >
83106 < TabContent value = { TAB_GENERAL } className = "overflow-y-auto h-full px-4" >
84107 < VStack space = { 3 } className = "pb-3 h-full" >
108+ { breadcrumbs . length > 0 && (
109+ < div className = "flex flex-col gap-1.5" >
110+ < div className = "text-xs font-medium text-text-subtle uppercase tracking-wide" >
111+ Location
112+ </ div >
113+ < div className = "flex items-center gap-1.5 text-sm text-text-subtlest px-2 py-1.5 bg-surface rounded border border-border" >
114+ { breadcrumbs . map ( ( item , index ) => (
115+ < Fragment key = { item . id } >
116+ { index > 0 && < Icon icon = "chevron_right" size = "sm" className = "opacity-50" /> }
117+ < span className = { index === breadcrumbs . length - 1 ? 'text-text-subtle' : '' } >
118+ { item . name }
119+ </ span >
120+ </ Fragment >
121+ ) ) }
122+ </ div >
123+ </ div >
124+ ) }
85125 < Input
86126 label = "Folder Name"
87127 defaultValue = { folder . name }
0 commit comments