refactor: streamline Vite configuration and enhance CitationsList component

- Updated Vite configuration to remove conditional output settings, ensuring consistent build behavior.
- Refactored CitationsList component to use a Scrollbar for improved UI, encapsulating popover content within a styled container.
This commit is contained in:
kangfenmao 2025-07-14 12:57:32 +08:00
parent 90b0c91b2f
commit a490287b4a
2 changed files with 11 additions and 9 deletions

View File

@ -24,12 +24,10 @@ export default defineConfig({
build: {
rollupOptions: {
external: ['@libsql/client', 'bufferutil', 'utf-8-validate', '@cherrystudio/mac-system-ocr'],
output: isProd
? {
manualChunks: undefined, // 彻底禁用代码分割 - 返回 null 强制单文件打包
inlineDynamicImports: true // 内联所有动态导入,这是关键配置
}
: {}
output: {
manualChunks: undefined, // 彻底禁用代码分割 - 返回 null 强制单文件打包
inlineDynamicImports: true // 内联所有动态导入,这是关键配置
}
},
sourcemap: isDev
},

View File

@ -1,5 +1,6 @@
import ContextMenu from '@renderer/components/ContextMenu'
import Favicon from '@renderer/components/Icons/FallbackFavicon'
import Scrollbar from '@renderer/components/Scrollbar'
import { Citation } from '@renderer/types'
import { fetchWebContent } from '@renderer/utils/fetch'
import { cleanMarkdownContent } from '@renderer/utils/formats'
@ -43,7 +44,7 @@ const CitationsList: React.FC<CitationsListProps> = ({ citations }) => {
if (!count) return null
const popoverContent = (
<div>
<PopoverContentContainer>
{citations.map((citation) => (
<PopoverContentItem key={citation.url || citation.number}>
{citation.type === 'websearch' ? (
@ -57,7 +58,7 @@ const CitationsList: React.FC<CitationsListProps> = ({ citations }) => {
)}
</PopoverContentItem>
))}
</div>
</PopoverContentContainer>
)
return (
@ -309,9 +310,12 @@ const WebSearchCardContent = styled.div`
}
`
const PopoverContentContainer = styled(Scrollbar)`
max-height: 70vh;
`
const PopoverContent = styled.div`
max-width: min(400px, 60vw);
max-height: 60vh;
padding: 0 12px;
`