From 3f01ce87fae9e46fcbb330c24732c4733b9f7f59 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 13 Feb 2025 17:35:17 +0800 Subject: [PATCH] feat: optimize translation display --- .../entry-column/templates/list-item-template.tsx | 5 ++++- .../src/modules/entry-column/translation.tsx | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx index 183f2ac49..2b1ae202b 100644 --- a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx +++ b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx @@ -50,11 +50,14 @@ export function ListItem({ entryId, entryPreview, translation }: UniversalItemPr const lineClamp = useMemo(() => { const envIsSafari = isSafari() let lineClampTitle = settingWideMode ? 1 : 2 - const lineClampDescription = settingWideMode ? 1 : 2 + let lineClampDescription = settingWideMode ? 1 : 2 if (translation?.title) { lineClampTitle += 1 } + if (translation?.description) { + lineClampDescription += 1 + } // for tailwind // line-clamp-[1] line-clamp-[2] line-clamp-[3] line-clamp-[4] line-clamp-[5] line-clamp-[6] line-clamp-[7] line-clamp-[8] diff --git a/apps/renderer/src/modules/entry-column/translation.tsx b/apps/renderer/src/modules/entry-column/translation.tsx index 8d56f6a99..557ff7d3b 100644 --- a/apps/renderer/src/modules/entry-column/translation.tsx +++ b/apps/renderer/src/modules/entry-column/translation.tsx @@ -24,12 +24,8 @@ export const EntryTranslation: Component<{
{isHTML ? ( <> - - {source} - {nextTarget && ( <> - {nextTarget} + )} + + {source} + ) : ( <>
- {source} {nextTarget && ( <> - {nextTarget} + )} + {source}
)}