0
Fork 0
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:
Jono Mingard 2023-06-14 15:59:42 +12:00
parent ae0989ebea
commit 899fd4d29c

View file

@ -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');
}}