Show missing loading placeholders
This commit is contained in:
@@ -19,6 +19,7 @@ import { MutableListSetting } from '@/components/settings/MutableListSetting.tsx
|
|||||||
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx';
|
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx';
|
||||||
import { ActiveDevice, DEFAULT_DEVICE } from '@/util/device.ts';
|
import { ActiveDevice, DEFAULT_DEVICE } from '@/util/device.ts';
|
||||||
import { Select } from '@/components/atoms/Select.tsx';
|
import { Select } from '@/components/atoms/Select.tsx';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
export const DeviceSetting = () => {
|
export const DeviceSetting = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -39,6 +40,7 @@ export const DeviceSetting = () => {
|
|||||||
const {
|
const {
|
||||||
metadata,
|
metadata,
|
||||||
settings: { devices },
|
settings: { devices },
|
||||||
|
loading,
|
||||||
} = useMetadataServerSettings();
|
} = useMetadataServerSettings();
|
||||||
|
|
||||||
const { activeDevice, setActiveDevice } = useContext(ActiveDevice);
|
const { activeDevice, setActiveDevice } = useContext(ActiveDevice);
|
||||||
@@ -61,6 +63,10 @@ export const DeviceSetting = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<MutableListSetting
|
<MutableListSetting
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { EditTextPreference } from '@/components/sourceConfiguration/EditTextPre
|
|||||||
import { MultiSelectListPreference } from '@/components/sourceConfiguration/MultiSelectListPreference';
|
import { MultiSelectListPreference } from '@/components/sourceConfiguration/MultiSelectListPreference';
|
||||||
import { PreferenceProps } from '@/typings.ts';
|
import { PreferenceProps } from '@/typings.ts';
|
||||||
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
|
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
function getPrefComponent(type: string) {
|
function getPrefComponent(type: string) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -51,7 +52,7 @@ export function SourceConfigure() {
|
|||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { sourceId } = useParams<{ sourceId: string }>();
|
const { sourceId } = useParams<{ sourceId: string }>();
|
||||||
const { data } = requestManager.useGetSource(sourceId);
|
const { data, loading } = requestManager.useGetSource(sourceId);
|
||||||
const sourcePreferences = data?.source.preferences ?? [];
|
const sourcePreferences = data?.source.preferences ?? [];
|
||||||
|
|
||||||
const updateValue =
|
const updateValue =
|
||||||
@@ -60,6 +61,10 @@ export function SourceConfigure() {
|
|||||||
requestManager.setSourcePreferences(sourceId, { position, [type]: value });
|
requestManager.setSourcePreferences(sourceId, { position, [type]: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List sx={{ padding: 0 }}>
|
<List sx={{ padding: 0 }}>
|
||||||
{sourcePreferences.map((it, index) => {
|
{sourcePreferences.map((it, index) => {
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export function About() {
|
|||||||
|
|
||||||
useSetDefaultBackTo('settings');
|
useSetDefaultBackTo('settings');
|
||||||
|
|
||||||
const { data } = requestManager.useGetAbout();
|
const { data, loading } = requestManager.useGetAbout();
|
||||||
const { aboutServer, aboutWebUI } = data ?? {};
|
const { aboutServer, aboutWebUI } = data ?? {};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -235,6 +235,10 @@ export function About() {
|
|||||||
!!selectedServerChannelInfo?.tag && selectedServerChannelInfo.tag !== getVersion(aboutServer);
|
!!selectedServerChannelInfo?.tag && selectedServerChannelInfo.tag !== getVersion(aboutServer);
|
||||||
const isWebUIUpdateAvailable = !!webUIUpdateData?.checkForWebUIUpdate.updateAvailable;
|
const isWebUIUpdateAvailable = !!webUIUpdateData?.checkForWebUIUpdate.updateAvailable;
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<List
|
<List
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { TextSetting } from '@/components/settings/text/TextSetting.tsx';
|
|||||||
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
||||||
import { TimeSetting } from '@/components/settings/TimeSetting.tsx';
|
import { TimeSetting } from '@/components/settings/TimeSetting.tsx';
|
||||||
import { ServerSettings } from '@/typings.ts';
|
import { ServerSettings } from '@/typings.ts';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
type BackupSettingsType = Pick<ServerSettings, 'backupPath' | 'backupTime' | 'backupInterval' | 'backupTTL'>;
|
type BackupSettingsType = Pick<ServerSettings, 'backupPath' | 'backupTime' | 'backupInterval' | 'backupTTL'>;
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ export function Backup() {
|
|||||||
|
|
||||||
useSetDefaultBackTo('settings');
|
useSetDefaultBackTo('settings');
|
||||||
|
|
||||||
const { data: settingsData } = requestManager.useGetServerSettings();
|
const { data: settingsData, loading } = requestManager.useGetServerSettings();
|
||||||
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
||||||
|
|
||||||
const backupSettings = settingsData ? extractBackupSettings(settingsData.settings) : undefined;
|
const backupSettings = settingsData ? extractBackupSettings(settingsData.settings) : undefined;
|
||||||
@@ -223,6 +224,10 @@ export function Backup() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<List sx={{ padding: 0 }}>
|
<List sx={{ padding: 0 }}>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
createUpdateMetadataServerSettings,
|
createUpdateMetadataServerSettings,
|
||||||
useMetadataServerSettings,
|
useMetadataServerSettings,
|
||||||
} from '@/lib/metadata/metadataServerSettings.ts';
|
} from '@/lib/metadata/metadataServerSettings.ts';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
type ExtensionsSettings = Pick<GqlServerSettings, 'maxSourcesInParallel' | 'localSourcePath' | 'extensionRepos'>;
|
type ExtensionsSettings = Pick<GqlServerSettings, 'maxSourcesInParallel' | 'localSourcePath' | 'extensionRepos'>;
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ export const BrowseSettings = () => {
|
|||||||
|
|
||||||
const [showNsfw, setShowNsfw] = useLocalStorage<boolean>('showNsfw', true);
|
const [showNsfw, setShowNsfw] = useLocalStorage<boolean>('showNsfw', true);
|
||||||
|
|
||||||
const { data } = requestManager.useGetServerSettings();
|
const { data, loading } = requestManager.useGetServerSettings();
|
||||||
const serverSettings = data ? extractBrowseSettings(data.settings) : undefined;
|
const serverSettings = data ? extractBrowseSettings(data.settings) : undefined;
|
||||||
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
||||||
|
|
||||||
@@ -61,6 +62,10 @@ export const BrowseSettings = () => {
|
|||||||
} = useMetadataServerSettings();
|
} = useMetadataServerSettings();
|
||||||
const updateMetadataServerSettings = createUpdateMetadataServerSettings<keyof MetadataBrowseSettings>();
|
const updateMetadataServerSettings = createUpdateMetadataServerSettings<keyof MetadataBrowseSettings>();
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { StrictModeDroppable } from '@/lib/StrictModeDroppable';
|
|||||||
import { DEFAULT_FULL_FAB_HEIGHT } from '@/components/util/StyledFab';
|
import { DEFAULT_FULL_FAB_HEIGHT } from '@/components/util/StyledFab';
|
||||||
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
||||||
import { TCategory } from '@/typings.ts';
|
import { TCategory } from '@/typings.ts';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
const getItemStyle = (
|
const getItemStyle = (
|
||||||
isDragging: boolean,
|
isDragging: boolean,
|
||||||
@@ -62,7 +63,7 @@ export function Categories() {
|
|||||||
};
|
};
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { data } = requestManager.useGetCategories();
|
const { data, loading } = requestManager.useGetCategories({ notifyOnNetworkStatusChange: true });
|
||||||
const categories = useMemo(() => {
|
const categories = useMemo(() => {
|
||||||
const res = [...(data?.categories.nodes ?? [])];
|
const res = [...(data?.categories.nodes ?? [])];
|
||||||
if (res.length > 0 && res[0].name === 'Default') {
|
if (res.length > 0 && res[0].name === 'Default') {
|
||||||
@@ -135,6 +136,10 @@ export function Categories() {
|
|||||||
requestManager.deleteCategory(category.id);
|
requestManager.deleteCategory(category.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DragDropContext onDragEnd={onDragEnd}>
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { makeToast } from '@/components/util/Toast.tsx';
|
|||||||
import { DeleteChaptersWhileReadingSetting } from '@/components/settings/downloads/DeleteChaptersWhileReadingSetting.tsx';
|
import { DeleteChaptersWhileReadingSetting } from '@/components/settings/downloads/DeleteChaptersWhileReadingSetting.tsx';
|
||||||
import { CategoriesInclusionSetting } from '@/components/settings/CategoriesInclusionSetting.tsx';
|
import { CategoriesInclusionSetting } from '@/components/settings/CategoriesInclusionSetting.tsx';
|
||||||
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
type DownloadSettingsType = Pick<
|
type DownloadSettingsType = Pick<
|
||||||
ServerSettings,
|
ServerSettings,
|
||||||
@@ -80,6 +81,10 @@ export const DownloadSettings = () => {
|
|||||||
makeToast(t('global.error.label.failed_to_save_changes'), 'error'),
|
makeToast(t('global.error.label.failed_to_save_changes'), 'error'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<TextSetting
|
<TextSetting
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { TextSetting } from '@/components/settings/text/TextSetting.tsx';
|
|||||||
import { ServerSettings as GqlServerSettings } from '@/typings.ts';
|
import { ServerSettings as GqlServerSettings } from '@/typings.ts';
|
||||||
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
import { NumberSetting } from '@/components/settings/NumberSetting.tsx';
|
||||||
import { SelectSetting } from '@/components/settings/SelectSetting.tsx';
|
import { SelectSetting } from '@/components/settings/SelectSetting.tsx';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
type ServerSettingsType = Pick<
|
type ServerSettingsType = Pick<
|
||||||
GqlServerSettings,
|
GqlServerSettings,
|
||||||
@@ -83,7 +84,7 @@ export const ServerSettings = () => {
|
|||||||
};
|
};
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { data } = requestManager.useGetServerSettings();
|
const { data, loading } = requestManager.useGetServerSettings();
|
||||||
const serverSettings = data ? extractServerSettings(data.settings) : undefined;
|
const serverSettings = data ? extractServerSettings(data.settings) : undefined;
|
||||||
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
||||||
|
|
||||||
@@ -102,6 +103,10 @@ export const ServerSettings = () => {
|
|||||||
mutateSettings({ variables: { input: { settings: { [setting]: value } } } });
|
mutateSettings({ variables: { input: { settings: { [setting]: value } } } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<List
|
<List
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
SelectSettingValueDisplayInfo,
|
SelectSettingValueDisplayInfo,
|
||||||
} from '@/components/settings/SelectSetting.tsx';
|
} from '@/components/settings/SelectSetting.tsx';
|
||||||
import { WebUiChannel, WebUiFlavor, WebUiInterface } from '@/lib/graphql/generated/graphql.ts';
|
import { WebUiChannel, WebUiFlavor, WebUiInterface } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||||
|
|
||||||
type WebUISettingsType = Pick<
|
type WebUISettingsType = Pick<
|
||||||
ServerSettings,
|
ServerSettings,
|
||||||
@@ -124,7 +125,7 @@ export const WebUISettings = () => {
|
|||||||
};
|
};
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { data } = requestManager.useGetServerSettings();
|
const { data, loading } = requestManager.useGetServerSettings();
|
||||||
const webUISettings = data ? extractWebUISettings(data.settings) : undefined;
|
const webUISettings = data ? extractWebUISettings(data.settings) : undefined;
|
||||||
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
const [mutateSettings] = requestManager.useUpdateServerSettings();
|
||||||
|
|
||||||
@@ -141,6 +142,10 @@ export const WebUISettings = () => {
|
|||||||
mutateSettings({ variables: { input: { settings: { [setting]: value } } } });
|
mutateSettings({ variables: { input: { settings: { [setting]: value } } } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <LoadingPlaceholder />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<SelectSetting<WebUiFlavor>
|
<SelectSetting<WebUiFlavor>
|
||||||
|
|||||||
Reference in New Issue
Block a user