22import { computed , onUnmounted , ref } from " vue" ;
33import { storeToRefs } from " pinia" ;
44import { useShellStore } from " ../stores/shell" ;
5- import {
6- useConnectionsStore ,
7- type LiveConnection ,
8- } from " ../stores/connections" ;
5+ import { useConnectionsStore } from " ../stores/connections" ;
96import { useFoldersStore } from " ../stores/folders" ;
107import {
118 isPgSchemaToolFolder ,
@@ -16,6 +13,7 @@ import { useQueryaMotion } from "../motion";
1613import SplitHandle from " ./SplitHandle.vue" ;
1714import QueryaContextMenu , { type CtxItem } from " ./QueryaContextMenu.vue" ;
1815import SqlObjectTreeNodes from " ./SqlObjectTreeNodes.vue" ;
16+ import { QueryaIcon , QueryaDriverIcon } from " ./icons" ;
1917
2018const emit = defineEmits <{
2119 newConnection: [];
@@ -242,11 +240,6 @@ function filteredRootsFor(connId: string) {
242240 return tree .filteredRootsFor (connId );
243241}
244242
245- function driverGlyph(c : LiveConnection ): string {
246- if (c .mock ) return " ◈" ;
247- if (c .driver === " postgres" ) return " ◇" ;
248- return " ▤" ;
249- }
250243
251244onUnmounted (() => {
252245 dragging .value = false ;
@@ -301,9 +294,16 @@ onUnmounted(() => {
301294 :aria-label =" `Expand ${row.folder.name}`"
302295 @click =" onFolderExpand(row.folder.id, $event)"
303296 >
304- {{ row.folder.expanded || row.forceOpen ? "▾" : "▸" }}
297+ <QueryaIcon
298+ :name ="
299+ row .folder .expanded || row .forceOpen
300+ ? ' chevronDown'
301+ : ' chevronRight'
302+ "
303+ :size =" 12 "
304+ />
305305 </button >
306- <span class =" folder-ico" aria-hidden = " true " >▣</ span >
306+ <QueryaIcon class="folder-ico" name="folder" : size = " 14 " / >
307307 <span class =" folder-name" >{{ row.folder.name }}</span >
308308 <span class =" count-sm" >{{ row.children.length }}</span >
309309 </div >
@@ -338,17 +338,23 @@ onUnmounted(() => {
338338 "
339339 @click =" onConnExpand(c.id, $event)"
340340 >
341- {{ nav.isExpanded(c.id) ? "▾" : "▸" }}
341+ <QueryaIcon
342+ :name =" nav .isExpanded (c .id ) ? ' chevronDown' : ' chevronRight' "
343+ :size =" 12 "
344+ />
342345 </button >
343346 <button
344347 type =" button"
345348 class =" conn-main"
346349 @click =" onConnClick(c.id)"
347350 @dblclick =" onConnExpand(c.id, $event)"
348351 >
349- <span class =" glyph" aria-hidden =" true" >{{
350- driverGlyph(c)
351- }}</span >
352+ <QueryaDriverIcon
353+ class="glyph"
354+ :driver =" c .driver "
355+ :mock =" !! c .mock "
356+ :size =" 14 "
357+ />
352358 <span class =" conn-name" >{{ c.name }}</span >
353359 <span class =" conn-meta" >
354360 {{ c.driver
@@ -370,7 +376,7 @@ onUnmounted(() => {
370376 aria-label =" Refresh"
371377 @click =" tree.refresh(c.id)"
372378 >
373- ↻
379+ < QueryaIcon name="refresh" : size = " 12 " />
374380 </button >
375381 </div >
376382 <input
@@ -432,17 +438,23 @@ onUnmounted(() => {
432438 "
433439 @click =" onConnExpand(c.id, $event)"
434440 >
435- {{ nav.isExpanded(c.id) ? "▾" : "▸" }}
441+ <QueryaIcon
442+ :name =" nav .isExpanded (c .id ) ? ' chevronDown' : ' chevronRight' "
443+ :size =" 12 "
444+ />
436445 </button >
437446 <button
438447 type =" button"
439448 class =" conn-main"
440449 @click =" onConnClick(c.id)"
441450 @dblclick =" onConnExpand(c.id, $event)"
442451 >
443- <span class =" glyph" aria-hidden =" true" >{{
444- driverGlyph(c)
445- }}</span >
452+ <QueryaDriverIcon
453+ class="glyph"
454+ :driver =" c .driver "
455+ :mock =" !! c .mock "
456+ :size =" 14 "
457+ />
446458 <span class =" conn-name" >{{ c.name }}</span >
447459 <span class =" conn-meta" >
448460 {{ c.driver }}<template v-if =" c .mock " > · demo</template >
@@ -463,7 +475,7 @@ onUnmounted(() => {
463475 aria-label =" Refresh"
464476 @click =" tree.refresh(c.id)"
465477 >
466- ↻
478+ < QueryaIcon name="refresh" : size = " 12 " />
467479 </button >
468480 </div >
469481 <input
@@ -611,8 +623,7 @@ onUnmounted(() => {
611623}
612624
613625.folder-ico {
614- font-size : 12px ;
615- line-height : 1 ;
626+ color : var (--q-muted-foreground );
616627}
617628
618629.folder-name {
@@ -626,24 +637,28 @@ onUnmounted(() => {
626637
627638.chev {
628639 width : 18px ;
640+ height : 18px ;
629641 flex : 0 0 18px ;
642+ display : inline-flex ;
643+ align-items : center ;
644+ justify-content : center ;
630645 appearance : none ;
631646 border : 0 ;
632647 background : transparent ;
633648 color : var (--q-muted-foreground );
634649 cursor : pointer ;
635- font-size : 10px ;
636- line-height : 1 ;
637650 padding : 0 ;
638651}
639652
640653.conn-main {
641654 flex : 1 ;
642655 min-width : 0 ;
643- display : flex ;
644- flex-direction : column ;
645- align-items : flex-start ;
646- gap : 1px ;
656+ display : grid ;
657+ grid-template-columns : auto 1fr ;
658+ grid-template-rows : auto auto ;
659+ column-gap : 8px ;
660+ row-gap : 1px ;
661+ align-items : center ;
647662 appearance : none ;
648663 border : 0 ;
649664 background : transparent ;
@@ -653,20 +668,21 @@ onUnmounted(() => {
653668 padding : 5px 6px ;
654669 border-radius : var (--q-radius-control );
655670 cursor : pointer ;
656- position : relative ;
657671}
658672
659673.conn-main .glyph {
660- position : absolute ;
661- left : 6px ;
662- top : 8px ;
663- font-size : 10px ;
674+ grid-row : 1 / span 2 ;
664675 color : var (--q-muted-foreground );
665676}
666677
667- .conn-main .conn-name ,
678+ .conn-main .conn-name {
679+ grid-column : 2 ;
680+ grid-row : 1 ;
681+ }
682+
668683.conn-main .conn-meta {
669- padding-left : 16px ;
684+ grid-column : 2 ;
685+ grid-row : 2 ;
670686}
671687
672688.conn-main :hover {
0 commit comments