feat: fix application edit page crash and language icon position (#1511)

* fix: widget position and color

* feat: fix applicationEdit crush
This commit is contained in:
Yaodong Yu
2023-02-01 23:11:48 +08:00
committed by GitHub
parent 95b32d5ebf
commit cc6ea1b60e
3 changed files with 8 additions and 9 deletions

View File

@ -764,7 +764,7 @@ class ApplicationEditPage extends React.Component {
} }
renderSignupSigninPreview() { renderSignupSigninPreview() {
const themeData = this.state.application.themeData; const themeData = this.state.application.themeData ?? Setting.ThemeDefault;
let signUpUrl = `/signup/${this.state.application.name}`; let signUpUrl = `/signup/${this.state.application.name}`;
const signInUrl = `/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`; const signInUrl = `/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`;
const maskStyle = {position: "absolute", top: "0px", left: "0px", zIndex: 10, height: "97%", width: "100%", background: "rgba(0,0,0,0.4)"}; const maskStyle = {position: "absolute", top: "0px", left: "0px", zIndex: 10, height: "97%", width: "100%", background: "rgba(0,0,0,0.4)"};
@ -835,7 +835,7 @@ class ApplicationEditPage extends React.Component {
} }
renderPromptPreview() { renderPromptPreview() {
const themeData = this.state.application.themeData; const themeData = this.state.application.themeData ?? Setting.ThemeDefault;
const promptUrl = `/prompt/${this.state.application.name}`; const promptUrl = `/prompt/${this.state.application.name}`;
const maskStyle = {position: "absolute", top: "0px", left: "0px", zIndex: 10, height: "100%", width: "100%", background: "rgba(0,0,0,0.4)"}; const maskStyle = {position: "absolute", top: "0px", left: "0px", zIndex: 10, height: "100%", width: "100%", background: "rgba(0,0,0,0.4)"};
return ( return (

View File

@ -55,8 +55,8 @@ class SelectLanguageBox extends React.Component {
return ( return (
<Dropdown menu={{items: languageItems, onClick}} > <Dropdown menu={{items: languageItems, onClick}} >
<div className="select-box" style={{display: languageItems.length === 0 ? "none" : null}} > <div className="select-box" style={{display: languageItems.length === 0 ? "none" : null, ...this.props.style}} >
<GlobalOutlined style={{fontSize: "24px"}} /> <GlobalOutlined style={{fontSize: "24px", color: "#4d4d4d"}} />
</div> </div>
</Dropdown> </Dropdown>
); );

View File

@ -21,9 +21,9 @@ import {CheckOutlined} from "@ant-design/icons";
import {CompactTheme, DarkTheme, Light} from "antd-token-previewer/es/icons"; import {CompactTheme, DarkTheme, Light} from "antd-token-previewer/es/icons";
export const Themes = [ export const Themes = [
{label: "Default", key: "default", icon: <Light style={{fontSize: "24px"}} />}, // i18next.t("theme:Default") {label: "Default", key: "default", icon: <Light style={{fontSize: "24px", color: "#4d4d4d"}} />}, // i18next.t("theme:Default")
{label: "Dark", key: "dark", icon: <DarkTheme style={{fontSize: "24px"}} />}, // i18next.t("theme:Dark") {label: "Dark", key: "dark", icon: <DarkTheme style={{fontSize: "24px", color: "#4d4d4d"}} />}, // i18next.t("theme:Dark")
{label: "Compact", key: "compact", icon: <CompactTheme style={{fontSize: "24px"}} />}, // i18next.t("theme:Compact") {label: "Compact", key: "compact", icon: <CompactTheme style={{fontSize: "24px", color: "#4d4d4d"}} />}, // i18next.t("theme:Compact")
]; ];
function getIcon(themeKey) { function getIcon(themeKey) {
@ -82,8 +82,7 @@ class SelectThemeBox extends React.Component {
selectable: true, selectable: true,
multiple: true, multiple: true,
selectedKeys: [...this.props.themeAlgorithm], selectedKeys: [...this.props.themeAlgorithm],
}} }}>
trigger={["click"]}>
<div className="select-box"> <div className="select-box">
{this.icon} {this.icon}
</div> </div>