24 lines
1.6 KiB
TypeScript
24 lines
1.6 KiB
TypeScript
// Metro module 8826 (f8827).
|
|
import UnsyncedUserSettingsStore from "../../user_settings/UnsyncedUserSettingsStore";
|
|
import ClientThemesBackgroundStore from "../ClientThemesBackgroundStore";
|
|
import CustomThemeMobileStore from "./CustomThemeMobileStore";
|
|
import { ActiveThemeType, SystemThemeState } from "../../user_settings/ThemeConstants";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import useRoutedActiveGuildTheme from "../../guild_themes/native/useRoutedActiveGuildTheme";
|
|
const useActiveThemeType = function useActiveThemeType() {
|
|
const stateFromStores = useStateFromStores([CustomThemeMobileStore], () => CustomThemeMobileStore.hasCustomTheme());
|
|
const stateFromStores2 = useStateFromStores([ClientThemesBackgroundStore], () => ClientThemesBackgroundStore.gradientPreset != null);
|
|
const routedActiveGuildTheme = useRoutedActiveGuildTheme();
|
|
const stateFromStores3 = useStateFromStores([UnsyncedUserSettingsStore], () => UnsyncedUserSettingsStore.useSystemTheme);
|
|
const ON = SystemThemeState.ON;
|
|
return routedActiveGuildTheme?.type === "custom" ? ActiveThemeType.CUSTOM : routedActiveGuildTheme?.type === "preset" ? ActiveThemeType.CLIENT : stateFromStores ? ActiveThemeType.CUSTOM : stateFromStores2 ? ActiveThemeType.CLIENT : stateFromStores3 === ON ? ActiveThemeType.SYSTEM : ActiveThemeType.DEFAULT;
|
|
};
|
|
export function useIsCustomThemeActive() {
|
|
return useActiveThemeType() === ActiveThemeType.CUSTOM;
|
|
}
|
|
export function useIsClientThemeOrCustomThemeActive() {
|
|
const activeThemeType = useActiveThemeType();
|
|
return activeThemeType === ActiveThemeType.CLIENT || activeThemeType === ActiveThemeType.CUSTOM;
|
|
}
|
|
export { useActiveThemeType };
|