Add splash screen backdrop to login page
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { clearBackdrop, setBackdrops } from '../components/backdrop/backdrop';
|
||||
import { clearBackdrop, setBackdropImages, setBackdrops } from '../components/backdrop/backdrop';
|
||||
import * as userSettings from './settings/userSettings';
|
||||
import libraryMenu from './libraryMenu';
|
||||
import { pageClassOn } from '../utils/dashboard';
|
||||
import { queryClient } from 'utils/query/queryClient';
|
||||
import { getBrandingOptionsQuery } from 'apps/dashboard/features/branding/api/useBrandingOptions';
|
||||
import ServerConnections from 'components/ServerConnections';
|
||||
import { SPLASHSCREEN_URL } from 'constants/branding';
|
||||
|
||||
const cache = {};
|
||||
|
||||
@@ -43,7 +47,7 @@ function getBackdropItemIds(apiClient, userId, types, parentId) {
|
||||
}
|
||||
|
||||
function showBackdrop(type, parentId) {
|
||||
const apiClient = window.ApiClient;
|
||||
const apiClient = ServerConnections.currentApiClient();
|
||||
|
||||
if (apiClient) {
|
||||
getBackdropItemIds(apiClient, apiClient.getCurrentUserId(), type, parentId).then(function (images) {
|
||||
@@ -59,13 +63,27 @@ function showBackdrop(type, parentId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function showSplashScreen() {
|
||||
const api = ServerConnections.getCurrentApi();
|
||||
const brandingOptions = await queryClient.fetchQuery(getBrandingOptionsQuery(api));
|
||||
if (brandingOptions.SplashscreenEnabled) {
|
||||
setBackdropImages([
|
||||
api.getUri(SPLASHSCREEN_URL, { t: Date.now() })
|
||||
]);
|
||||
} else {
|
||||
clearBackdrop();
|
||||
}
|
||||
}
|
||||
|
||||
pageClassOn('pageshow', 'page', function () {
|
||||
const page = this;
|
||||
|
||||
if (!page.classList.contains('selfBackdropPage')) {
|
||||
if (page.classList.contains('backdropPage')) {
|
||||
if (enabled()) {
|
||||
const type = page.getAttribute('data-backdroptype');
|
||||
const type = page.getAttribute('data-backdroptype');
|
||||
if (type === 'splashscreen') {
|
||||
showSplashScreen();
|
||||
} else if (enabled()) {
|
||||
const parentId = page.classList.contains('globalBackdropPage') ? '' : libraryMenu.getTopParentId();
|
||||
showBackdrop(type, parentId);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user