mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Reset to base theme when no default theme is set and leaving UUID/handle theme
This commit is contained in:

committed by
Tim Donohue

parent
4e14bc0b78
commit
7352d9e273
@@ -29,7 +29,7 @@ export const themeStateSelector = createFeatureSelector<ThemeState>('theme');
|
||||
|
||||
export const currentThemeSelector = createSelector(
|
||||
themeStateSelector,
|
||||
(state: ThemeState): string => hasValue(state) ? state.currentTheme : undefined
|
||||
(state: ThemeState): string => hasValue(state) ? state.currentTheme : BASE_THEME_NAME,
|
||||
);
|
||||
|
||||
@Injectable({
|
||||
@@ -262,7 +262,7 @@ export class ThemeService {
|
||||
}
|
||||
|
||||
// inherit the head tags of the default theme
|
||||
return this.createHeadTags(defaultThemeConfig.name);
|
||||
return this.createHeadTags(defaultThemeName);
|
||||
}
|
||||
|
||||
return headTagConfigs.map(this.createHeadTag.bind(this));
|
||||
@@ -425,9 +425,10 @@ export class ThemeService {
|
||||
* @private
|
||||
*/
|
||||
private getActionForMatch(newTheme: Theme, currentThemeName: string): SetThemeAction | NoOpAction {
|
||||
if (hasValue(newTheme) && newTheme.config.name !== currentThemeName) {
|
||||
const newThemeName: string = newTheme?.config.name ?? BASE_THEME_NAME;
|
||||
if (newThemeName !== currentThemeName) {
|
||||
// If we have a match, and it isn't already the active theme, set it as the new theme
|
||||
return new SetThemeAction(newTheme.config.name);
|
||||
return new SetThemeAction(newThemeName);
|
||||
} else {
|
||||
// Otherwise, do nothing
|
||||
return new NoOpAction();
|
||||
|
@@ -5,7 +5,8 @@ import { environment } from '../environments/environment';
|
||||
import { hasNoValue } from '../app/shared/empty.util';
|
||||
|
||||
import { AppConfig } from './app-config.interface';
|
||||
import { ThemeConfig } from './theme.model';
|
||||
import { ThemeConfig, NamedThemeConfig } from './theme.model';
|
||||
import { BASE_THEME_NAME } from '../app/shared/theme-support/theme.constants';
|
||||
|
||||
/**
|
||||
* Extend Angular environment with app config.
|
||||
@@ -44,7 +45,9 @@ const getDefaultThemeConfig = (): ThemeConfig => {
|
||||
hasNoValue(themeConfig.regex) &&
|
||||
hasNoValue(themeConfig.handle) &&
|
||||
hasNoValue(themeConfig.uuid)
|
||||
);
|
||||
) ?? {
|
||||
name: BASE_THEME_NAME,
|
||||
} as NamedThemeConfig;
|
||||
};
|
||||
|
||||
export {
|
||||
|
Reference in New Issue
Block a user