Skip to content

Commit 09126f3

Browse files
committed
fix: improve database explorer UX by separating expand/collapse from selection
- Only chevron icons expand/collapse items, not the entire row - Double-click on table name opens it without toggling expansion - Prevent text selection on double-click with user-select: none - Add cursor pointer to chevron icons for better affordance This prevents the confusing behavior where double-clicking would both open the table and toggle column visibility.
1 parent db65ac1 commit 09126f3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/renderer/components/DatabaseExplorer/DatabaseExplorer.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
background: var(--gray-1);
44
border-right: 1px solid var(--gray-4);
55
overflow: hidden;
6+
user-select: none;
67
}
78

89
.explorer-header {
@@ -68,6 +69,7 @@
6869
border-radius: var(--radius-2);
6970
transition: all 0.2s;
7071
margin-left: 8px;
72+
user-select: none;
7173
}
7274

7375
.object-item:hover {

src/renderer/components/DatabaseExplorer/DatabaseExplorer.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,13 @@ export function DatabaseExplorer({
266266
gap="2"
267267
className={`database-item ${db.expanded ? 'expanded' : ''}`}
268268
p="2"
269-
onClick={() => toggleDatabase(db.name)}
270269
>
271-
<Text size="1" className="expand-icon">
270+
<Text
271+
size="1"
272+
className="expand-icon"
273+
onClick={() => toggleDatabase(db.name)}
274+
style={{ cursor: 'pointer' }}
275+
>
272276
{db.expanded ? '▼' : '▶'}
273277
</Text>
274278
<Flex align="center" justify="between" style={{ flex: 1 }}>
@@ -330,7 +334,6 @@ export function DatabaseExplorer({
330334
gap="2"
331335
className={`object-item ${obj.expanded ? 'expanded' : ''}`}
332336
p="1"
333-
onClick={() => obj.type === 'table' && toggleTable(db.name, obj.name)}
334337
onDoubleClick={() => {
335338
if (obj.type === 'table' && onTableDoubleClick) {
336339
onTableDoubleClick(db.name, obj.name)
@@ -339,7 +342,12 @@ export function DatabaseExplorer({
339342
style={{ cursor: obj.type === 'table' ? 'pointer' : 'default' }}
340343
>
341344
{obj.type === 'table' && (
342-
<Text size="1" className="expand-icon">
345+
<Text
346+
size="1"
347+
className="expand-icon"
348+
onClick={() => toggleTable(db.name, obj.name)}
349+
style={{ cursor: 'pointer' }}
350+
>
343351
{obj.expanded ? '▼' : '▶'}
344352
</Text>
345353
)}

0 commit comments

Comments
 (0)