@@ -13,6 +13,7 @@ type ViewbarYamlControlsViewProps = {
1313
1414export function ViewbarYamlControlsView ( { project, dispatch } : ViewbarYamlControlsViewProps ) {
1515 const fileInputRef = useRef < HTMLInputElement | null > ( null ) ;
16+ const yamlFileLabel = getYamlFileSourceLabel ( ) ;
1617
1718 const openFromPicker = async ( ) => {
1819 dispatch ( { type : 'set-error' , error : undefined } ) ;
@@ -95,11 +96,14 @@ export function ViewbarYamlControlsView({ project, dispatch }: ViewbarYamlContro
9596 const saveAs = async ( ) => {
9697 dispatch ( { type : 'set-error' , error : undefined } ) ;
9798 try {
98- const result = await exportYamlToDisk ( serializeProjectToYaml ( project ) , { startIn : getYamlPickerStartIn ( ) } ) ;
99+ const result = await exportYamlToDisk ( serializeProjectToYaml ( project ) , {
100+ suggestedName : yamlFileLabel ?? 'scene.yaml' ,
101+ startIn : getYamlPickerStartIn ( ) ,
102+ } ) ;
99103 if ( result . kind === 'saved' ) {
100104 setYamlPickerStartIn ( result . handle ) ;
101105 setYamlFileHandle ( result . handle ) ;
102- setYamlFileSourceLabel ( getYamlFileSourceLabel ( ) ?? 'scene.yaml' ) ;
106+ setYamlFileSourceLabel ( result . label ) ;
103107 dispatch ( { type : 'mark-saved' } ) ;
104108 dispatch ( { type : 'set-status' , message : 'Saved YAML' , expiresAt : Date . now ( ) + 4000 } ) ;
105109 } else {
@@ -115,7 +119,16 @@ export function ViewbarYamlControlsView({ project, dispatch }: ViewbarYamlContro
115119
116120 return (
117121 < div className = "viewbar-yaml" role = "toolbar" aria-label = "YAML file actions" >
118- < div className = "viewbar-group" >
122+ < div className = "viewbar-group viewbar-yaml-group" >
123+ { yamlFileLabel ? (
124+ < span className = "viewbar-yaml-file-label" data-testid = "yaml-file-label" title = { yamlFileLabel } >
125+ { yamlFileLabel }
126+ </ span >
127+ ) : (
128+ < span className = "viewbar-yaml-file-label viewbar-yaml-file-label-hidden" data-testid = "yaml-file-label-hidden" aria-hidden = "true" >
129+ scene.yaml
130+ </ span >
131+ ) }
119132 < button className = "button" type = "button" data-testid = "yaml-open-button" onClick = { ( ) => void openFromPicker ( ) } >
120133 Open YAML…
121134 </ button >
0 commit comments