Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connect modal #111

Merged
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c5eeb17
Initial refactor commit
bainternet Oct 20, 2024
c641495
✅ Added build and tests CI/CD
bainternet Oct 22, 2024
c003cf7
update: add src for admin settings
nirbhayel Oct 25, 2024
21987b4
update: incorrect constant names
nirbhayel Oct 25, 2024
6333248
update: namespace
nirbhayel Oct 25, 2024
ebd2df1
add: accessibility settings
nirbhayel Oct 25, 2024
9e3bc10
update: webpack to output files inside a folder
nirbhayel Oct 28, 2024
9757cda
update: build output folders
nirbhayel Oct 29, 2024
b0dafef
update: removed commented code
nirbhayel Oct 29, 2024
2ceabd3
update: npm scripts
nirbhayel Oct 29, 2024
1a87560
add: webpack config
nirbhayel Oct 29, 2024
d0a1b8f
add: hooks
nirbhayel Oct 29, 2024
2566690
update: move admin setting to the module folder
nirbhayel Oct 29, 2024
96fec7c
update: assets loading logic
nirbhayel Oct 29, 2024
32a2057
update: add rule to move jsx props to multiline imporving readability
nirbhayel Oct 29, 2024
dcb1245
add: connect modal
nirbhayel Oct 29, 2024
a1f7b68
update: hooks import for better readability
nirbhayel Oct 29, 2024
d6d1ab6
update: replace functions with hooks
nirbhayel Oct 29, 2024
2575f9a
Merge branch 'develop' into feature/APP-764-not-connected-modal
nirbhayel Nov 7, 2024
9059b07
fix: alignment and style
nirbhayel Nov 11, 2024
b8519d7
update: imports
nirbhayel Nov 11, 2024
e43dea9
Merge branch 'feature/APP-764-not-connected-modal' of github.com:nirb…
nirbhayel Nov 11, 2024
053e3d2
update: removed conflicting imports
nirbhayel Nov 11, 2024
e77929c
fix: add compatibility for mobile devices
nirbhayel Nov 13, 2024
92a3c77
Merge remote-tracking branch 'elementor/develop' into feature/APP-764…
nirbhayel Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"rules": {
"no-console": "off",
"react-hooks/exhaustive-deps": "off",
"react/jsx-max-props-per-line": [1, { "maximum": { "single": 2, "multi": 1 } }],
"strict": [ "error", "global" ],
"curly": "warn",
"import/order": [
Expand Down
2 changes: 2 additions & 0 deletions modules/settings/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import '../css/style.css';
import DirectionProvider from '@elementor/ui/DirectionProvider';
import { ThemeProvider } from '@elementor/ui/styles';
import { ConnectModal } from './components';

const App = () => {
return (
<DirectionProvider rtl={ false /* Add RTL detection in settings */ }>
<ThemeProvider colorScheme="light">
<ConnectModal />
</ThemeProvider>
</DirectionProvider>
);
Expand Down

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions modules/settings/assets/js/components/connect-modal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import Box from '@elementor/ui/Box';
import Button from '@elementor/ui/Button';
import Grid from '@elementor/ui/Grid';
import Modal from '@elementor/ui/Modal';
import Typography from '@elementor/ui/Typography';
import { __ } from '@wordpress/i18n';
import { useAuth, useModal } from '../../hooks';

function ConnectModal() {
const { isOpen } = useModal();
const { redirectToConnect } = useAuth();

return (
<Modal open={ isOpen }>
<Grid container
gap={ 2 }
direction="column"
justifyContent="start"
alignItems="center"
sx={ {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 600,
nirbhayel marked this conversation as resolved.
Show resolved Hide resolved
height: 400,
bgcolor: 'background.paper',
boxShadow: 24,
paddingBottom: 5,
textAlign: 'center',
borderRadius: '4px',
} }>
<Box component="div" sx={ { background: '#000', width: '100%', height: '200px' } }></Box>
<Typography variant="subtitle1"
marginTop={ 5 }
marginBottom={ 3 }>
{ __( 'Connect plugin on your site!', 'pojo-accessibility' ) }
</Typography>
<Button variant="contained"
color="info"
size="large"
onClick={ redirectToConnect }>
{ __( 'Connect', 'pojo-accessibility' ) }
</Button>
</Grid>
</Modal>
);
}

export default ConnectModal;
1 change: 1 addition & 0 deletions modules/settings/assets/js/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ConnectModal } from './connect-modal';
2 changes: 2 additions & 0 deletions modules/settings/assets/js/hooks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { useAuth } from './use-auth';
export { useModal } from './use-modal';
5 changes: 1 addition & 4 deletions modules/settings/assets/js/hooks/use-auth.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import API from '../api';
import { UPGRADE_LINK } from '../constants';
import { usePluginSettingsContext } from '../context/plugin-settings-context';

const useAuth = () => {
export const useAuth = () => {
const { subscriptionId } = 123;

const redirectToConnect = async () => {
Expand All @@ -29,5 +28,3 @@ const useAuth = () => {
getUpgradeLink,
};
};

export default useAuth;
3 changes: 1 addition & 2 deletions modules/settings/assets/js/hooks/use-modal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from '@wordpress/element';

const useModal = ( defaultIsOpen = true ) => {
export const useModal = ( defaultIsOpen = true ) => {
const [ isOpen, setIsOpen ] = useState( defaultIsOpen );

const open = () => {
Expand All @@ -19,4 +19,3 @@ const useModal = ( defaultIsOpen = true ) => {
};
};

export default useModal;
Loading