Skip to content

Commit fdea578

Browse files
committed
feat(explorer): interactive connection
1 parent 660bcf7 commit fdea578

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

addons/explorer/src/renderer/FileExplorer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ function openContextMenu(event: MouseEvent, file?: FileEntity) {
168168
<template>
169169
<div class="file-explorer" @contextmenu="openContextMenu">
170170
<nav data-commas class="action-line">
171-
<slot></slot>
172171
<button ref="back" type="button" data-commas :disabled="!hasPreviousValue" @click="goBack">
173172
<VisualIcon name="lucide-undo-2" />
174173
</button>

addons/explorer/src/renderer/FileExplorerPane.vue

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script lang="ts" setup>
22
import type { TerminalTab } from '@commas/types/terminal'
33
import * as commas from 'commas:api/renderer'
4+
import { watch } from 'vue'
45
import FileExplorer from './FileExplorer.vue'
56
import { getDirectoryProcess } from './compositions'
67
78
const { tab } = defineProps<{
89
tab: TerminalTab,
910
}>()
1011
11-
const { TerminalBlock, VisualIcon } = commas.ui.vueAssets
12+
const { TerminalBlock } = commas.ui.vueAssets
1213
1314
let directory = $computed({
1415
get: () => tab.cwd,
@@ -29,31 +30,19 @@ const target = $computed(() => {
2930
if (teletypes.length === 1) return teletypes[0]
3031
})
3132
32-
const isConnected = $computed(() => {
33-
if (!target) return false
34-
return !target.pane && target.idle
35-
})
36-
37-
function send() {
38-
if (!target) return
33+
watch($$(directory), () => {
34+
if (!target || target.pane || !target.idle) return
3935
const command = commas.workspace.getTerminalExecutorCommand({
4036
directory,
4137
shell: target.shell,
4238
})
4339
commas.workspace.executeTerminalTab(target, command)
44-
setTimeout(() => {
45-
commas.workspace.activateTerminalTab(target)
46-
})
47-
}
40+
})
4841
</script>
4942

5043
<template>
5144
<TerminalBlock :tab="tab" class="file-editor-pane">
52-
<FileExplorer v-model="directory">
53-
<button v-if="isConnected" type="button" data-commas @click="send">
54-
<VisualIcon name="lucide-arrow-right" />
55-
</button>
56-
</FileExplorer>
45+
<FileExplorer v-model="directory" />
5746
</TerminalBlock>
5847
</template>
5948

0 commit comments

Comments
 (0)