Skip to content

Commit faffd94

Browse files
Merge pull request #1785 from kamalqureshi/update_app_card_ui
Fixed description and title ellipses
2 parents d0d3169 + 21c469a commit faffd94

File tree

2 files changed

+25
-78
lines changed

2 files changed

+25
-78
lines changed

client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import history from "util/history";
2222
import { APPLICATION_VIEW_URL } from "constants/routesURL";
2323
import { TypographyText } from "../../components/TypographyText";
2424
import { useParams } from "react-router-dom";
25-
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
2625
import {FolderIcon} from "icons";
2726
import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon";
2827
import { Typography } from "antd";
2928
import { default as Form } from "antd/es/form";
3029
import { default as Input } from "antd/es/input";
30+
import { default as AntdTypographyText } from "antd/es/typography/Text";
3131
import { MultiIconDisplay } from "@lowcoder-ee/comps/comps/multiIconDisplay";
3232
import { FormStyled } from "../setting/idSource/styledComponents";
3333

@@ -107,12 +107,6 @@ const CardInfo = styled.div`
107107
cursor: pointer;
108108
padding-right: 12px;
109109
110-
&:hover {
111-
.ant-typography {
112-
color: #315efb;
113-
}
114-
}
115-
116110
.ant-typography {
117111
padding: 2px 2px 8px 2px;
118112
}
@@ -138,6 +132,20 @@ const OperationWrapper = styled.div`
138132
}
139133
`;
140134

135+
export const StyledTypographyText = styled(AntdTypographyText)`
136+
font-size: 14px;
137+
color: #333333;
138+
line-height: 14px;
139+
overflow: hidden;
140+
text-overflow: ellipsis;
141+
display: block;
142+
143+
&:hover {
144+
color: #315efb;
145+
}
146+
}
147+
`;
148+
141149
const MONTH_MILLIS = 30 * 24 * 60 * 60 * 1000;
142150

143151
interface UpdateAppModalProps {
@@ -207,7 +215,6 @@ export function UpdateAppModal({ visible, onCancel, onOk, res, folderId }: Updat
207215

208216
export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => void; setModify:any; modify: boolean }) {
209217
const { res, onMove, setModify, modify } = props;
210-
const [appNameEditing, setAppNameEditing] = useState(false);
211218
const [dialogVisible, setDialogVisible] = useState(false)
212219
const dispatch = useDispatch();
213220

@@ -237,6 +244,8 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi
237244
const Icon = resInfo.icon;
238245

239246
const handleModalOk = (values: any) => {
247+
res.type === HomeResTypeEnum.Folder &&
248+
dispatch(updateFolder({ id: res.id, name: values.appName || res.name }))
240249
dispatch(
241250
updateAppMetaAction({ applicationId: res.id, name: values.appName || res.name, folderId: folderId })
242251
);
@@ -284,9 +293,6 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi
284293
}
285294
<CardInfo
286295
onClick={(e) => {
287-
if (appNameEditing) {
288-
return;
289-
}
290296
if (res.type === HomeResTypeEnum.Folder) {
291297
handleFolderViewClick(res.id);
292298
} else {
@@ -302,30 +308,9 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi
302308
}
303309
}}
304310
>
305-
<TypographyText
306-
value={res.title || res.name}
307-
editing={false}
308-
onChange={(value) => {
309-
if (!value.trim()) {
310-
messageInstance.warning(trans("home.nameCheckMessage"));
311-
return;
312-
}
313-
if (res.type === HomeResTypeEnum.Folder) {
314-
dispatch(updateFolder({ id: res.id, name: value }));
315-
setTimeout(() => {
316-
setModify(!modify);
317-
}, 200);
318-
} else {
319-
dispatch(
320-
updateAppMetaAction({ applicationId: res.id, name: value, folderId: folderId })
321-
);
322-
setTimeout(() => {
323-
setModify(!modify);
324-
}, 200);
325-
}
326-
setAppNameEditing(false);
327-
}}
328-
/>
311+
<StyledTypographyText>
312+
{res.title || res.name}
313+
</StyledTypographyText>
329314

330315
{res?.description
331316
&& <Typography.Text

client/packages/lowcoder/src/pages/ApplicationV2/HomeTableView.tsx

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { useParams } from "react-router-dom";
2424
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
2525
import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon";
2626
import { MultiIconDisplay } from "@lowcoder-ee/comps/comps/multiIconDisplay";
27-
import { UpdateAppModal } from "./HomeResCard";
27+
import { StyledTypographyText, UpdateAppModal } from "./HomeResCard";
2828

2929
const OperationWrapper = styled.div`
3030
display: flex;
@@ -49,12 +49,6 @@ const EditBtn = styled(TacoButton)`
4949
height: 24px;
5050
`;
5151

52-
const TypographyText = styled(AntdTypographyText)`
53-
margin: 0 !important;
54-
left: 0 !important;
55-
width: 100%;
56-
`;
57-
5852
export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, modify?: boolean, mode?: string }) => {
5953
const {setModify, modify, resources, mode} = props
6054
const dispatch = useDispatch();
@@ -82,6 +76,8 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
8276

8377
const handleModalOk = (values: any) => {
8478
if (currentRes) {
79+
currentRes.type === HomeResTypeEnum.Folder &&
80+
dispatch(updateFolder({ id: currentRes.id, name: values.appName || currentRes.name }))
8581
dispatch(
8682
updateAppMetaAction({ applicationId: currentRes.id, name: values.appName || currentRes.name, folderId: folderId })
8783
);
@@ -168,43 +164,9 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
168164
/>
169165
</BrandedIcon>
170166
)}
171-
<TypographyText
172-
ellipsis={true}
173-
title={item.name}
174-
editable={{
175-
enterIcon: null,
176-
tooltip: false,
177-
editing: item.id === needRenameRes?.id,
178-
icon: null,
179-
triggerType: ["text"],
180-
onChange: (value) => {
181-
if (!value.trim()) {
182-
messageInstance.warning(trans("home.nameCheckMessage"));
183-
return;
184-
}
185-
if (item.type === HomeResTypeEnum.Folder) {
186-
dispatch(updateFolder({ id: item.id, name: value }));
187-
setTimeout(() => {
188-
setModify(!modify);
189-
}, 200);
190-
} else {
191-
dispatch(
192-
updateAppMetaAction({
193-
applicationId: item.id,
194-
name: value,
195-
folderId: folderId,
196-
})
197-
);
198-
setTimeout(() => {
199-
setModify(!modify);
200-
}, 200);
201-
}
202-
setNeedRenameRes(undefined);
203-
},
204-
}}
205-
>
167+
<StyledTypographyText>
206168
{item.title || item.name}
207-
</TypographyText>
169+
</StyledTypographyText>
208170
</NameWrapper>
209171
);
210172
},

0 commit comments

Comments
 (0)