From 189f374e115ccf4d3bf895fcfab8e95132db9094 Mon Sep 17 00:00:00 2001 From: Kamal Qureshi Date: Thu, 19 Jun 2025 18:45:22 +0500 Subject: [PATCH] -Fixed description and title ellipses --- .../src/pages/ApplicationV2/HomeResCard.tsx | 55 +++++++------------ .../src/pages/ApplicationV2/HomeTableView.tsx | 48 ++-------------- 2 files changed, 25 insertions(+), 78 deletions(-) diff --git a/client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx b/client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx index 7a8ce93d1..db2758e73 100644 --- a/client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx +++ b/client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx @@ -22,12 +22,12 @@ import history from "util/history"; import { APPLICATION_VIEW_URL } from "constants/routesURL"; import { TypographyText } from "../../components/TypographyText"; import { useParams } from "react-router-dom"; -import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"; import {FolderIcon} from "icons"; import { BrandedIcon } from "@lowcoder-ee/components/BrandedIcon"; import { Typography } from "antd"; import { default as Form } from "antd/es/form"; import { default as Input } from "antd/es/input"; +import { default as AntdTypographyText } from "antd/es/typography/Text"; import { MultiIconDisplay } from "@lowcoder-ee/comps/comps/multiIconDisplay"; import { FormStyled } from "../setting/idSource/styledComponents"; @@ -107,12 +107,6 @@ const CardInfo = styled.div` cursor: pointer; padding-right: 12px; - &:hover { - .ant-typography { - color: #315efb; - } - } - .ant-typography { padding: 2px 2px 8px 2px; } @@ -138,6 +132,20 @@ const OperationWrapper = styled.div` } `; +export const StyledTypographyText = styled(AntdTypographyText)` + font-size: 14px; + color: #333333; + line-height: 14px; + overflow: hidden; + text-overflow: ellipsis; + display: block; + + &:hover { + color: #315efb; + } + } +`; + const MONTH_MILLIS = 30 * 24 * 60 * 60 * 1000; interface UpdateAppModalProps { @@ -207,7 +215,6 @@ export function UpdateAppModal({ visible, onCancel, onOk, res, folderId }: Updat export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => void; setModify:any; modify: boolean }) { const { res, onMove, setModify, modify } = props; - const [appNameEditing, setAppNameEditing] = useState(false); const [dialogVisible, setDialogVisible] = useState(false) const dispatch = useDispatch(); @@ -237,6 +244,8 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi const Icon = resInfo.icon; const handleModalOk = (values: any) => { + res.type === HomeResTypeEnum.Folder && + dispatch(updateFolder({ id: res.id, name: values.appName || res.name })) dispatch( updateAppMetaAction({ applicationId: res.id, name: values.appName || res.name, folderId: folderId }) ); @@ -284,9 +293,6 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi } { - if (appNameEditing) { - return; - } if (res.type === HomeResTypeEnum.Folder) { handleFolderViewClick(res.id); } else { @@ -302,30 +308,9 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi } }} > - { - if (!value.trim()) { - messageInstance.warning(trans("home.nameCheckMessage")); - return; - } - if (res.type === HomeResTypeEnum.Folder) { - dispatch(updateFolder({ id: res.id, name: value })); - setTimeout(() => { - setModify(!modify); - }, 200); - } else { - dispatch( - updateAppMetaAction({ applicationId: res.id, name: value, folderId: folderId }) - ); - setTimeout(() => { - setModify(!modify); - }, 200); - } - setAppNameEditing(false); - }} - /> + + {res.title || res.name} + {res?.description && { const {setModify, modify, resources, mode} = props const dispatch = useDispatch(); @@ -82,6 +76,8 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo const handleModalOk = (values: any) => { if (currentRes) { + currentRes.type === HomeResTypeEnum.Folder && + dispatch(updateFolder({ id: currentRes.id, name: values.appName || currentRes.name })) dispatch( updateAppMetaAction({ applicationId: currentRes.id, name: values.appName || currentRes.name, folderId: folderId }) ); @@ -168,43 +164,9 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo /> )} - { - if (!value.trim()) { - messageInstance.warning(trans("home.nameCheckMessage")); - return; - } - if (item.type === HomeResTypeEnum.Folder) { - dispatch(updateFolder({ id: item.id, name: value })); - setTimeout(() => { - setModify(!modify); - }, 200); - } else { - dispatch( - updateAppMetaAction({ - applicationId: item.id, - name: value, - folderId: folderId, - }) - ); - setTimeout(() => { - setModify(!modify); - }, 200); - } - setNeedRenameRes(undefined); - }, - }} - > + {item.title || item.name} - + ); },