From b15dac9ef4b6779a4272b3aa86ce5c6949dbb2fe Mon Sep 17 00:00:00 2001 From: Teo Date: Thu, 12 Jun 2025 17:37:20 +0800 Subject: [PATCH] refactor(styles): standardize padding and width across various components for improved layout consistency --- src/renderer/src/assets/styles/ant.scss | 8 +- .../src/components/Popups/SearchPopup.tsx | 13 ++- .../Popups/SelectModelPopup/popup.tsx | 7 +- .../src/pages/history/HistoryPage.tsx | 94 ++++++++++--------- .../history/components/SearchMessage.tsx | 3 +- .../history/components/SearchResults.tsx | 3 +- .../history/components/TopicMessages.tsx | 3 +- .../history/components/TopicsHistory.tsx | 3 +- 8 files changed, 75 insertions(+), 59 deletions(-) diff --git a/src/renderer/src/assets/styles/ant.scss b/src/renderer/src/assets/styles/ant.scss index afac53a155..034207c580 100644 --- a/src/renderer/src/assets/styles/ant.scss +++ b/src/renderer/src/assets/styles/ant.scss @@ -231,11 +231,11 @@ } .ant-modal { .ant-modal-content { - border-radius: 12px !important; - border: 0.5px solid var(--color-border) !important; - padding: 0 0 8px 0 !important; + border-radius: 12px; + border: 0.5px solid var(--color-border); + padding: 0 0 8px 0; .ant-modal-header { - padding: 16px 16px 0 16px !important; + padding: 16px 16px 0 16px; border-radius: 12px; } .ant-modal-body { diff --git a/src/renderer/src/components/Popups/SearchPopup.tsx b/src/renderer/src/components/Popups/SearchPopup.tsx index 5b3936cbf5..3f0c59bf8a 100644 --- a/src/renderer/src/components/Popups/SearchPopup.tsx +++ b/src/renderer/src/components/Popups/SearchPopup.tsx @@ -32,16 +32,23 @@ const PopupContainer: React.FC = ({ resolve }) => { onCancel={onCancel} afterClose={onClose} title={null} - width="920px" + width={700} transitionName="animation-move-down" styles={{ content: { + borderRadius: 20, padding: 0, - border: `1px solid var(--color-frame-border)` + overflow: 'hidden', + paddingBottom: 16 }, - body: { height: '85vh' } + body: { + height: '85vh', + maxHeight: 'inherit', + padding: 0 + } }} centered + closable={false} footer={null}> diff --git a/src/renderer/src/components/Popups/SelectModelPopup/popup.tsx b/src/renderer/src/components/Popups/SelectModelPopup/popup.tsx index a02c63bcb2..646e8894dc 100644 --- a/src/renderer/src/components/Popups/SelectModelPopup/popup.tsx +++ b/src/renderer/src/components/Popups/SelectModelPopup/popup.tsx @@ -388,8 +388,11 @@ const PopupContainer: React.FC = ({ model, resolve }) => { borderRadius: 20, padding: 0, overflow: 'hidden', - paddingBottom: 20, - border: '1px solid var(--color-border)' + paddingBottom: 16 + }, + body: { + maxHeight: 'inherit', + padding: 0 } }} closeIcon={null} diff --git a/src/renderer/src/pages/history/HistoryPage.tsx b/src/renderer/src/pages/history/HistoryPage.tsx index f1b3890660..08619dc1a8 100644 --- a/src/renderer/src/pages/history/HistoryPage.tsx +++ b/src/renderer/src/pages/history/HistoryPage.tsx @@ -1,11 +1,11 @@ -import { ArrowLeftOutlined, EnterOutlined } from '@ant-design/icons' +import { HStack } from '@renderer/components/Layout' import { useAppDispatch } from '@renderer/store' import { loadTopicMessagesThunk } from '@renderer/store/thunk/messageThunk' import { Topic } from '@renderer/types' import type { Message } from '@renderer/types/newMessage' -import { Input, InputRef } from 'antd' +import { Divider, Input, InputRef } from 'antd' import { last } from 'lodash' -import { Search } from 'lucide-react' +import { ChevronLeft, CornerDownLeft, Search } from 'lucide-react' import { FC, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import styled from 'styled-components' @@ -73,7 +73,36 @@ const TopicsPage: FC = () => { return ( -
+ + 1 ? ( + + + + ) : ( + + + + ) + } + suffix={search.length >= 2 ? : } + ref={inputRef} + placeholder={t('models.search')} + value={search} + onChange={(e) => setSearch(e.target.value.trimStart())} + allowClear + autoFocus + spellCheck={false} + style={{ paddingLeft: 0 }} + variant="borderless" + size="middle" + onPressEnter={onSearch} + /> + + + + {/*
{stack.length > 1 && ( @@ -92,7 +121,7 @@ const TopicsPage: FC = () => { suffix={search.length >= 2 ? : } onPressEnter={onSearch} /> -
+
*/} = ({ keywords, onClick, onSearch, ...props } const ContainerWrapper = styled.div` - width: 800px; + width: 100%; + padding: 0 16px; display: flex; flex-direction: column; `