mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(app): read instance theme color without an active runtime (#3391)
This commit is contained in:
1 parent
0967bf3136
commit
b07dcc368d
1 file changed
+10
-3
@@ -22,6 +22,7 @@ import {useTabKeyFocusGuard} from '@app/features/app/hooks/useTabKeyFocusGuard';
|
||||
import {type LayoutVariant, LayoutVariantProvider} from '@app/features/app/state/LayoutVariantContext';
|
||||
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
|
||||
import RuntimeCrash from '@app/features/app/state/RuntimeCrash';
|
||||
import DeveloperOptions from '@app/features/devtools/state/DeveloperOptions';
|
||||
import {showMyselfTypingHelper} from '@app/features/devtools/utils/ShowMyselfTypingHelper';
|
||||
import GatewayConnection from '@app/features/gateway/transport/GatewayConnection';
|
||||
import GatewaySessions from '@app/features/gateway/transport/GatewaySessionPool';
|
||||
@@ -83,6 +84,14 @@ interface AppWrapperProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
function getInstanceThemeColor(): string | null {
|
||||
const snapshot = RuntimeConfig.getSnapshotOrNull();
|
||||
if (snapshot === null || !(DeveloperOptions.selfHostedModeOverride || snapshot.features.self_hosted)) {
|
||||
return null;
|
||||
}
|
||||
return snapshot.appPublic.branding.theme_color ?? null;
|
||||
}
|
||||
|
||||
export const AppWrapper = observer(({children}: AppWrapperProps) => {
|
||||
const {i18n} = useLingui();
|
||||
const reducedMotion = Accessibility.useReducedMotion;
|
||||
@@ -191,9 +200,7 @@ export const AppWrapper = observer(({children}: AppWrapperProps) => {
|
||||
messageGutter: Accessibility.messageGutter,
|
||||
messageGroupSpacing: Accessibility.getMessageGroupSpacingValue(messageDisplayCompact),
|
||||
hdrDisplayMode: Accessibility.hdrDisplayMode,
|
||||
instanceThemeColor: RuntimeConfig.isSelfHosted()
|
||||
? (RuntimeConfig.getSnapshotOrNull()?.appPublic.branding.theme_color ?? null)
|
||||
: null,
|
||||
instanceThemeColor: getInstanceThemeColor(),
|
||||
});
|
||||
useCustomThemeStyle({
|
||||
enabledThemeCss: ThemeLibrary.activeThemeCss,
|
||||
|
||||
Reference in new issue
Block a user