Skip to content

Commit 32537b7

Browse files
committed
Show available update version
1 parent 9139b11 commit 32537b7

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

plugin/assets/src/settings/components/integrations/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const Integrations = () => {
7979
lastUpdated={ state.updaters[ key ].lastUpdated }
8080
type={ UPDATERS[ key ].type }
8181
displayUpdatedOn={ UPDATERS[ key ].displayUpdatedOn }
82+
versionAvailable={ UPDATERS[ key ].versionAvailable }
8283
/>
8384
) ) }
8485
</div>

plugin/assets/src/settings/components/integrations/updater.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const Updater = ( {
4343
checked,
4444
type,
4545
displayUpdatedOn,
46+
versionAvailable,
4647
} ) => {
4748
const [ id ] = useState( _uniqueId( 'updater-' ) );
4849
const { state, dispatch } = useContext( SettingsContext );
@@ -90,7 +91,7 @@ const Updater = ( {
9091
return (
9192
<div
9293
className={ classNames( 'material-settings__updater', {
93-
'no__last-update': false === displayUpdatedOn,
94+
'no__last-update': false === displayUpdatedOn && ! versionAvailable,
9495
} ) }
9596
>
9697
<div className="mdc-layout-grid">
@@ -124,6 +125,15 @@ const Updater = ( {
124125
) }
125126
</p>
126127
) }
128+
129+
{ versionAvailable && (
130+
<p className="mdc-typography--body1">
131+
{ sprintf(
132+
__( 'New version %s is available.', 'material-design' ),
133+
versionAvailable
134+
) }
135+
</p>
136+
) }
127137
</div>
128138

129139
<div className="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 mdc-layout-grid__cell--align-middle material-settings__cell--justify-end">

plugin/assets/src/settings/constants.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export const UPDATERS = {
5656
type: 'PLUGIN',
5757
lastUpdated: false,
5858
needsKey: false,
59-
updateAvailable: 1 === parseInt( getConfig( 'pluginUpdateStatus' ), 10 ),
59+
updateAvailable: '0' !== String( getConfig( 'pluginUpdateStatus' ) ),
60+
versionAvailable: getConfig( 'pluginUpdateStatus' ),
6061
autoUpdates: parseInt( getConfig( 'pluginAutoUpdate' ), 10 ),
6162
displayUpdatedOn: false,
6263
},
@@ -65,7 +66,8 @@ export const UPDATERS = {
6566
type: 'THEME',
6667
lastUpdated: false,
6768
needsKey: false,
68-
updateAvailable: 1 === parseInt( getConfig( 'themeUpdateStatus' ), 10 ),
69+
updateAvailable: '0' !== String( getConfig( 'themeUpdateStatus' ) ),
70+
versionAvailable: getConfig( 'themeUpdateStatus' ),
6971
autoUpdates: parseInt( getConfig( 'themeAutoUpdate' ), 10 ),
7072
displayUpdatedOn: false,
7173
},

0 commit comments

Comments
 (0)