mirror of
https://github.com/chinchang/web-maker.git
synced 2025-06-03 16:15:03 +02:00
put limit on file mode creations in free plan
This commit is contained in:
parent
cd486fc3ba
commit
02b9e56562
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user