From 483e74358548a6893d8bc922864b47535ac9057c Mon Sep 17 00:00:00 2001 From: Nicola Peluchetti Date: Mon, 8 Sep 2025 17:23:22 +0200 Subject: [PATCH] Tweak: improve changelog appearance [TMZ-928] (#543) --- .gitignore | 4 +- modules/admin-home/assets/images/plus.svg | 1 + .../js/components/settings/changelog.js | 44 +++++++++++++++++++ .../js/components/settings/plus-icon.js | 10 +++++ .../js/components/settings/settings-page.js | 30 +------------ .../assets/js/components/settings/update.js | 18 +++++--- 6 files changed, 72 insertions(+), 35 deletions(-) create mode 100644 modules/admin-home/assets/images/plus.svg create mode 100644 modules/admin-home/assets/js/components/settings/changelog.js create mode 100644 modules/admin-home/assets/js/components/settings/plus-icon.js diff --git a/.gitignore b/.gitignore index 7443871..4a3bc0c 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ @@ -13,7 +14,6 @@ Thumbs.db *.log *.map yarn.lock -assets/js/ *.zip .npmrc .env diff --git a/modules/admin-home/assets/images/plus.svg b/modules/admin-home/assets/images/plus.svg new file mode 100644 index 0000000..ceedebe --- /dev/null +++ b/modules/admin-home/assets/images/plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/admin-home/assets/js/components/settings/changelog.js b/modules/admin-home/assets/js/components/settings/changelog.js new file mode 100644 index 0000000..72e824f --- /dev/null +++ b/modules/admin-home/assets/js/components/settings/changelog.js @@ -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 ( + + } + > + + { __( 'Changelog', 'hello-elementor' ) } + + + + + + { whatsNew.map( ( item, index ) => { + return ( + + + { index !== whatsNew.length - 1 && } + + ); + } ) } + + + + ); +}; diff --git a/modules/admin-home/assets/js/components/settings/plus-icon.js b/modules/admin-home/assets/js/components/settings/plus-icon.js new file mode 100644 index 0000000..5d1c868 --- /dev/null +++ b/modules/admin-home/assets/js/components/settings/plus-icon.js @@ -0,0 +1,10 @@ +import SvgIcon from '@elementor/ui/SvgIcon'; +import { ReactComponent as Icon } from '../../../images/plus.svg'; + +export const PlusIcon = ( props ) => { + return ( + + + + ); +}; diff --git a/modules/admin-home/assets/js/components/settings/settings-page.js b/modules/admin-home/assets/js/components/settings/settings-page.js index 57d9942..7c5f128 100644 --- a/modules/admin-home/assets/js/components/settings/settings-page.js +++ b/modules/admin-home/assets/js/components/settings/settings-page.js @@ -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( @@ -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' ); @@ -131,19 +117,7 @@ export const SettingsPage = () => { - - - { __( 'Changelog', 'hello-plus' ) } - - { whatsNew.map( ( item ) => ) } - - - + ); }; diff --git a/modules/admin-home/assets/js/components/settings/update.js b/modules/admin-home/assets/js/components/settings/update.js index 06baf9f..143dcc4 100644 --- a/modules/admin-home/assets/js/components/settings/update.js +++ b/modules/admin-home/assets/js/components/settings/update.js @@ -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 ( - - { title } -
- + + { title } + { descriptionToShow } + ); }