Skip to content

Commit b649fa9

Browse files
added button for deleting branding
1 parent 3d40b30 commit b649fa9

File tree

4 files changed

+45
-7
lines changed

4 files changed

+45
-7
lines changed

client/packages/lowcoder/src/app.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ const Wrapper = React.memo((props: {
8585
return {
8686
hashed: false,
8787
token: {
88-
fontFamily: `${props.fontFamily ? props.fontFamily.split('+').join(' ') : 'Roboto'}, sans-serif`,
88+
fontFamily: `${
89+
props.fontFamily
90+
? props.fontFamily.split('+').join(' ')
91+
: `-apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Segoe UI", "PingFang SC",
92+
"Microsoft Yahei", "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
93+
"Segoe UI Symbol", "Noto Color Emoji"`
94+
}, sans-serif`,
8995
},
9096
}
9197
}, [props.fontFamily]);

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,9 @@ export const en = {
31123112
"whatsNewSection": "Documentation Settings",
31133113
"whatsNewLink": "What's New Link",
31143114
"whatsNewLinkPlaceholder": "Enter the URL for your documentation...",
3115-
"whatsNewLinkHelp": "Provide a valid URL that users can visit for your news."
3115+
"whatsNewLinkHelp": "Provide a valid URL that users can visit for your news.",
3116+
"deleteBranding": "Delete Branding",
3117+
"deleteBrandingContent": "Are you sure you want to delete \"{orgName}\" branding?"
31163118
},
31173119
"networkMessage": {
31183120
"200": "Success",

client/packages/lowcoder/src/pages/editor/appEditorInternal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ export const AppEditorInternalView = React.memo((props: AppEditorInternalViewPro
239239
locale={getAntdLocale(currentUser.uiLanguage)}
240240
theme={{
241241
token: {
242-
fontFamily: 'Roboto, sans-serif',
242+
fontFamily: `-apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Segoe UI", "PingFang SC",
243+
"Microsoft Yahei", "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
244+
"Segoe UI Symbol", "Noto Color Emoji"`,
243245
},
244246
}}
245247
>

client/packages/lowcoder/src/pages/setting/branding/BrandingSetting.tsx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HelpText } from "components/HelpText";
22
import { Upload, Switch, Card, Input, message, Divider } from "antd";
3-
import { TacoButton, CustomSelect, messageInstance, Dropdown, ResetIcon } from "lowcoder-design";
3+
import { TacoButton, CustomSelect, messageInstance, Dropdown, ResetIcon, CustomModal } from "lowcoder-design";
44
import React, { useEffect, useMemo, useState } from "react";
55
import { useDispatch, useSelector } from "react-redux";
66
import styled from "styled-components";
@@ -21,7 +21,6 @@ import { getUser } from "@lowcoder-ee/redux/selectors/usersSelectors";
2121
import { Org } from "@lowcoder-ee/constants/orgConstants";
2222
import { BrandingConfig, BrandingSettings, createBranding, getBranding } from "@lowcoder-ee/api/enterpriseApi";
2323
import Flex from "antd/es/flex";
24-
import Button from "antd/es/button";
2524
import { fetchBrandingSetting } from "@lowcoder-ee/redux/reduxActions/enterpriseActions";
2625
import { Level1SettingPageTitle } from "../styled";
2726

@@ -184,6 +183,7 @@ const beforeUpload = (file: RcFile) => {
184183
export function BrandingSetting() {
185184
const dispatch = useDispatch();
186185
const [configOrgId, setConfigOrgId] = useState<string>('');
186+
const [configOrgName, setConfigOrgName] = useState<string | undefined>('Global');
187187
const [settings, setSettings] = useState<BrandingSettings>(defaultSettings);
188188
const [brandingConfig, setBrandingConfig] = useState<BrandingConfig>();
189189
const [defaultBrandingConfig, setDefaultBrandingConfig] = useState<BrandingConfig>();
@@ -273,7 +273,7 @@ export function BrandingSetting() {
273273
}
274274
}
275275

276-
const handleSave = async () => {
276+
const handleSave = async (brandingConfig?: BrandingConfig) => {
277277
try {
278278
await createBranding({
279279
...brandingConfig,
@@ -288,6 +288,26 @@ export function BrandingSetting() {
288288
}
289289
}
290290

291+
const handleDelete = (id: string) => {
292+
CustomModal.confirm({
293+
title: trans("branding.deleteBranding"),
294+
content: trans("branding.deleteBrandingContent", {orgName: configOrgName}),
295+
onConfirm: () => {
296+
const newBrandingConfig = {
297+
...brandingConfig,
298+
config_name: '',
299+
config_description: '',
300+
config_icon: '',
301+
config_set: {},
302+
}
303+
setBrandingConfig(newBrandingConfig);
304+
handleSave(newBrandingConfig);
305+
},
306+
confirmBtnType: "delete",
307+
okText: trans("delete"),
308+
})
309+
}
310+
291311
const uploadButton = (loading: boolean) => (
292312
<div>
293313
{loading ? <LoadingOutlined /> : <PlusOutlined />}
@@ -319,6 +339,7 @@ export function BrandingSetting() {
319339
allowClear
320340
onChange={(value) => {
321341
setConfigOrgId(value);
342+
setConfigOrgName(orgsList.find(org => org.value === value)?.label)
322343
}}
323344
value={configOrgId}
324345
/>
@@ -756,6 +777,13 @@ export function BrandingSetting() {
756777
</BrandingSettingContent>
757778

758779
<Flex gap={10} style={{ marginTop: 20 }}>
780+
<TacoButton
781+
buttonType="delete"
782+
disabled={!Boolean(brandingConfig?.id)}
783+
onClick={() => handleDelete(brandingConfig?.id!)}
784+
>
785+
{trans("delete")}
786+
</TacoButton>
759787
<TacoButton
760788
buttonType="normal"
761789
icon={<ResetIcon />}
@@ -767,7 +795,7 @@ export function BrandingSetting() {
767795
<TacoButton
768796
buttonType="primary"
769797
disabled={isBrandingNotChange()}
770-
onClick={handleSave}
798+
onClick={() => handleSave(brandingConfig)}
771799
>
772800
{trans("branding.saveButton")}
773801
</TacoButton>

0 commit comments

Comments
 (0)