From 6882752a0d4e6c9314554df200ee96c7a61ac352 Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Sat, 16 Dec 2023 16:01:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20fontsize=20setting?= =?UTF-8?q?=20and=20audio=20download=20style=20(#433)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/de_DE/setting.json | 5 +++ locales/en_US/setting.json | 5 +++ locales/es_ES/setting.json | 5 +++ locales/fr_FR/setting.json | 5 +++ locales/ja_JP/setting.json | 5 +++ locales/ko_KR/setting.json | 5 +++ locales/pt_BR/setting.json | 5 +++ locales/ru_RU/setting.json | 5 +++ locales/tr_TR/setting.json | 5 +++ locales/zh_CN/setting.json | 5 +++ locales/zh_TW/setting.json | 5 +++ .../ChatList/Extras/TTS/Player.tsx | 2 +- src/app/chat/features/Conversation/index.tsx | 39 ++++++++++++++----- src/app/settings/common/Common.tsx | 28 ++++++++++++- src/features/AvatarWithUpload/index.tsx | 2 +- src/features/PluginStore/PluginItem/index.tsx | 15 +++++-- src/locales/default/setting.ts | 5 +++ 17 files changed, 129 insertions(+), 17 deletions(-) diff --git a/locales/de_DE/setting.json b/locales/de_DE/setting.json index 650476f38baa..684730184545 100644 --- a/locales/de_DE/setting.json +++ b/locales/de_DE/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Schriftgröße für Chat-Inhalte", + "marks": { + "large": "Groß", + "normal": "Normal", + "small": "Klein" + }, "title": "Schriftgröße" }, "lang": { diff --git a/locales/en_US/setting.json b/locales/en_US/setting.json index a14e8c94c4a3..8bd2e4794b0c 100644 --- a/locales/en_US/setting.json +++ b/locales/en_US/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Font size for chat content", + "marks": { + "large": "Large", + "normal": "Normal", + "small": "Small" + }, "title": "Font Size" }, "lang": { diff --git a/locales/es_ES/setting.json b/locales/es_ES/setting.json index 9e24797999bc..a68bd30194a4 100644 --- a/locales/es_ES/setting.json +++ b/locales/es_ES/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Tamaño de fuente para el contenido del chat", + "marks": { + "large": "Grande", + "normal": "Normal", + "small": "Pequeño" + }, "title": "Tamaño de fuente" }, "lang": { diff --git a/locales/fr_FR/setting.json b/locales/fr_FR/setting.json index 134580809835..325788b53d0d 100644 --- a/locales/fr_FR/setting.json +++ b/locales/fr_FR/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Taille de la police du contenu du chat", + "marks": { + "large": "Grand", + "normal": "Normal", + "small": "Petit" + }, "title": "Taille de la police" }, "lang": { diff --git a/locales/ja_JP/setting.json b/locales/ja_JP/setting.json index f2b917d45bd4..eaa9bf5a81c8 100644 --- a/locales/ja_JP/setting.json +++ b/locales/ja_JP/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "チャットのフォントサイズ", + "marks": { + "large": "大きい", + "normal": "標準", + "small": "小さい" + }, "title": "フォントサイズ" }, "lang": { diff --git a/locales/ko_KR/setting.json b/locales/ko_KR/setting.json index a9bc782a61fe..06a71db73527 100644 --- a/locales/ko_KR/setting.json +++ b/locales/ko_KR/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "채팅 내용의 글꼴 크기", + "marks": { + "large": "대", + "normal": "표준", + "small": "소" + }, "title": "글꼴 크기" }, "lang": { diff --git a/locales/pt_BR/setting.json b/locales/pt_BR/setting.json index 20273908ce7d..88e310741bd9 100644 --- a/locales/pt_BR/setting.json +++ b/locales/pt_BR/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Tamanho da fonte do conteúdo do chat", + "marks": { + "large": "Grande", + "normal": "Normal", + "small": "Pequeno" + }, "title": "Tamanho da Fonte" }, "lang": { diff --git a/locales/ru_RU/setting.json b/locales/ru_RU/setting.json index 04d99334cc16..19c8557e9d71 100644 --- a/locales/ru_RU/setting.json +++ b/locales/ru_RU/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Размер шрифта для чата", + "marks": { + "large": "крупный", + "normal": "стандартный", + "small": "маленький" + }, "title": "Размер шрифта" }, "lang": { diff --git a/locales/tr_TR/setting.json b/locales/tr_TR/setting.json index 84e5731aca98..c76e52ebbc42 100644 --- a/locales/tr_TR/setting.json +++ b/locales/tr_TR/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "Sohbet içeriği için yazı boyutu", + "marks": { + "large": "Büyük", + "normal": "Normal", + "small": "Küçük" + }, "title": "Yazı Boyutu" }, "lang": { diff --git a/locales/zh_CN/setting.json b/locales/zh_CN/setting.json index 37f4fc1cf45d..acf0b42939aa 100644 --- a/locales/zh_CN/setting.json +++ b/locales/zh_CN/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "聊天内容的字体大小", + "marks": { + "large": "大", + "normal": "标准", + "small": "小" + }, "title": "字体大小" }, "lang": { diff --git a/locales/zh_TW/setting.json b/locales/zh_TW/setting.json index c3233fa17cdd..02eb853f4c40 100644 --- a/locales/zh_TW/setting.json +++ b/locales/zh_TW/setting.json @@ -251,6 +251,11 @@ }, "fontSize": { "desc": "聊天內容的字體大小", + "marks": { + "large": "大", + "normal": "標準", + "small": "小" + }, "title": "字體大小" }, "lang": { diff --git a/src/app/chat/features/Conversation/ChatList/Extras/TTS/Player.tsx b/src/app/chat/features/Conversation/ChatList/Extras/TTS/Player.tsx index 967a71f2891e..cba1090e4334 100644 --- a/src/app/chat/features/Conversation/ChatList/Extras/TTS/Player.tsx +++ b/src/app/chat/features/Conversation/ChatList/Extras/TTS/Player.tsx @@ -18,7 +18,7 @@ const Player = memo(({ onRetry, error, onDelete, audio, isLoading, const { t } = useTranslation('chat'); return ( - + {error ? ( css` - overflow: hidden scroll; - height: 100%; - ${responsive.mobile} { - ${stylish.noScrollbar} - width: 100vw; - } - `, +const useStyles = createStyles(({ css, responsive, stylish, cx }, fontSize: number = 14) => + cx( + css` + overflow: hidden scroll; + height: 100%; + + ${responsive.mobile} { + ${stylish.noScrollbar} + width: 100vw; + } + `, + fontSize !== 14 && + css` + article[data-code-type='markdown'] { + p, + code, + pre, + ul, + ol, + li, + blockquote { + font-size: ${fontSize}px; + } + } + `, + ), ); interface ConversationProps { @@ -29,7 +47,8 @@ interface ConversationProps { const Conversation = memo(({ mobile, chatInput }) => { const ref = useRef(null); const { t } = useTranslation('chat'); - const { styles } = useStyles(); + const fontSize = useGlobalStore((s) => settingsSelectors.currentSettings(s).fontSize); + const { styles } = useStyles(fontSize); // init conversation useInitConversation(); diff --git a/src/app/settings/common/Common.tsx b/src/app/settings/common/Common.tsx index ad276935164d..d80b98666dda 100644 --- a/src/app/settings/common/Common.tsx +++ b/src/app/settings/common/Common.tsx @@ -131,7 +131,33 @@ const Common = memo(({ showAccessCodeConfig }) => { name: 'language', }, { - children: , + children: ( + + ), desc: t('settingTheme.fontSize.desc'), label: t('settingTheme.fontSize.title'), name: 'fontSize', diff --git a/src/features/AvatarWithUpload/index.tsx b/src/features/AvatarWithUpload/index.tsx index 6b9895c187c1..77f05688b529 100644 --- a/src/features/AvatarWithUpload/index.tsx +++ b/src/features/AvatarWithUpload/index.tsx @@ -35,7 +35,7 @@ interface AvatarWithUploadProps { } const AvatarWithUpload = memo( - ({ size = 40, compressSize = 128, style, id }) => { + ({ size = 40, compressSize = 256, style, id }) => { const [avatar, setSettings] = useGlobalStore((st) => [st.settings.avatar, st.setSettings]); const { styles } = useStyle(); diff --git a/src/features/PluginStore/PluginItem/index.tsx b/src/features/PluginStore/PluginItem/index.tsx index a3407af7f62b..871f498fe07d 100644 --- a/src/features/PluginStore/PluginItem/index.tsx +++ b/src/features/PluginStore/PluginItem/index.tsx @@ -16,15 +16,18 @@ const useStyles = createStyles(({ css, token }) => ({ desc: css` margin: 0 !important; font-size: 12px; + line-height: 1; color: ${token.colorTextDescription}; `, link: css` + overflow: hidden; color: ${token.colorText}; `, title: css` + margin: 0 !important; font-size: 14px; font-weight: bold; - line-height: 2; + line-height: 1; `, })); @@ -47,15 +50,19 @@ const PluginItem = memo(({ identifier, homepage, author, type style={{ overflow: 'hidden', position: 'relative' }} > - + {homepage ? ( -
{meta.title}
+ + {meta.title} + ) : ( -
{meta.title}
+ + {meta.title} + )}
diff --git a/src/locales/default/setting.ts b/src/locales/default/setting.ts index ec22a1e70a38..d750e9bebeb4 100644 --- a/src/locales/default/setting.ts +++ b/src/locales/default/setting.ts @@ -251,6 +251,11 @@ export default { }, fontSize: { desc: '聊天内容的字体大小', + marks: { + large: '大', + normal: '标准', + small: '小', + }, title: '字体大小', }, lang: {