Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
node_modules/
.sass-cache/
build/**
assets/
# Only ignore root-level assets directory (build output), not module assets (source files)
/assets/
hello-elementor/
elementor-hello-theme/
log/
Expand All @@ -13,7 +14,6 @@ Thumbs.db
*.log
*.map
yarn.lock
assets/js/
*.zip
.npmrc
.env
Expand Down
1 change: 1 addition & 0 deletions modules/admin-home/assets/images/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions modules/admin-home/assets/js/components/settings/changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import Dialog from '@elementor/ui/Dialog';
import DialogContent from '@elementor/ui/DialogContent';
import DialogHeader from '@elementor/ui/DialogHeader';
import Typography from '@elementor/ui/Typography';
import { __ } from '@wordpress/i18n';
import Stack from '@elementor/ui/Stack';
import Update from './update';
import Divider from '@elementor/ui/Divider';
import { PlusIcon } from './plus-icon';
import { Fragment } from 'react';

export const ChangelogDialog = ( { open, onClose, whatsNew } ) => {
return (
<Dialog
open={ open }
onClose={ onClose }
maxWidth="sm"
fullWidth
>
<DialogHeader
onClose={ onClose }
variant="outlined"
logo={ <PlusIcon /> }
>
<Typography variant="overline" sx={ { textTransform: 'uppercase', fontWeight: 400, color: 'text.primary' } }>
{ __( 'Changelog', 'hello-elementor' ) }
</Typography>
</DialogHeader>

<DialogContent sx={ { p: 0 } }>
<Stack direction={ 'column' } >
{ whatsNew.map( ( item, index ) => {
return (
<Fragment key={ item.id } >
<Update { ...item } />
{ index !== whatsNew.length - 1 && <Divider /> }
</Fragment>
);
} ) }
</Stack>
</DialogContent>
</Dialog>
);
};
10 changes: 10 additions & 0 deletions modules/admin-home/assets/js/components/settings/plus-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SvgIcon from '@elementor/ui/SvgIcon';
import { ReactComponent as Icon } from '../../../images/plus.svg';

export const PlusIcon = ( props ) => {
return (
<SvgIcon viewBox="0 0 24 24" { ...props }>
<Icon />
</SvgIcon>
);
};
30 changes: 2 additions & 28 deletions modules/admin-home/assets/js/components/settings/settings-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import Paper from '@elementor/ui/Paper';
import { styled } from '@elementor/ui/styles';
import Link from '@elementor/ui/Link';
import Stack from '@elementor/ui/Stack';
import Modal from '@elementor/ui/Modal';
import Update from './update';
import { ChangelogDialog } from './changelog';

const Notices = () => {
const notices = useSelect(
Expand Down Expand Up @@ -75,19 +74,6 @@ const StyledTabs = styled( Tabs )( () => ( {
},
} ) );

const style = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
bgcolor: 'background.paper',
border: '1px solid #000',
boxShadow: 24,
p: 2,
maxHeight: '80vh',
overflowY: 'auto',
};

export const SettingsPage = () => {
const { whatsNew } = useSettingsContext();
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs( 'one' );
Expand Down Expand Up @@ -131,19 +117,7 @@ export const SettingsPage = () => {
<TabPanel { ...getTabPanelProps( 'three' ) }><Theme /></TabPanel>
</Box>
</Paper>
<Modal
open={ open }
onClose={ handleClose }
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>
<Box sx={ style }>
<Typography variant={ 'h4' }>{ __( 'Changelog', 'hello-plus' ) }</Typography>
<Stack direction={ 'column' } gap={ 1 } sx={ { mt: 2 } }>
{ whatsNew.map( ( item ) => <Update key={ item.id } { ...item } /> ) }
</Stack>
</Box>
</Modal>
<ChangelogDialog open={ open } onClose={ handleClose } whatsNew={ whatsNew } />
</>
);
};
18 changes: 13 additions & 5 deletions modules/admin-home/assets/js/components/settings/update.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import Stack from '@elementor/ui/Stack';
import Box from '@elementor/ui/Box';
import Typography from '@elementor/ui/Typography';
import { useMemo } from 'react';

export default function Update( { title, description } ) {
const descriptionToShow = useMemo( () => {
const parser = new DOMParser();
const doc = parser.parseFromString( description, 'text/html' );
const listItems = doc.querySelectorAll( 'li' );
const extractedContent = Array.from( listItems ).map( ( item ) => item.textContent.trim() );
return extractedContent.join( '\n' );
}, [ description ] );
return (
<Stack direction={ 'column' } gap={ 2 }>
<Typography variant={ 'h6' }>{ title }</Typography>
<div dangerouslySetInnerHTML={ { __html: description } } />
</Stack>
<Box sx={ { py: 2, px: 3 } }>
<Typography variant={ 'subtitle1' } sx={ { pb: 0.75 } }>{ title }</Typography>
<Typography variant={ 'body2' } sx={ { whiteSpace: 'pre-line' } }>{ descriptionToShow }</Typography>
</Box>
);
}
Loading