mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Updated official themes to show installed/activated in AdminX
refs https://github.com/TryGhost/Team/issues/3432
This commit is contained in:
parent
ae0989ebea
commit
899fd4d29c
1 changed files with 7 additions and 4 deletions
|
@ -41,6 +41,8 @@ const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
|
|||
}) => {
|
||||
const api = useApi();
|
||||
if (selectedTheme) {
|
||||
const installedTheme = themes.find(theme => theme.name.toLowerCase() === selectedTheme.name.toLowerCase());
|
||||
|
||||
return (
|
||||
<div className='sticky top-0 flex justify-between gap-3 bg-white p-5 px-7'>
|
||||
<div className='flex w-[33%] items-center gap-2'>
|
||||
|
@ -65,16 +67,17 @@ const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
|
|||
/>
|
||||
<Button
|
||||
color='green'
|
||||
label={`Install ${selectedTheme?.name}`}
|
||||
disabled={Boolean(installedTheme)}
|
||||
label={installedTheme?.active ? 'Activated' : (installedTheme ? 'Installed' : `Install ${selectedTheme?.name}`)}
|
||||
onClick={async () => {
|
||||
const data = await api.themes.install(selectedTheme.ref);
|
||||
const installedTheme = data.themes[0];
|
||||
const newlyInstalledTheme = data.themes[0];
|
||||
setThemes([
|
||||
...themes.map(theme => ({...theme, active: false})),
|
||||
installedTheme
|
||||
newlyInstalledTheme
|
||||
]);
|
||||
showToast({
|
||||
message: `Theme installed - ${installedTheme.name}`
|
||||
message: `Theme installed - ${newlyInstalledTheme.name}`
|
||||
});
|
||||
setCurrentTab('installed');
|
||||
}}
|
||||
|
|
Loading…
Add table
Reference in a new issue