2021-10-12 18:47:33 +03:00
|
|
|
import Component from '@glimmer/component';
|
2022-03-14 13:52:04 +03:00
|
|
|
import InstallThemeModal from './install-theme';
|
2021-10-12 18:47:33 +03:00
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2021-10-18 19:22:36 +03:00
|
|
|
import {tracked} from '@glimmer/tracking';
|
2021-10-12 18:47:33 +03:00
|
|
|
|
2022-03-14 13:52:04 +03:00
|
|
|
export default class ViewThemeModal extends Component {
|
2021-10-12 18:47:33 +03:00
|
|
|
@service modals;
|
|
|
|
@service router;
|
|
|
|
|
2022-03-14 13:52:04 +03:00
|
|
|
static modalOptions = {
|
|
|
|
className: 'fullscreen-modal-total-overlay',
|
|
|
|
omitBackdrop: true
|
|
|
|
};
|
|
|
|
|
2021-10-18 19:22:36 +03:00
|
|
|
@tracked previewSize = 'desktop';
|
|
|
|
|
|
|
|
get isDesktopPreview() {
|
|
|
|
return this.previewSize === 'desktop';
|
|
|
|
}
|
|
|
|
|
|
|
|
get isMobilePreview() {
|
|
|
|
return this.previewSize === 'mobile';
|
|
|
|
}
|
|
|
|
|
2021-10-12 18:47:33 +03:00
|
|
|
willDestroy() {
|
|
|
|
super.willDestroy(...arguments);
|
|
|
|
|
|
|
|
// leave install modal visiible if it's in the success state because
|
|
|
|
// we're switching over to the design customisation screen in the bg
|
|
|
|
// and don't want to auto-close when this modal closes
|
|
|
|
if (this.installModal && !this.showingSuccessModal) {
|
|
|
|
this.installModal.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
installTheme() {
|
2022-03-14 13:52:04 +03:00
|
|
|
this.installModal = this.modals.open(InstallThemeModal, {
|
2021-10-12 18:47:33 +03:00
|
|
|
theme: this.args.data.theme,
|
|
|
|
onSuccess: () => {
|
|
|
|
this.showingSuccessModal = true;
|
|
|
|
this.router.transitionTo('settings.design');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-10-18 19:22:36 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
setPreviewSize(size) {
|
|
|
|
this.previewSize = size;
|
|
|
|
}
|
2021-10-12 18:47:33 +03:00
|
|
|
}
|