Files was the first tab and the one selected when the pane opened. The preview is what a room looks at while the agent works, so it comes first and is selected on open. Files is second and Terminal last. The panel order in the body follows the tabs, so the tablist, the DOM order, and arrow-key navigation stay in step.
57 lines
1.9 KiB
Vue
57 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
import { Eye, FolderTree, PanelRightClose, Terminal } from 'lucide-vue-next'
|
|
import type { PreviewTarget } from '~/types'
|
|
|
|
type Tab = 'terminal' | 'preview' | 'files'
|
|
|
|
defineProps<{ roomId: string; roomName: string; preview: PreviewTarget | null }>()
|
|
const emit = defineEmits<{ close: [] }>()
|
|
|
|
const tab = ref<Tab>('preview')
|
|
const tabs: Array<{ id: Tab; label: string; icon: typeof Terminal }> = [
|
|
{ id: 'preview', label: 'Preview', icon: Eye },
|
|
{ id: 'files', label: 'Files', icon: FolderTree },
|
|
{ id: 'terminal', label: 'Terminal', icon: Terminal },
|
|
]
|
|
</script>
|
|
|
|
<template>
|
|
<aside class="right-pane right-pane-overlay" aria-label="Workspace panes">
|
|
<div class="pane-head">
|
|
<div class="pane-tabs" role="tablist" aria-label="Workspace panels">
|
|
<button
|
|
v-for="item in tabs"
|
|
:key="item.id"
|
|
type="button"
|
|
class="pane-tab"
|
|
:class="{ active: tab === item.id }"
|
|
role="tab"
|
|
:id="`pane-tab-${item.id}`"
|
|
:aria-selected="tab === item.id"
|
|
aria-controls="pane-panel"
|
|
@click="tab = item.id"
|
|
>
|
|
<component :is="item.icon" :size="14" aria-hidden="true" />
|
|
{{ item.label }}
|
|
</button>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="icon-btn"
|
|
aria-label="Close side pane"
|
|
title="Close side pane"
|
|
@click="emit('close')"
|
|
>
|
|
<PanelRightClose :size="16" aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
|
|
<div id="pane-panel" class="pane-body" role="tabpanel" :aria-labelledby="`pane-tab-${tab}`">
|
|
<PreviewPane v-if="tab === 'preview'" :room-id="roomId" :target="preview" />
|
|
<FilesPane v-else-if="tab === 'files'" :room-id="roomId" :room-name="roomName" />
|
|
<TerminalPane v-else :room-id="roomId" />
|
|
</div>
|
|
</aside>
|
|
</template>
|