mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-10 16:46:28 +02:00
fix(script): Warn of local save on first save
This commit is contained in:
@ -336,6 +336,19 @@ loginModal, profileModal, profileAvatarImg, profileUserName, openItemsBtn
|
|||||||
|
|
||||||
// Save current item to storage
|
// Save current item to storage
|
||||||
function saveItem() {
|
function saveItem() {
|
||||||
|
if (!window.user && !window.localStorage.loginAndsaveMessageSeen) {
|
||||||
|
const answer = confirm(
|
||||||
|
'Saving without signing in will save your work only on this machine and this browser. If you want it to be secure & available anywhere, please login in your account and then save.\n\nDo you still want to continue saving locally?'
|
||||||
|
);
|
||||||
|
window.localStorage.loginAndsaveMessageSeen = true;
|
||||||
|
if (!answer) {
|
||||||
|
trackEvent('ui', 'loginAndsaveMessageSeen', 'login');
|
||||||
|
closeAllOverlays();
|
||||||
|
loginModal.classList.add('is-modal-visible');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trackEvent('ui', 'loginAndsaveMessageSeen', 'local');
|
||||||
|
}
|
||||||
var isNewItem = !currentItem.id;
|
var isNewItem = !currentItem.id;
|
||||||
currentItem.id = currentItem.id || 'item-' + utils.generateRandomId();
|
currentItem.id = currentItem.id || 'item-' + utils.generateRandomId();
|
||||||
saveBtn.classList.add('is-loading');
|
saveBtn.classList.add('is-loading');
|
||||||
@ -509,7 +522,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName, openItemsBtn
|
|||||||
var items = [];
|
var items = [];
|
||||||
if (window.user) {
|
if (window.user) {
|
||||||
items = await itemService.getAllItems();
|
items = await itemService.getAllItems();
|
||||||
utils.log('got items')
|
utils.log('got items');
|
||||||
if (shouldSaveGlobally) {
|
if (shouldSaveGlobally) {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
savedItems[item.id] = item;
|
savedItems[item.id] = item;
|
||||||
@ -2046,7 +2059,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName, openItemsBtn
|
|||||||
closeAllOverlays();
|
closeAllOverlays();
|
||||||
trackEvent('ui', e.target.dataset.eventAction);
|
trackEvent('ui', e.target.dataset.eventAction);
|
||||||
scope.toggleModal(pledgeModal);
|
scope.toggleModal(pledgeModal);
|
||||||
}
|
};
|
||||||
|
|
||||||
scope.updateProfileUi = () => {
|
scope.updateProfileUi = () => {
|
||||||
if (window.user) {
|
if (window.user) {
|
||||||
|
Reference in New Issue
Block a user