Skip to content

Commit 458c918

Browse files
committed
feat: enhance database explorer UI with Radix icons and hover effects
- Replace text chevrons with ChevronRightIcon/ChevronDownIcon from Radix UI - Add TableIcon for table items instead of text character - Show reload button only on hover to reduce visual clutter - Improve icon alignment and sizing for better visual consistency Creates a cleaner, more professional interface that follows modern UI patterns.
1 parent 09126f3 commit 458c918

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

src/renderer/components/DatabaseExplorer/DatabaseExplorer.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,21 @@
5252
background: var(--gray-3);
5353
}
5454

55+
.database-reload-button {
56+
opacity: 0;
57+
transition: opacity 0.2s;
58+
}
59+
60+
.database-item:hover .database-reload-button {
61+
opacity: 1;
62+
}
63+
5564
.expand-icon {
5665
transition: transform 0.2s;
5766
display: inline-block;
58-
width: 12px;
5967
color: var(--gray-10);
68+
width: 16px;
69+
height: 16px;
6070
}
6171

6272
.object-list {

src/renderer/components/DatabaseExplorer/DatabaseExplorer.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { useState, useEffect } from 'react'
22
import { Box, Flex, ScrollArea, Text, Button } from '@radix-ui/themes'
33
import { Badge, Skeleton } from '../ui'
44
import './DatabaseExplorer.css'
5-
import { ReloadIcon } from '@radix-ui/react-icons'
5+
import {
6+
ReloadIcon,
7+
ChevronRightIcon,
8+
ChevronDownIcon,
9+
TableIcon
10+
} from '@radix-ui/react-icons'
611

712
interface DatabaseExplorerProps {
813
connectionId: string
@@ -45,7 +50,7 @@ interface Database {
4550
const getObjectIcon = (type: DatabaseObject['type']) => {
4651
switch (type) {
4752
case 'table':
48-
return '▦'
53+
return <TableIcon />
4954
case 'view':
5055
return '👁️'
5156
case 'function':
@@ -267,21 +272,21 @@ export function DatabaseExplorer({
267272
className={`database-item ${db.expanded ? 'expanded' : ''}`}
268273
p="2"
269274
>
270-
<Text
271-
size="1"
275+
<Box
272276
className="expand-icon"
273277
onClick={() => toggleDatabase(db.name)}
274-
style={{ cursor: 'pointer' }}
278+
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}
275279
>
276-
{db.expanded ? '▼' : '▶'}
277-
</Text>
280+
{db.expanded ? <ChevronDownIcon /> : <ChevronRightIcon />}
281+
</Box>
278282
<Flex align="center" justify="between" style={{ flex: 1 }}>
279283
<Text size="1" style={{ fontWeight: 500 }}>
280284
{db.name}
281285
</Text>
282286
<Button
283287
size="1"
284288
variant="ghost"
289+
className="database-reload-button"
285290
onClick={async (e) => {
286291
e.stopPropagation()
287292
// Refresh tables for this database
@@ -342,16 +347,17 @@ export function DatabaseExplorer({
342347
style={{ cursor: obj.type === 'table' ? 'pointer' : 'default' }}
343348
>
344349
{obj.type === 'table' && (
345-
<Text
346-
size="1"
350+
<Box
347351
className="expand-icon"
348352
onClick={() => toggleTable(db.name, obj.name)}
349-
style={{ cursor: 'pointer' }}
353+
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}
350354
>
351-
{obj.expanded ? '▼' : '▶'}
352-
</Text>
355+
{obj.expanded ? <ChevronDownIcon /> : <ChevronRightIcon />}
356+
</Box>
353357
)}
354-
<Text size="1">{getObjectIcon(obj.type)}</Text>
358+
<Box style={{ display: 'flex', alignItems: 'center' }}>
359+
{getObjectIcon(obj.type)}
360+
</Box>
355361
<Text size="1" className="object-name">
356362
{obj.name}
357363
</Text>

0 commit comments

Comments
 (0)