From 61951885e2063b61861fabe3d2e2cf57c27a8147 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Mon, 15 Apr 2024 17:00:00 +0530 Subject: [PATCH] improve modal system --- src/components/Modal.jsx | 73 +++++++++++++++++++++------------------- src/components/app.jsx | 35 +++++++++++++++---- src/style.css | 24 ++++++++++--- 3 files changed, 87 insertions(+), 45 deletions(-) diff --git a/src/components/Modal.jsx b/src/components/Modal.jsx index e0b02c4..84138d0 100644 --- a/src/components/Modal.jsx +++ b/src/components/Modal.jsx @@ -77,42 +77,47 @@ const Modal = ({ if (!show) return null; return ( - - - + ); }; diff --git a/src/components/app.jsx b/src/components/app.jsx index d86d9a1..c2f1c03 100644 --- a/src/components/app.jsx +++ b/src/components/app.jsx @@ -73,6 +73,9 @@ import { Assets } from './Assets.jsx'; import { LocalStorageKeys } from '../constants.js'; import { Share } from './Share.jsx'; import { Pro } from './Pro.jsx'; +import { VStack } from './Stack.jsx'; +import { ProBadge } from './ProBadge.jsx'; +import { Text } from './Text.jsx'; if (module.hot) { require('preact/debug'); @@ -124,7 +127,8 @@ export default class App extends Component { isCommandPaletteOpen: false, isAssetsOpen: false, isShareModalOpen: false, - isProModalOpen: false + isProModalOpen: false, + isFilesLimitModalOpen: false }; this.state = { isSavedItemPaneOpen: false, @@ -1497,9 +1501,11 @@ export default class App extends Component { this.setState({ isCreateNewModalOpen: false }); } 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.closeAllOverlays(); + this.setState({ isFilesLimitModalOpen: true }); + // 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.' + // ); } }); } @@ -1828,7 +1834,7 @@ export default class App extends Component { this.proBtnClickHandler(); }} onLoginBtnClick={() => { - this.setState({ isAssetsOpen: false }); + this.closeAllOverlays(); this.loginBtnClickHandler(); }} /> @@ -1848,7 +1854,7 @@ export default class App extends Component { this.setState({ currentItem: item }); }} onLoginBtnClick={() => { - this.setState({ isShareModalOpen: false }); + this.closeAllOverlays(); this.loginBtnClickHandler(); }} /> @@ -1925,6 +1931,23 @@ export default class App extends Component { )} /> + this.setState({ isFilesLimitModalOpen: false })} + > + + + You have used your quota of 2 'Files mode' creations in Free + plan. + + + You can choose to delete old ones to free quota or upgrade to{' '} + .{' '} + + + + #demo-frame { display: flex; justify-content: space-between; /* Because .console is 6 */ - z-index: 6; + z-index: var(--zindex-footer); } .main-header { @@ -1016,13 +1020,23 @@ body > #demo-frame { display: flex; align-items: baseline; justify-content: center; - z-index: 2000; + z-index: var(--zindex-modal); visibility: hidden; - /* background-color: rgba(102, 51, 153, 0.7); */ - /* background-color: rgba(0, 0, 0, 0.7); */ /* To prevent scroll repaint inside modal */ + + z-index: var(--zindex-modal-overlay); + /* opacity: 0; */ + will-change: opacity; + /* background: var(--color-overlay); */ + backdrop-filter: blur(5px) grayscale(1); + transition: opacity var(--duration-modal-overlay-show); + will-change: transform; } +.modal--no-overlay { + background: none; + backdrop-filter: none; +} @keyframes anim-modal-overlay { to { @@ -1102,7 +1116,7 @@ body > #demo-frame { visibility: hidden; top: 0; left: 0; - z-index: 5; + z-index: var(--zindex-modal-overlay); opacity: 0; will-change: opacity; /* background: var(--color-overlay); */