diff --git a/src/components/app.jsx b/src/components/app.jsx index 37982b5..b7f9f5a 100644 --- a/src/components/app.jsx +++ b/src/components/app.jsx @@ -1351,8 +1351,16 @@ export default class App extends Component { this.setState({ isCreateNewModalOpen: false }); } blankFileTemplateSelectHandler() { - this.createNewItem(true); - this.setState({ isCreateNewModalOpen: false }); + itemService.getCountOfFileModeItems().then(count => { + if (count < 2) { + this.createNewItem(true); + this.setState({ isCreateNewModalOpen: false }); + } else { + return alert( + '"Files mode" is currently in beta and is limited to only 2 creations per user. You have already made 2 creations in Files mode.\n\nNote: You can choose to delete old ones to create new.' + ); + } + }); } templateSelectHandler(template) { diff --git a/src/itemService.js b/src/itemService.js index 02ed8aa..a537db7 100644 --- a/src/itemService.js +++ b/src/itemService.js @@ -253,5 +253,13 @@ export const itemService = { log(`Item ${itemId} unset for user`, arg); }) .catch(error => log(error)); + }, + + async getCountOfFileModeItems() { + const items = await this.getAllItems(); + return items.reduce((count, item) => { + if (item.files) return ++count; + return count; + }, 0); } };