fix(fe/bg): dialog bg is always fixed

This commit is contained in:
hexxa 2022-03-19 19:33:33 +08:00 committed by Hexxa
parent f5717b05b1
commit 48cabf9a71
5 changed files with 22 additions and 11 deletions

View file

@ -2,7 +2,7 @@ import * as React from "react";
import { Map } from "immutable";
import { ICoreState, MsgProps, UIProps } from "./core_state";
import { IconProps } from "./visual/icons";
import { IconProps, iconSize } from "./visual/icons";
import { PaneSettings } from "./pane_settings";
import { AdminPane, AdminProps } from "./pane_admin";
@ -43,13 +43,13 @@ export class SettingsDialog extends React.Component<Props, State, {}> {
tabIcons={Map<string, IconProps>({
preferencePane: {
name: "RiSettings3Fill",
size: "1.6rem",
color: "cyan1",
size: iconSize("s"),
color: "focus",
},
managementPane: {
name: "RiWindowFill",
size: "1.6rem",
color: "cyan1",
size: iconSize("s"),
color: "focus",
},
})}
ui={this.props.ui}

View file

@ -765,7 +765,7 @@ export class BgCfg extends React.Component<BgProps, BgState, {}> {
setClientCfg = async () => {
const bgURL = this.props.ui.bg.url;
if (bgURL.length === 0 || bgURL.length >= 4096) {
if (bgURL.length >= 4096) {
alertMsg(this.props.msg.pkg.get("bg.url.alert"));
return;
}

View file

@ -31,6 +31,13 @@ export class RootFrame extends React.Component<Props, State, {}> {
}
makeBgStyle = (): Object => {
if (
this.props.login.preferences.bg.url === "" &&
this.props.ui.bg.url === ""
) {
return {};
}
let bgStyle = undefined;
if (
this.props.login.preferences != null &&
@ -66,7 +73,7 @@ export class RootFrame extends React.Component<Props, State, {}> {
return (
<div id="root-frame" className={`${theme} ${fontSizeClass}`}>
<div id="bg" style={{}}>
<div id="bg" style={bgStyle}>
<Layers
login={this.props.login}
admin={this.props.admin}
@ -76,7 +83,7 @@ export class RootFrame extends React.Component<Props, State, {}> {
update={this.props.update}
/>
<TopBar
<TopBar
login={this.props.login}
msg={this.props.msg}
ui={this.props.ui}