1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-26 08:11:17 +02:00

Merge remote-tracking branch 'origin/master' into manifestv3

This commit is contained in:
Kushagra Gour
2024-05-09 17:26:50 +05:30
26 changed files with 2356 additions and 1536 deletions

View File

@@ -84,7 +84,7 @@ if (module.hot) {
}
const UNSAVED_WARNING_COUNT = 15;
const version = '6.1.0';
const version = '6.2.0';
// Read forced settings as query parameters
window.forcedSettings = {};
@@ -108,8 +108,16 @@ if (location.search) {
}
function customRoute(path) {
// we don't /create redirections on extension since SPA paths don't work there
// we don't /create redirections on extension since SPA paths don't work there.
if (window.IS_EXTENSION) return;
// And also for logged out users, since it will send them to /create/ID and refreshing
// that will try to find that creation in their database, which doesn't exist. LOgged out
// users anyways can't do anything with the urls.
// Exception is /create. this is needed because a logged out user can visit a /create/ID
// of some other user and then create a new item...at which point they shud come back
// to /create
if (!window.user && path !== '/create') return;
else {
route(path);
}
@@ -1544,10 +1552,17 @@ export default class App extends Component {
this.setState({ isCreateNewModalOpen: false });
}
blankFileTemplateSelectHandler() {
const create = () => {
this.createNewItem(true);
this.setState({ isCreateNewModalOpen: false });
};
if (this.state.user?.isPro) {
create();
return;
}
itemService.getCountOfFileModeItems().then(count => {
if (count < 2) {
this.createNewItem(true);
this.setState({ isCreateNewModalOpen: false });
create();
} else {
trackEvent('ui', 'FileModeCreationLimitMessageSeen');
// this.closeAllOverlays();
@@ -1560,24 +1575,29 @@ export default class App extends Component {
}
templateSelectHandler(template, isFileMode) {
const create = () => {
fetch(
`templates/template-${isFileMode ? 'files-' : ''}${template.id}.json`
)
.then(res => res.json())
.then(json => {
this.forkItem(json);
});
this.setState({ isCreateNewModalOpen: false });
};
if (isFileMode) {
if (this.state.user?.isPro) {
create();
return;
}
itemService.getCountOfFileModeItems().then(count => {
if (count < 2) {
fetch(
`templates/template-${isFileMode ? 'files-' : ''}${
template.id
}.json`
)
.then(res => res.json())
.then(json => {
this.forkItem(json);
});
this.setState({ isCreateNewModalOpen: false });
create();
} else {
trackEvent('ui', 'FileModeCreationLimitMessageSeen');
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.'
);
this.setState({ isFilesLimitModalOpen: true });
}
});
} else {