Skip to content

Added app meta fields title, description, category and icon in App settings #725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added app meta fields
  • Loading branch information
raheeliftikhar5 committed Feb 28, 2024
commit 08b675a233fe2ee0debd3fb6e11f3fe90fd74f83
88 changes: 78 additions & 10 deletions client/packages/lowcoder/src/comps/comps/appSettingsComp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ThemeDetail, ThemeType } from "api/commonSettingApi";
import { RecordConstructorToComp } from "lowcoder-core";
import { dropdownInputSimpleControl } from "comps/controls/dropdownInputSimpleControl";
import { MultiCompBuilder, valueComp } from "comps/generators";
import { MultiCompBuilder, valueComp, withDefault } from "comps/generators";
import { AddIcon, Dropdown } from "lowcoder-design";
import { EllipsisSpan } from "pages/setting/theme/styledComponents";
import { useEffect } from "react";
Expand All @@ -14,6 +14,10 @@ import { default as Divider } from "antd/es/divider";
import { THEME_SETTING } from "constants/routesURL";
import { CustomShortcutsComp } from "./customShortcutsComp";
import { DEFAULT_THEMEID } from "comps/utils/themeUtil";
import { StringControl } from "comps/controls/codeControl";
import { IconControl } from "comps/controls/iconControl";
import { dropdownControl } from "comps/controls/dropdownControl";
import { ApplicationCategoriesEnum } from "constants/applicationConstants";

const TITLE = trans("appSetting.title");
const USER_DEFINE = "__USER_DEFINE";
Expand Down Expand Up @@ -92,9 +96,37 @@ const SettingsStyled = styled.div`
`;

const DivStyled = styled.div`
div {
width: 100%;
display: block;
> div {
flex-wrap: wrap;
margin-bottom: 12px;

> div {
width: 100%;
display: block;
}

> div:first-child {
margin-bottom: 6px;
}

.tooltipLabel {
white-space: nowrap;
}

}
// custom styles for icon selector
.app-icon {
> div {
margin-bottom: 0;

> div:first-child {
margin-bottom: 6px;
}
> div:nth-child(2) {
width: 88%;
display: inline-block;
}
}
}
`;

Expand Down Expand Up @@ -134,7 +166,22 @@ const DividerStyled = styled(Divider)`
border-color: #e1e3eb;
`;

type AppCategoriesEnumKey = keyof typeof ApplicationCategoriesEnum
const AppCategories = Object.keys(ApplicationCategoriesEnum).map(
(cat) => {
const value = ApplicationCategoriesEnum[cat as AppCategoriesEnumKey];
return {
label: value,
value,
}
}
)

const childrenMap = {
title: withDefault(StringControl, ''),
description: withDefault(StringControl, ''),
icon: IconControl,
category: dropdownControl(AppCategories, ApplicationCategoriesEnum.BUSINESS),
maxWidth: dropdownInputSimpleControl(OPTIONS, USER_DEFINE, "1920"),
themeId: valueComp<string>(DEFAULT_THEMEID),
customShortcuts: CustomShortcutsComp,
Expand All @@ -146,7 +193,16 @@ type ChildrenInstance = RecordConstructorToComp<typeof childrenMap> & {
};

function AppSettingsModal(props: ChildrenInstance) {
const { themeList, defaultTheme, themeId, maxWidth } = props;
const {
themeList,
defaultTheme,
themeId,
maxWidth,
title,
description,
icon,
category,
} = props;
const THEME_OPTIONS = themeList?.map((theme) => ({
label: theme.name,
value: theme.id + "",
Expand Down Expand Up @@ -182,16 +238,30 @@ function AppSettingsModal(props: ChildrenInstance) {
<SettingsStyled>
<Title>{TITLE}</Title>
<DivStyled>
{title.propertyView({
label: trans("appSetting.appTitle"),
placeholder: trans("appSetting.appTitle")
})}
{description.propertyView({
label: trans("appSetting.appDescription"),
placeholder: trans("appSetting.appDescription")
})}
{category.propertyView({
label: trans("appSetting.appCategory"),
})}
<div className="app-icon">
{icon.propertyView({
label: trans("icon"),
tooltip: trans("aggregation.iconTooltip"),
})}
</div>
{maxWidth.propertyView({
dropdownLabel: trans("appSetting.canvasMaxWidth"),
inputLabel: trans("appSetting.userDefinedMaxWidth"),
inputPlaceholder: trans("appSetting.inputUserDefinedPxValue"),
placement: "bottom",
min: 350,
lastNode: <span>{trans("appSetting.maxWidthTip")}</span>,
labelStyle: {marginBottom: "8px"},
dropdownStyle: {marginBottom: "12px"},
inputStyle: {marginBottom: "12px"}
})}
<Dropdown
defaultValue={
Expand All @@ -205,8 +275,6 @@ function AppSettingsModal(props: ChildrenInstance) {
options={THEME_OPTIONS}
label={trans("appSetting.themeSetting")}
placement="bottom"
labelStyle={{marginBottom: "8px"}}
dropdownStyle={{marginBottom: "12px"}}
itemNode={(value) => <DropdownItem value={value} />}
preNode={() => (
<>
Expand Down
5 changes: 4 additions & 1 deletion client/packages/lowcoder/src/i18n/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,10 @@ export const de = {
"maxWidthTip": "Die maximale Breite sollte größer als oder gleich 350 sein",
"themeSetting": "Angewandter Stil Thema",
"themeSettingDefault": "Standard",
"themeCreate": "Thema erstellen"
"themeCreate": "Thema erstellen",
"appTitle": "Titel",
"appDescription": "Beschreibung",
"appCategory": "Kategorie",
},
"customShortcut": {
"title": "Benutzerdefinierte Abkürzungen",
Expand Down
5 changes: 4 additions & 1 deletion client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,10 @@ export const en = {
"maxWidthTip": "Max Width Should Be Greater Than or Equal to 350",
"themeSetting": "Applied Style Theme",
"themeSettingDefault": "Default",
"themeCreate": "Create Theme"
"themeCreate": "Create Theme",
"appTitle": "Title",
"appDescription": "Description",
"appCategory": "Category",
},
"customShortcut": {
"title": "Custom Shortcuts",
Expand Down
3 changes: 3 additions & 0 deletions client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,9 @@ appSetting: {
themeSetting: "主题设置",
themeSettingDefault: "默认",
themeCreate: "创建主题",
appTitle: "标题",
appDescription: "描述",
appCategory: "类别",
},
customShortcut: {
title: "自定义快捷键",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const RightStyledCard = styled(Card)`

export const LeftPanel = styled(StyledCard)`
display: block;
z-index: ${Layers.rightPanel};
`;
export const RightPanelWrapper = styled(RightStyledCard)`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ export const CollapseWrapper = styled.div<{ $clientX?: number }>`
display: none;
}
.simplebar-content > div {
padding: 0;
// padding: 0;
}
`;