Skip to content

Commit

Permalink
Use overridden showFilePicker in "Save now" button too
Browse files Browse the repository at this point in the history
Fixes oversight in previous commit
  • Loading branch information
GarboMuffin committed Aug 1, 2024
1 parent 457b36f commit 3aaf328
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
4 changes: 3 additions & 1 deletion src/components/menu-bar/menu-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,9 @@ class MenuBar extends React.Component {
</div>

<div className={styles.accountInfoGroup}>
<TWSaveStatus />
<TWSaveStatus
showSaveFilePicker={this.props.showSaveFilePicker}
/>
</div>

{aboutButton}
Expand Down
56 changes: 31 additions & 25 deletions src/components/menu-bar/tw-save-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,48 @@ import styles from './save-status.css';
const TWSaveStatus = ({
alertsList,
fileHandle,
projectChanged
projectChanged,
showSaveFilePicker
}) => (
filterInlineAlerts(alertsList).length > 0 ? (
<InlineMessages />
) : projectChanged && (
<SB3Downloader>{(_className, _downloadProjectCallback, {smartSave}) => (
<div
onClick={smartSave}
className={styles.saveNow}
>
{fileHandle ? (
<FormattedMessage
defaultMessage="Save as {file}"
description="Menu bar item to save project to an existing file on the user's computer"
id="tw.menuBar.saveAs"
values={{
file: fileHandle.name
}}
/>
) : (
<FormattedMessage
defaultMessage="Save to your computer"
description="Menu bar item for downloading a project to your computer"
id="gui.menuBar.downloadToComputer"
/>
)}
</div>
)}</SB3Downloader>
<SB3Downloader
showSaveFilePicker={showSaveFilePicker}
>
{(_className, _downloadProjectCallback, {smartSave}) => (
<div
onClick={smartSave}
className={styles.saveNow}
>
{fileHandle ? (
<FormattedMessage
defaultMessage="Save as {file}"
description="Menu bar item to save project to an existing file on the user's computer"
id="tw.menuBar.saveAs"
values={{
file: fileHandle.name
}}
/>
) : (
<FormattedMessage
defaultMessage="Save to your computer"
description="Menu bar item for downloading a project to your computer"
id="gui.menuBar.downloadToComputer"
/>
)}
</div>
)}
</SB3Downloader>
));

TWSaveStatus.propTypes = {
alertsList: PropTypes.arrayOf(PropTypes.object),
fileHandle: PropTypes.shape({
name: PropTypes.string
}),
projectChanged: PropTypes.bool
projectChanged: PropTypes.bool,
showSaveFilePicker: PropTypes.func
};

const mapStateToProps = state => ({
Expand Down

0 comments on commit 3aaf328

Please sign in to comment.